Google Colab GPU not working

After setting up hardware acceleration on google colaboratory, the GPU isn’t being used.

This happened today and is the case for all my notebooks.

To reproduce, enable GPU acceleration and try to run the 11 first cells of the vision doc page:https://docs.fast.ai/tutorial.vision

It takes hours. And a message show up saying that we are connected to GPU runtime yet not using GPU.

Due to the most recent release of pytorch installing the proper torchwheels based on your CUDA version isn’t quite automated yet for colab. As a result I would recommend using the following to install fastai and pytorch:

!pip install light-the-torch >> /.tmp
!ltt install torch torchvision >> /.tmp
!pip install fastai --upgrade >> /.tmp

(Run that in a cell)

4 Likes

It worked, thanks @muellerzr !

BTW, you can use the following code to quickly check if GPU is available.

import torch 
assert torch.cuda.is_available(), "GPU not available"
2 Likes

Hi,
I am experiencing an issue with Google Collab.
I too tried to run 11 first cells of the vision doc page:https://docs.fast.ai/tutorial.vision.
Also I tried to run the 01_intro_clean.ipynb - same results
once learn.fine_tune(1) is called it is stuck.
The torch.cuda.is_available() returns True, i.e. GPU is available.
A couple of weeks ago I runed all notebooks of the first part of the course and it worked fine.
Please advise!
Tnx,
Maxim