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.
- Download fast.ai lesson notebooks. from https://github.com/fastai/fastai/tree/master/courses/dl1
- Login to your Google(Gmail) account in a browser.
- Go to colaboratory at URL https://research.google.com/colaboratory/unregistered.html
- A pop-up window will appear, close that window.
- Upload a new Notebook from your downloaded notebook files on colab (go to File ->Upload Notebook ) whichever lesson you want to work on.
- 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).
- You can check if GPU running or not by writing the following code:
12import tensorflow as tftf.test.gpu_device_name()
it should come up with output ‘/device:GPU:0′
Now install the following libraries in your notebook by inserting code cells( Insert -> code cell ):
- Install pytorch using
1!pip install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl && pip install torchvision - Install fast.ai using
1!pip install fastai - Install libSM using
1!apt update && apt install -y libsm6 libxext6
Download dataset using bash commands as an example of dogs vs cats dataset
1 |
!mkdir data && wget http://files.fast.ai/data/dogscats.zip && unzip dogscats.zip -d data/ |
Now you are ready to use fast.ai on google colab.
Enjoy!!!