@sgugger quick bug report (which I know you’ll get to later):
doing the following with a list of file names on an image regression learner gives me the following issue:
dl = learn.dls.test_dl(imgs[:10])
preds = learn.get_preds(dl=dl)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-65-9a993e47d6c2> in <module>()
----> 1 preds = learn.get_preds(dl=dl)
12 frames
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in get_preds(self, ds_idx, dl, with_input, with_decoded, with_loss, act, **kwargs)
319 self(_before_epoch)
320 self._do_epoch_validate(dl=dl)
--> 321 self(_after_epoch)
322 if act is None: act = getattr(self.loss_func, 'activation', noop)
323 res = cb.all_tensors()
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in __call__(self, event_name)
226 def ordered_cbs(self, cb_func:str): return [cb for cb in sort_by_run(self.cbs) if hasattr(cb, cb_func)]
227
--> 228 def __call__(self, event_name): L(event_name).map(self._call_one)
229 def _call_one(self, event_name):
230 assert hasattr(event, event_name)
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in map(self, f, *args, **kwargs)
360 else f.format if isinstance(f,str)
361 else f.__getitem__)
--> 362 return self._new(map(g, self))
363
364 def filter(self, f, negate=False, **kwargs):
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in _new(self, items, *args, **kwargs)
313 @property
314 def _xtra(self): return None
--> 315 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
316 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
317 def copy(self): return self._new(self.items.copy())
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
39 return x
40
---> 41 res = super().__call__(*((x,) + args), **kwargs)
42 res._newchk = 0
43 return res
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
304 if items is None: items = []
305 if (use_list is not None) or not _is_array(items):
--> 306 items = list(items) if use_list else _listify(items)
307 if match is not None:
308 if is_coll(match): match = len(match)
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in _listify(o)
240 if isinstance(o, list): return o
241 if isinstance(o, str) or _is_array(o): return [o]
--> 242 if is_iter(o): return list(o)
243 return [o]
244
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __call__(self, *args, **kwargs)
206 if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
207 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 208 return self.fn(*fargs, **kwargs)
209
210 # Cell
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in _call_one(self, event_name)
229 def _call_one(self, event_name):
230 assert hasattr(event, event_name)
--> 231 [cb(event_name) for cb in sort_by_run(self.cbs)]
232
233 def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in <listcomp>(.0)
229 def _call_one(self, event_name):
230 assert hasattr(event, event_name)
--> 231 [cb(event_name) for cb in sort_by_run(self.cbs)]
232
233 def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in __call__(self, event_name)
23 _run = (event_name not in _inner_loop or (self.run_train and getattr(self, 'training', True)) or
24 (self.run_valid and not getattr(self, 'training', False)))
---> 25 if self.run and _run: getattr(self, event_name, noop)()
26
27 def __setattr__(self, name, value):
/usr/local/lib/python3.6/dist-packages/fastai2/learner.py in after_fit(self)
91 "Concatenate all recorded tensors"
92 if self.with_input: self.inputs = detuplify(to_concat(self.inputs, dim=self.concat_dim))
---> 93 if not self.save_preds: self.preds = detuplify(to_concat(self.preds, dim=self.concat_dim))
94 if not self.save_targs: self.targets = detuplify(to_concat(self.targets, dim=self.concat_dim))
95 if self.with_loss: self.losses = to_concat(self.losses)
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __getattr__(self, k)
221 attr = getattr(self,self._default,None)
222 if attr is not None: return getattr(attr, k)
--> 223 raise AttributeError(k)
224 def __dir__(self): return custom_dir(self, self._dir() if self._xtra is None else self._dir())
225 # def __getstate__(self): return self.__dict__
AttributeError: preds
Calling a show_batch
on the DataLoader
works
(Also using git version of fastai2 and fastcore)
(By the way, for these issues would it be easier to open it up on GitHub since you are all on a book push??)