Local Ubuntu/GPU module incompatibility issue

(David Clement) #1

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)
8 def accuracy(preds, targs):
----> 9 preds = torch.max(preds, dim=1)[1]
10 return (preds==targs).float().mean()

TypeError: 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:


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?


did you had problems with lesson1.ipynb?

(David Clement) #3

Yes. Everything worked well. My results were not quite as good as Jeremy’s but were well within a percentage point. No errors.

(David Clement) #4

Resolved. Typo on my part. Thanks