Using Pytorch 1.6.0 and Fastai version 2.0.0 on Kaggle Notebook

I spent a few hours trying to figure out why the commands to setup fastai in a kaggle notebook were not working:

!pip install -Uqq fastbook
import fastbook
fastbook.setup_book()

First it complains about kornia and allennlp versions. I tried to upgrade them first and then run the setup but I realized the GPU was disabled as a consequence (torch.cuda.is_available() to check).

I finally found the solution and some explanation here:

I just wanted to share this with others who might struggle like me!

I didn’t dig why “Currently latest version of torch 1.6 disables using GPU on kaggle Notebook”. I’ve read and experienced the fact that pytorch might silently fallback to CPU (as explained in https://fastai1.fast.ai/troubleshoot.html)… not sure why or if there’s a beginner explanation.

5 Likes

Here is my notebook to make it work,
Fastai2 setup on kaggle

1 Like

Kudos, this is exactly what I was looking for

1 Like

PyTorch 1.6 and FastAI 2.0 are installed by default in Kaggle Notebooks as of 9/23/2020.

3 Likes

even better! thanks for sharing

1 Like