Tag Archives: google colab

Free GPU for fast.ai on Google Colab

In this tutorial, I will guide you to use google colab for fast.ai lessons.

Google colab is a tool which provides free GPU machine continuously for 12 hours. Even you can reconnect to a different GPU machine after 12 hours.

Here are the simple steps for running fast.ai Notebooks on google colab.

  1. Download fast.ai lesson notebooks. from https://github.com/fastai/fastai/tree/master/courses/dl1
  2. Login to your Google(Gmail) account in a browser.
  3. Go to colaboratory at URL https://research.google.com/colaboratory/unregistered.html
  4. A pop-up window will appear, close that window.
  5. Upload a new Notebook from your downloaded notebook files on colab (go to File ->Upload Notebook ) whichever lesson you want to work on.
  6. Now change your runtime machine to GPU machine and choose the type of python (Python 2 or Python 3) you are going to use by clicking on (runtime -> change runtime type).
  7. You can check if GPU running or not by writing the following code:

    it should come up with output ‘/device:GPU:0′ 

Now install the following libraries in your notebook by inserting code cells( Insert -> code cell ):

  1. Install pytorch using
  2. Install fast.ai using
  3. Install libSM using

Download dataset using bash commands as an example of dogs vs cats dataset

Now you are ready to use fast.ai on google colab.

Enjoy!!!