Hi, I had run the lesson 1 notebook earlier on Google Colab without any issue. However yesterday when I tried to re-run it, facing below error.
AxisError: axis 1 is out of bounds for array of dimension 1
The notebook is same as what @manikanta_s put up in this post here
Step: Fine-tuning and differential learning rate annealing
Code:
log_preds,y = learn.TTA()
probs = np.mean(np.exp(log_preds),0)
accuracy(probs, y) <<<<< Error in this line
Error:
---------------------------------------------------------------------------
AxisError Traceback (most recent call last)
in ()
----> 1 accuracy(probs, y)
/usr/local/lib/python3.6/dist-packages/fastai/metrics.py in accuracy(preds, targs)
3
4 def accuracy(preds, targs):
----> 5 preds = np.argmax(preds, axis=1)
6 return (preds==targs).mean()
7
/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py in argmax(a, axis, out)
1002
1003 """
-> 1004 return _wrapfunc(a, 'argmax', axis=axis, out=out)
1005
1006
/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
50 def _wrapfunc(obj, method, *args, **kwds):
51 try:
---> 52 return getattr(obj, method)(*args, **kwds)
53
54 # An AttributeError occurs if the object does not have
AxisError: axis 1 is out of bounds for array of dimension 1
Any idea why I am getting this error now?
-Thanks
Nikhil