Hi, I’m working an MNIST kaggle competition. I created the learner with
learner = cnn_learner(dls, resnet34, pretrained=False, loss_func=F.cross_entropy, metrics=accuracy)
and trained it twice using
learner.fit_one_cycle(1)
learner.fit_one_cycle(5)
and everything looked normal except it began to overfit at the end. But now when I call learner.export()
it fails with
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-172-1fb6be3579a2> in <module>()
----> 1 learner.export()
3 frames
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __getattr__(self, k)
133 if self._component_attr_filter(k):
134 attr = getattr(self,self._default,None)
--> 135 if attr is not None: return getattr(attr,k)
136 raise AttributeError(k)
137 def __dir__(self): return custom_dir(self,self._dir())
AttributeError: 'list' object has no attribute 'new_empty'
I have no clue what is happening or where this list
object is coming from.
Then also (maybe related) I can’t predict anything as well. If I try learner.predict(test_ds[0])
, it just fails
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/fastai/learner.py in _with_events(self, f, event_type, ex, final)
153 def _with_events(self, f, event_type, ex, final=noop):
--> 154 try: self(f'before_{event_type}') ;f()
155 except ex: self(f'after_cancel_{event_type}')
27 frames
RuntimeError: Expected 4-dimensional input for 4-dimensional weight [64, 3, 7, 7], but got 3-dimensional input of size [3, 28, 28] instead
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
TypeError: expected Tensor as element 0 in argument 0, but got NoneType
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/fastcore/basics.py in range_of(a, b, step)
428 "All indices of collection `a`, if `a` is a collection, otherwise `range`"
429 if is_coll(a): a = len(a)
--> 430 return list(range(a,b,step) if step is not None else range(a,b) if b is not None else range(a))
431
432 # Cell
TypeError: 'NoneType' object cannot be interpreted as an integer