Skip to content

Instantly share code, notes, and snippets.

@borisdayma
Last active July 8, 2020 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borisdayma/cce001d733bb510d1eab2400f5c4d228 to your computer and use it in GitHub Desktop.
Save borisdayma/cce001d733bb510d1eab2400f5c4d228 to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
~/Projects/fastai2/fastai2/learner.py in _do_epoch_validate(self, ds_idx, dl)
182 self.dl = dl; self('begin_validate')
--> 183 with torch.no_grad(): self.all_batches()
184 except CancelValidException: self('after_cancel_validate')
~/Projects/fastai2/fastai2/learner.py in all_batches(self)
152 self.n_iter = len(self.dl)
--> 153 for o in enumerate(self.dl): self.one_batch(*o)
154
~/Projects/fastai2/fastai2/learner.py in one_batch(self, i, b)
166 except CancelBatchException: self('after_cancel_batch')
--> 167 finally: self('after_batch')
168
~/Projects/fastai2/fastai2/learner.py in __call__(self, event_name)
133
--> 134 def __call__(self, event_name): L(event_name).map(self._call_one)
135 def _call_one(self, event_name):
~/Projects/fastcore/fastcore/foundation.py in map(self, f, *args, **kwargs)
376 else f.__getitem__)
--> 377 return self._new(map(g, self))
378
~/Projects/fastcore/fastcore/foundation.py in _new(self, items, *args, **kwargs)
326 def _xtra(self): return None
--> 327 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
328 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
~/Projects/fastcore/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
46
---> 47 res = super().__call__(*((x,) + args), **kwargs)
48 res._newchk = 0
~/Projects/fastcore/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
317 if (use_list is not None) or not _is_array(items):
--> 318 items = list(items) if use_list else _listify(items)
319 if match is not None:
~/Projects/fastcore/fastcore/foundation.py in _listify(o)
253 if isinstance(o, str) or _is_array(o): return [o]
--> 254 if is_iter(o): return list(o)
255 return [o]
~/Projects/fastcore/fastcore/foundation.py in __call__(self, *args, **kwargs)
219 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 220 return self.fn(*fargs, **kwargs)
221
~/Projects/fastai2/fastai2/learner.py in _call_one(self, event_name)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/learner.py in <listcomp>(.0)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/callback/core.py in __call__(self, event_name)
23 (self.run_valid and not getattr(self, 'training', False)))
---> 24 if self.run and _run: getattr(self, event_name, noop)()
25 if event_name=='after_fit': self.run=True #Reset self.run to True at each end of fit
~/Projects/fastai2/fastai2/callback/core.py in after_batch(self)
81 "Save predictions, targets and potentially losses"
---> 82 preds,targs = to_detach(self.pred),to_detach(self.yb)
83 if self.save_preds is None: self.preds.append(preds)
~/Projects/fastai2/fastai2/torch_core.py in to_detach(b, cpu, gather)
167 return x.cpu() if cpu else x
--> 168 return apply(_inner, b, cpu=cpu, gather=gather)
169
~/Projects/fastai2/fastai2/torch_core.py in apply(func, x, *args, **kwargs)
147 if isinstance(x,dict): return {k: apply(func, v, *args, **kwargs) for k,v in x.items()}
--> 148 res = func(x, *args, **kwargs)
149 return res if x is None else retain_type(res, x)
~/Projects/fastai2/fastai2/torch_core.py in _inner(x, cpu, gather)
166 if gather: x = maybe_gather(x)
--> 167 return x.cpu() if cpu else x
168 return apply(_inner, b, cpu=cpu, gather=gather)
RuntimeError: CUDA error: device-side assert triggered
During handling of the above exception, another exception occurred:
IndexError Traceback (most recent call last)
~/Projects/fastai2/fastai2/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
203 self._do_epoch_train()
--> 204 self._do_epoch_validate()
205 except CancelEpochException: self('after_cancel_epoch')
~/Projects/fastai2/fastai2/learner.py in _do_epoch_validate(self, ds_idx, dl)
184 except CancelValidException: self('after_cancel_validate')
--> 185 finally: self('after_validate')
186
~/Projects/fastai2/fastai2/learner.py in __call__(self, event_name)
133
--> 134 def __call__(self, event_name): L(event_name).map(self._call_one)
135 def _call_one(self, event_name):
~/Projects/fastcore/fastcore/foundation.py in map(self, f, *args, **kwargs)
376 else f.__getitem__)
--> 377 return self._new(map(g, self))
378
~/Projects/fastcore/fastcore/foundation.py in _new(self, items, *args, **kwargs)
326 def _xtra(self): return None
--> 327 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
328 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
~/Projects/fastcore/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
46
---> 47 res = super().__call__(*((x,) + args), **kwargs)
48 res._newchk = 0
~/Projects/fastcore/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
317 if (use_list is not None) or not _is_array(items):
--> 318 items = list(items) if use_list else _listify(items)
319 if match is not None:
~/Projects/fastcore/fastcore/foundation.py in _listify(o)
253 if isinstance(o, str) or _is_array(o): return [o]
--> 254 if is_iter(o): return list(o)
255 return [o]
~/Projects/fastcore/fastcore/foundation.py in __call__(self, *args, **kwargs)
219 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 220 return self.fn(*fargs, **kwargs)
221
~/Projects/fastai2/fastai2/learner.py in _call_one(self, event_name)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/learner.py in <listcomp>(.0)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/callback/core.py in __call__(self, event_name)
23 (self.run_valid and not getattr(self, 'training', False)))
---> 24 if self.run and _run: getattr(self, event_name, noop)()
25 if event_name=='after_fit': self.run=True #Reset self.run to True at each end of fit
~/Projects/fastai2/fastai2/callback/core.py in after_validate(self)
115 with self.learn.removed_cbs(to_rm + self.cbs) as learn:
--> 116 self.preds = learn.get_preds(ds_idx=self.ds_idx, dl=self.dl,
117 with_input=self.with_input, with_decoded=self.with_decoded, inner=True)
~/Projects/fastai2/fastai2/learner.py in get_preds(self, ds_idx, dl, with_input, with_decoded, with_loss, act, inner, reorder, **kwargs)
233 self(event.begin_epoch if inner else _before_epoch)
--> 234 self._do_epoch_validate(dl=dl)
235 self(event.after_epoch if inner else _after_epoch)
~/Projects/fastai2/fastai2/learner.py in _do_epoch_validate(self, ds_idx, dl)
184 except CancelValidException: self('after_cancel_validate')
--> 185 finally: self('after_validate')
186
~/Projects/fastai2/fastai2/learner.py in __call__(self, event_name)
133
--> 134 def __call__(self, event_name): L(event_name).map(self._call_one)
135 def _call_one(self, event_name):
~/Projects/fastcore/fastcore/foundation.py in map(self, f, *args, **kwargs)
376 else f.__getitem__)
--> 377 return self._new(map(g, self))
378
~/Projects/fastcore/fastcore/foundation.py in _new(self, items, *args, **kwargs)
326 def _xtra(self): return None
--> 327 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
328 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
~/Projects/fastcore/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
46
---> 47 res = super().__call__(*((x,) + args), **kwargs)
48 res._newchk = 0
~/Projects/fastcore/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
317 if (use_list is not None) or not _is_array(items):
--> 318 items = list(items) if use_list else _listify(items)
319 if match is not None:
~/Projects/fastcore/fastcore/foundation.py in _listify(o)
253 if isinstance(o, str) or _is_array(o): return [o]
--> 254 if is_iter(o): return list(o)
255 return [o]
~/Projects/fastcore/fastcore/foundation.py in __call__(self, *args, **kwargs)
219 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 220 return self.fn(*fargs, **kwargs)
221
~/Projects/fastai2/fastai2/learner.py in _call_one(self, event_name)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/learner.py in <listcomp>(.0)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/callback/core.py in __call__(self, event_name)
23 (self.run_valid and not getattr(self, 'training', False)))
---> 24 if self.run and _run: getattr(self, event_name, noop)()
25 if event_name=='after_fit': self.run=True #Reset self.run to True at each end of fit
~/Projects/fastai2/fastai2/callback/core.py in after_validate(self)
94 if self.with_input: self.inputs = detuplify(to_concat(self.inputs, dim=self.concat_dim))
---> 95 if not self.save_preds: self.preds = detuplify(to_concat(self.preds, dim=self.concat_dim))
96 if not self.save_targs: self.targets = detuplify(to_concat(self.targets, dim=self.concat_dim))
~/Projects/fastai2/fastai2/torch_core.py in to_concat(xs, dim)
212 "Concat the element in `xs` (recursively if they are tuples/lists of tensors)"
--> 213 if is_listy(xs[0]): return type(xs[0])([to_concat([x[i] for x in xs], dim=dim) for i in range_of(xs[0])])
214 if isinstance(xs[0],dict): return {k: to_concat([x[k] for x in xs], dim=dim) for k in xs[0].keys()}
IndexError: list index out of range
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
~/Projects/fastai2/fastai2/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
205 except CancelEpochException: self('after_cancel_epoch')
--> 206 finally: self('after_epoch')
207
~/Projects/fastai2/fastai2/learner.py in __call__(self, event_name)
133
--> 134 def __call__(self, event_name): L(event_name).map(self._call_one)
135 def _call_one(self, event_name):
~/Projects/fastcore/fastcore/foundation.py in map(self, f, *args, **kwargs)
376 else f.__getitem__)
--> 377 return self._new(map(g, self))
378
~/Projects/fastcore/fastcore/foundation.py in _new(self, items, *args, **kwargs)
326 def _xtra(self): return None
--> 327 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
328 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
~/Projects/fastcore/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
46
---> 47 res = super().__call__(*((x,) + args), **kwargs)
48 res._newchk = 0
~/Projects/fastcore/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
317 if (use_list is not None) or not _is_array(items):
--> 318 items = list(items) if use_list else _listify(items)
319 if match is not None:
~/Projects/fastcore/fastcore/foundation.py in _listify(o)
253 if isinstance(o, str) or _is_array(o): return [o]
--> 254 if is_iter(o): return list(o)
255 return [o]
~/Projects/fastcore/fastcore/foundation.py in __call__(self, *args, **kwargs)
219 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 220 return self.fn(*fargs, **kwargs)
221
~/Projects/fastai2/fastai2/learner.py in _call_one(self, event_name)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/learner.py in <listcomp>(.0)
136 assert hasattr(event, event_name)
--> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
~/Projects/fastai2/fastai2/callback/core.py in __call__(self, event_name)
23 (self.run_valid and not getattr(self, 'training', False)))
---> 24 if self.run and _run: getattr(self, event_name, noop)()
25 if event_name=='after_fit': self.run=True #Reset self.run to True at each end of fit
<ipython-input-17-9f319a09409f> in after_epoch(self)
67 if self.log_preds:
---> 68 inp,preds,targs,out = self.learn.fetch_preds.preds
69 b = tuplify(inp) + tuplify(targs)
~/Projects/fastcore/fastcore/foundation.py in __getattr__(self, k)
233 attr = getattr(self,self._default,None)
--> 234 if attr is not None: return getattr(attr,k)
235 raise AttributeError(k)
AttributeError: 'TabularLearner' object has no attribute 'preds'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment