Problem with ' Learn.fit() '

Hi Everyone!

I am running Lesson 1, and everything works fine until I reach the line learn.fit(0.01,3) from the Dogs vs Cats example.

The error says: TypeError: <= not supported between instances of 'float' and 'object' (screenshot below)

I tried tracing this back and it seems like the variable lr is supposed to be a float, but has been converted in the middle of this function call learn.fit. Is is a problem with the libraries or am I missing some files?

My Mac is running on Mac OS X Sierra 10.12.6, CUDA 8, cuDNN 6, and was implemented with a GTX 1070 locally. I used pip install fastai and did not use Anaconda since I had setup my pyTorch successfully already.

I have the same problem.

edit: Linux, Python 3.6.3, pytorch 0.4.0a0+60a16e5. Just installed and never run the code without this error.

(Just to clarify for everyone out there)

When did you last time you encountered this problem?
What system are you using (OS X, Linux, Windows…)?

(I have a feeling this issue only happened recently)

Same here on Ubuntu 17.10, Python 3.6.4, pytorch 0.4.0a0+bc1b4c8.
Python installed via anaconda, pytorch from source, to compile against my older gpu. However, for memory reasons I had to run the code on the cpu

I’m on a Windows laptop, but I’m also having this problem. I made some changes to deal with out-of-memory issues, so I thought it had something to do with that, but apparently others that haven’t made any changes are also having issues. I suppose I should also mention that I just downloaded everything this weekend.

It looks like there were some very recent changes to optim/sgd.py in the pytorch library that might be causing this.

Yep, I think there were some recent changes to the optim/sgd.py library that maybe the current fastai library did not update to. It is possible @jeremy can help us look into this issue (thank you in advance)? I think it just happened recently~

Edit: It seems like people having this problem were all on pytorch 0.4.0a0

We don’t support pytorch 0.4, since it’s not out yet. Please use 0.3.1 . (I’ve just updated environment.yml to add this constraint).

1 Like

Thank you @jeremy! It’s working now!

I thought I’d add that the reason I am using the newer pytorch is that I had to build from source, as the standard package version won’t work on old-ish GPUs.

I was able to get this to work by just going into optim/sgd.py and removing the if-statement that was choking it up.