I have the same issue with the lesson1 notebook. It works fine using the dogscats dataset, but when I use another dataset with dog breeds, it fails with the same error as above. Deleting the tmp directory doesn’t help. This is the entire stack trace:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-17-42d5f498bf97> in <module>()
1 arch=resnet34
2 data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
----> 3 learn = ConvLearner.pretrained(arch, data, precompute=True)
4 learn.fit(0.01, 3)
~\fastai\fastai\conv_learner.py in pretrained(cls, f, data, ps, xtra_fc, xtra_cut, **kwargs)
96 def pretrained(cls, f, data, ps=None, xtra_fc=None, xtra_cut=0, **kwargs):
97 models = ConvnetBuilder(f, data.c, data.is_multi, data.is_reg, ps=ps, xtra_fc=xtra_fc, xtra_cut=xtra_cut)
---> 98 return cls(data, models, **kwargs)
99
100 @property
~\fastai\fastai\conv_learner.py in __init__(self, data, models, precompute, **kwargs)
89 elif self.metrics is None:
90 self.metrics = [accuracy_multi] if self.data.is_multi else [accuracy]
---> 91 if precompute: self.save_fc1()
92 self.freeze()
93 self.precompute = precompute
~\fastai\fastai\conv_learner.py in save_fc1(self)
135 m=self.models.top_model
136 if len(self.activations[0])!=len(self.data.trn_ds):
--> 137 predict_to_bcolz(m, self.data.fix_dl, act)
138 if len(self.activations[1])!=len(self.data.val_ds):
139 predict_to_bcolz(m, self.data.val_dl, val_act)
~\fastai\fastai\model.py in predict_to_bcolz(m, gen, arr, workers)
11 lock=threading.Lock()
12 m.eval()
---> 13 for x,*_ in tqdm(gen):
14 y = to_np(m(VV(x)).data)
15 with lock:
c:\users\hille\anaconda3\envs\dlwin36\lib\site-packages\tqdm\_tqdm.py in __iter__(self)
951 """, fp_write=getattr(self.fp, 'write', sys.stderr.write))
952
--> 953 for obj in iterable:
954 yield obj
955 # Update and possibly print the progressbar.
~\fastai\fastai\dataset.py in __next__(self)
242 if self.i>=len(self.dl): raise StopIteration
243 self.i+=1
--> 244 return next(self.it)
245
246 @property
~\fastai\fastai\dataloader.py in __iter__(self)
73 def __iter__(self):
74 with ThreadPoolExecutor(max_workers=self.num_workers) as e:
---> 75 for batch in e.map(self.get_batch, iter(self.batch_sampler)):
76 yield get_tensor(batch, self.pin_memory)
77
c:\users\hille\anaconda3\envs\dlwin36\lib\concurrent\futures\_base.py in result_iterator()
554 for future in fs:
555 if timeout is None:
--> 556 yield future.result()
557 else:
558 yield future.result(end_time - time.time())
c:\users\hille\anaconda3\envs\dlwin36\lib\concurrent\futures\_base.py in result(self, timeout)
396 raise CancelledError()
397 elif self._state == FINISHED:
--> 398 return self.__get_result()
399
400 self._condition.wait(timeout)
c:\users\hille\anaconda3\envs\dlwin36\lib\concurrent\futures\_base.py in __get_result(self)
355 def __get_result(self):
356 if self._exception:
--> 357 raise self._exception
358 else:
359 return self._result
c:\users\hille\anaconda3\envs\dlwin36\lib\concurrent\futures\thread.py in run(self)
53
54 try:
---> 55 result = self.fn(*self.args, **self.kwargs)
56 except BaseException as e:
57 self.future.set_exception(e)
~\fastai\fastai\dataloader.py in get_batch(self, indices)
66
67 def get_batch(self, indices):
---> 68 res = self.collate_fn([self.dataset[i] for i in indices], self.pad_idx)
69 if not self.transpose: return res
70 res[0] = res[0].T
~\fastai\fastai\dataloader.py in <listcomp>(.0)
66
67 def get_batch(self, indices):
---> 68 res = self.collate_fn([self.dataset[i] for i in indices], self.pad_idx)
69 if not self.transpose: return res
70 res[0] = res[0].T
~\fastai\fastai\dataset.py in __getitem__(self, idx)
96 def __getitem__(self, idx):
97 x,y = self.get_x(idx),self.get_y(idx)
---> 98 return self.get(self.transform, x, y)
99
100 def __len__(self): return self.n
~\fastai\fastai\dataset.py in get(self, tfm, x, y)
101
102 def get(self, tfm, x, y):
--> 103 return (x,y) if tfm is None else tfm(x,y)
104
105 @abstractmethod
~\fastai\fastai\transforms.py in __call__(self, im, y)
463 if crop_type == CropType.NO: crop_tfm = NoCropXY(sz, tfm_y)
464 self.tfms = tfms + [crop_tfm, normalizer, channel_dim]
--> 465 def __call__(self, im, y=None): return compose(im, y, self.tfms)
466
467
~\fastai\fastai\transforms.py in compose(im, y, fns)
444 def compose(im, y, fns):
445 for fn in fns:
--> 446 im, y =fn(im, y)
447 return im if y is None else (im, y)
448
~\fastai\fastai\transforms.py in __call__(self, x, y)
229 def __call__(self, x, y):
230 self.set_state()
--> 231 x,y = ((self.transform(x),y) if self.tfm_y==TfmType.NO
232 else self.transform(x,y) if self.tfm_y==TfmType.PIXEL
233 else self.transform_coord(x,y))
~\fastai\fastai\transforms.py in transform(self, x, y)
237
238 def transform(self, x, y=None):
--> 239 x = self.do_transform(x)
240 return (x, self.do_transform(y)) if y is not None else x
241
~\fastai\fastai\transforms.py in do_transform(self, x)
323
324 def do_transform(self, x):
--> 325 return scale_min(x, self.sz)
326
327
~\fastai\fastai\transforms.py in scale_min(im, targ)
10 targ (int): target size
11 """
---> 12 r,c,*_ = im.shape
13 ratio = targ/min(r,c)
14 sz = (scale_to(c, ratio, targ), scale_to(r, ratio, targ))
AttributeError: 'NoneType' object has no attribute 'shape'