Comments (3)
Is this fixed by the no_grad Jeremy added?
from fastai_dev.
It fixes part of the issue - get_preds is no longer memory hungry :)
Unfortunately the error remains:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-19-4975c3720d00> in <module>
----> 1 preds = learn.get_preds(dl=tst_dl)
~/work/fastai_dev/dev/local/learner.py in get_preds(self, ds_idx, dl, with_input, with_loss, decoded, act)
266 with self.no_logging(), self.added_cbs(cb), self.loss_not_reduced():
267 self(_before_epoch)
--> 268 self._do_epoch_validate(ds_idx, dl)
269 self(_after_epoch)
270 if act is None: act = getattr(self.loss_func, 'activation', noop)
~/work/fastai_dev/dev/local/learner.py in _do_epoch_validate(self, ds_idx, dl)
232 with torch.no_grad(): self.all_batches()
233 except CancelValidException: self('after_cancel_validate')
--> 234 finally: self('after_validate')
235
236 def fit(self, n_epoch, lr=None, wd=defaults.wd, cbs=None, reset_opt=False):
~/work/fastai_dev/dev/local/learner.py in __call__(self, event_name)
181 self.remove_cbs(cbs)
182
--> 183 def __call__(self, event_name): L(event_name).map(self._call_one)
184 def _call_one(self, event_name):
185 assert hasattr(event, event_name)
~/work/fastai_dev/dev/local/core.py in map(self, f, *args, **kwargs)
333 else f.format if isinstance(f,str)
334 else f.__getitem__)
--> 335 return self._new(map(g, self))
336
337 def unique(self): return L(dict.fromkeys(self).keys())
~/work/fastai_dev/dev/local/core.py in _new(self, items, *args, **kwargs)
287 super().__init__(items)
288
--> 289 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
290 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
291
~/work/fastai_dev/dev/local/core.py in __call__(cls, x, *args, **kwargs)
48 return x
49
---> 50 res = super().__call__(*((x,) + args), **kwargs)
51 res._newchk = 0
52 return res
~/work/fastai_dev/dev/local/core.py in __init__(self, items, use_list, match, *rest)
281 if items is None: items = []
282 if (use_list is not None) or not _is_array(items):
--> 283 items = list(items) if use_list else _listify(items)
284 if match is not None:
285 if len(items)==1: items = items*len(match)
~/work/fastai_dev/dev/local/core.py in _listify(o)
225 if isinstance(o, list): return o
226 if isinstance(o, str) or _is_array(o): return [o]
--> 227 if is_iter(o): return list(o)
228 return [o]
229
~/work/fastai_dev/dev/local/core.py in __call__(self, *args, **kwargs)
197 if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
198 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 199 return self.fn(*fargs, **kwargs)
200
201 #Cell
~/work/fastai_dev/dev/local/learner.py in _call_one(self, event_name)
184 def _call_one(self, event_name):
185 assert hasattr(event, event_name)
--> 186 [cb(event_name) for cb in sort_by_run(self.cbs)]
187
188 def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)
~/work/fastai_dev/dev/local/learner.py in <listcomp>(.0)
184 def _call_one(self, event_name):
185 assert hasattr(event, event_name)
--> 186 [cb(event_name) for cb in sort_by_run(self.cbs)]
187
188 def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)
~/work/fastai_dev/dev/local/learner.py in __call__(self, event_name)
26 def __call__(self, event_name):
27 "Call `self.{event_name}` if it's defined"
---> 28 getattr(self, event_name, noop)()
29
30 @property
~/work/fastai_dev/dev/local/learner.py in after_validate(self)
450 def begin_validate(self): self._valid_mets.map(Self.reset())
451 def after_train (self): self.log += self._train_mets.map(_maybe_item)
--> 452 def after_validate(self): self.log += self._valid_mets.map(_maybe_item)
453 def after_cancel_train(self): self.cancel_train = True
454 def after_cancel_validate(self): self.cancel_valid = True
~/work/fastai_dev/dev/local/core.py in map(self, f, *args, **kwargs)
333 else f.format if isinstance(f,str)
334 else f.__getitem__)
--> 335 return self._new(map(g, self))
336
337 def unique(self): return L(dict.fromkeys(self).keys())
~/work/fastai_dev/dev/local/core.py in _new(self, items, *args, **kwargs)
287 super().__init__(items)
288
--> 289 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
290 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
291
~/work/fastai_dev/dev/local/core.py in __call__(cls, x, *args, **kwargs)
48 return x
49
---> 50 res = super().__call__(*((x,) + args), **kwargs)
51 res._newchk = 0
52 return res
~/work/fastai_dev/dev/local/core.py in __init__(self, items, use_list, match, *rest)
281 if items is None: items = []
282 if (use_list is not None) or not _is_array(items):
--> 283 items = list(items) if use_list else _listify(items)
284 if match is not None:
285 if len(items)==1: items = items*len(match)
~/work/fastai_dev/dev/local/core.py in _listify(o)
225 if isinstance(o, list): return o
226 if isinstance(o, str) or _is_array(o): return [o]
--> 227 if is_iter(o): return list(o)
228 return [o]
229
~/work/fastai_dev/dev/local/core.py in __call__(self, *args, **kwargs)
197 if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
198 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 199 return self.fn(*fargs, **kwargs)
200
201 #Cell
~/work/fastai_dev/dev/local/learner.py in _maybe_item(t)
409
410 def _maybe_item(t):
--> 411 t = t.value
412 return t.item() if isinstance(t, Tensor) and t.numel()==1 else t
413
~/work/fastai_dev/dev/local/metrics.py in value(self)
40 @property
41 def value(self):
---> 42 preds,targs = torch.cat(self.preds),torch.cat(self.targs)
43 if self.to_np: preds,targs = preds.numpy(),targs.numpy()
44 return self.func(targs, preds, **self.kwargs) if self.invert_args else self.func(preds, targs, **self.kwargs)
RuntimeError: expected a non-empty list of Tensors
from fastai_dev.
Should be fixed now.
from fastai_dev.
Related Issues (20)
- Found a bug in dev/local/vision/augment.py HOT 1
- Is there a way to select different loss functions for different targets? HOT 2
- Fastai2 Lesson One Import Problem HOT 5
- Possible regression when declaring a SequentialRNN
- Passing Pipeline to item_tfms causes 'TypeError: '<' not supported between instances of 'L' and 'int'' HOT 2
- Colab Specific: RuntimeError: inverse_cuda: For batch 0: U(17437184,17437184) is zero, singular U. HOT 3
- skip_start argument of the plot_loss Recorder method only affects train loss HOT 2
- skimage missing in README HOT 2
- Target is not converted to 'Long' error HOT 7
- Error on pip install git+https://github.com/fastai/fastai_dev on Kaggle HOT 2
- 'pip install git+https://github.com/fastai/fastai_dev' doen't work HOT 1
- Can't import fastai2 on 11/23/2019 HOT 1
- 'from fastai2.torch_basics import * ' problem(ModuleNotFoundError) on the Kaggle platform HOT 3
- ImageDataBunch is not found HOT 3
- DataSource error message
- Remove references to `Dataset`
- Keep-Alive-Actions
- Keep-Alive-Actions
- Keep-Alive-Actions
- get_class_mAP function not working if databunch is created from labellist on MIDOG 2021 dataset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastai_dev.