Hi all,
I am working through the course with the folks over at https://twimlai.com/twiml-x-fast-ai/
I am using Kai Lichtenberg’s setup and it seems to work well most of the time however I have received a couple of odd errors when replicating Jeremy’s code as follows:
From the Lecture 2 section on building your own image classifier:
accuracy(log_preds, y)
TypeError Traceback (most recent call last)
in ()
----> 1 accuracy(log_preds, y)
2 # p = np.max(preds)
3 # (preds==y).mean()/fastai/courses/dl1/fastai/metrics.py in accuracy(preds, targs)
7
8 def accuracy(preds, targs):
----> 9 preds = torch.max(preds, dim=1)[1]
10 return (preds==targs).float().mean()
11TypeError: torch.max received an invalid combination of arguments - got (numpy.ndarray, dim=int), but expected one of:
- (torch.FloatTensor source)
- (torch.FloatTensor source, torch.FloatTensor other)
didn’t match because some of the keywords were incorrect: dim- (torch.FloatTensor source, int dim)
- (torch.FloatTensor source, int dim, bool keepdim)
and in Lecture 2’s section on dog breeds:
list(zip(*size_d.values()))
TypeError Traceback (most recent call last)
in ()
----> 1 row_sz, col_sz = list(zip(*size_d.values()))TypeError: zip argument #1 must support iteration
Since it worked for Jeremy something must be different or has changed. Any suggestions?