Learn.precompute = False Error

Hi Everyone,

Got a little issue, I’m currently working on the Histopathologic Cancer Detection Kaggle competition and ran into a error while training.

Everytime I set precompute = False, I get the following error:

TypeError Traceback (most recent call last)
in
----> 1 learn.fit(1e-3, 1, cycle_len=1)

~/fastai/courses/dl1/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
300 self.sched = None
301 layer_opt = self.get_layer_opt(lrs, wds)
–> 302 return self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
303
304 def warm_up(self, lr, wds=None):

~/fastai/courses/dl1/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, best_save_name, use_clr, use_clr_beta, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, use_swa, swa_start, swa_eval_freq, **kwargs)
247 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, fp16=self.fp16,
248 swa_model=self.swa_model if use_swa else None, swa_start=swa_start,
–> 249 swa_eval_freq=swa_eval_freq, **kwargs)
250
251 def get_layer_groups(self): return self.models.get_layer_groups()

~/fastai/courses/dl1/fastai/model.py in fit(model, data, n_epochs, opt, crit, metrics, callbacks, stepper, swa_model, swa_start, swa_eval_freq, visualize, **kwargs)
136 if all_val: val_iter = IterBatch(cur_data.val_dl)
137
–> 138 for (*x,y) in t:
139 batch_num += 1
140 for cb in callbacks: cb.on_batch_begin()

~/src/anaconda3/envs/fastai/lib/python3.6/site-packages/tqdm/_tqdm.py in iter(self)
977 “”", fp_write=getattr(self.fp, ‘write’, sys.stderr.write))
978
–> 979 for obj in iterable:
980 yield obj
981 # Update and possibly print the progressbar.

~/fastai/courses/dl1/fastai/dataloader.py in iter(self)
86 # avoid py3.6 issue where queue is infinite and can result in memory exhaustion
87 for c in chunk_iter(iter(self.batch_sampler), self.num_workers*10):
—> 88 for batch in e.map(self.get_batch, c):
89 yield get_tensor(batch, self.pin_memory, self.half)
90

~/src/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in result_iterator()
584 # Careful not to keep a reference to the popped future
585 if timeout is None:
–> 586 yield fs.pop().result()
587 else:
588 yield fs.pop().result(end_time - time.monotonic())

~/src/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
–> 432 return self.__get_result()
433 else:
434 raise TimeoutError()

~/src/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
–> 384 raise self._exception
385 else:
386 return self._result

~/src/anaconda3/envs/fastai/lib/python3.6/concurrent/futures/thread.py in run(self)
54
55 try:
—> 56 result = self.fn(*self.args, **self.kwargs)
57 except BaseException as exc:
58 self.future.set_exception(exc)

~/fastai/courses/dl1/fastai/dataloader.py in get_batch(self, indices)
73
74 def get_batch(self, indices):
—> 75 res = self.np_collate([self.dataset[i] for i in indices])
76 if self.transpose: res[0] = res[0].T
77 if self.transpose_y: res[1] = res[1].T

~/fastai/courses/dl1/fastai/dataloader.py in (.0)
73
74 def get_batch(self, indices):
—> 75 res = self.np_collate([self.dataset[i] for i in indices])
76 if self.transpose: res[0] = res[0].T
77 if self.transpose_y: res[1] = res[1].T

~/fastai/courses/dl1/fastai/dataset.py in getitem(self, idx)
201 xs,ys = zip(*[self.get1item(i) for i in range(*idx.indices(self.n))])
202 return np.stack(xs),ys
–> 203 return self.get1item(idx)
204
205 def len(self): return self.n

~/fastai/courses/dl1/fastai/dataset.py in get1item(self, idx)
195 def get1item(self, idx):
196 x,y = self.get_x(idx),self.get_y(idx)
–> 197 return self.get(self.transform, x, y)
198
199 def getitem(self, idx):

~/fastai/courses/dl1/fastai/dataset.py in get(self, tfm, x, y)
206
207 def get(self, tfm, x, y):
–> 208 return (x,y) if tfm is None else tfm(x,y)
209
210 @abstractmethod

~/fastai/courses/dl1/fastai/transforms.py in call(self, im, y)
646 self.tfms.append(ChannelOrder(tfm_y))
647
–> 648 def call(self, im, y=None): return compose(im, y, self.tfms)
649 def repr(self): return str(self.tfms)
650

~/fastai/courses/dl1/fastai/transforms.py in compose(im, y, fns)
621 for fn in fns:
622 #pdb.set_trace()
–> 623 im, y =fn(im, y)
624 return im if y is None else (im, y)
625

TypeError: ‘list’ object is not callable

But when I turn precompute = True, its fine. Any Ideas?

Getting the same result in both AWS pc and local machine. Wonder if its a bug in the latest push
:thinking:

The problem was because I passed in a list of transformation. I was under the impression you could but apparently not. Error only comes up when you set precompute=False and fit the data to the model.