Jeremy Howard's Fastai class + nn.functional.sigmoid vs torch.sigmoid


I’m having issues that started occurring overnight (8/21/2018) with fastai’s modules built on top of PyTorch. Long story short, their learner started through this error about deprecation of nn.functional.sigmoid in every iteration in an epoch (which is very annoying):

I tried looking through as well as the fastai libraries to find out where I can substitute torch.sigmoid instead, but I could not find it. How can I easily replace nn.functional.sigmoid with torch.sigmoid?

If you go to Github of Fast.AI and search, you will find it in lots of places - Try this -

Its because Fast.AI Library currently is not (yet) updated to PyTorch 0.4. They plan to do that with the next version of the course starting in middle of Oct so that the existing notebooks work and are aligned with their MOOC videos. If you downgrade your PyTorch to 0.3.1, it should not give you these warnings.

Also, I see that you are not using an Virtual Env or Conda Env. I would recommend that you create a FastAI Environment using steps in Readme at and have a Separate Env for PyTorch 0.4 experiments.

1 Like


Thanks for the quick response. I’m still pretty new at python, much less github, so my ability to self-help is still in a growing phase -_-. I’ll look into the link you provided and if that doesn’t work I’ll downgrade pytorch.

RE: the environment, I think I did do that – but I never did use it as the kernel because I never noticed Jeremy doing so in his lectures. Is the below what you mean by that?

Hi Ben - You are doing great. Jermey doesn’t do that in his videos because he might be first activates the environment (I believe) and then runs the Jupyter Notebook or he doesn’t have any other environment configured. When this course was built PyTorch 0.3 was the latest version.

Yeah, Change the Kernel to “FastAI custom” as you see it and it should hopefully resolve the issue.

Also, take a look at, it has tons of resources and folks ready to help with any questions on Fast.AI course notebooks.

Oh I’ve been all over the forums, I came here because I couldn’t find this particular issue (I think because I’m running through the course way after it happened). Also this seemed more Torch-specific.

I’ve asked a few questions over there, but no replies yet! it’s all good, I think the lesson wiki discussion pages are probably most active when the course is in session anyway.

Closing up this thread by saying that while the FastAI custom environment did not solve the issue, downgrading to PyTorch 0.3.1 did do the trick.

I had to do so via this version from peterjc123 because the typical conda install command didn’t work (anaconda didn’t have the 0.3.x packages anymore)

The command I used was:

conda install -c peterjc123 pytorch cuda80