AISaturdayLagos: Leveraging on Google Colab

Tejumade Afonja
AI Saturdays
Published in
4 min readJan 30, 2018

We held AI Saturdays Lagos Week 4 on 27th Jan, 2018 from 10am — 6pm. We went through Fast.ai lesson 3, the lecture went in-depth to explaining concepts like data augmentation, batch normalization, dropout etc. After this session, we took an hour break which was used for lunch plus class interaction. After lunch, we saw Lecture 3 of CNN, which talked about back propagation, how gradient is calculated and an introduction to neural network. We later held a deep learning theory session coupled with more class discussions.

Last week, we divided everyone into 5 groups, 10 people per group. This week, each group’s representative picked one of these five frameworks to work with for the next 12 weeks.

1. Tensorflow
2. Keras
3. Neon
4. Theano
5. pyTouch

Owoeye Gabriel put an amazing pieces together on how to leverage on Google’s free cloud computing research lab (Colab)

Learning “Deep Learning” is hard, and Nurture.AI’s AI Saturdays initiative is out to make it easier. However, one big barrier for newbies which we’ve discovered over the weeks is the need for a Graphic Processing Unit to use for the course.

If you don’t have a PC with a good GPU then you need to rent one of the available Cloud Compute services, e.g. AWS or Google Cloud, using a tutorial like this.

However, this process of setting up your cloud environment could be a tedious process for any newbie to wrap his/her head around because this process takes time and effort, and also requires a debit/credit card.

Some of the participants do not have a valid credit card and thus are unable to claim the free $300 credit Google has given out and for those who were able to set up successfully, they sometimes run at risk of forgetting to shut down their machine which usually is as a result of fluctuating Internet connection.

Source

Google for the Rescue — Again!

Google has graciously opened up their research tool Google Colab for this purpose, and they now provide free virtual machines for you to use: with about 12GB RAM and 50GB hard drive space, and TensorFlow is pre-installed! — Yay!

This means you don’t need to go through the stress of setting up a Cloud VM to get started with deep learning. Google Colab tool is a Jupyter notebook-based system integrated with Google Drive.

Note that when you connect to a GPU-based VM runtime, you are given a maximum of 12 hours at a time on the VM. Although you will be able to connect to another VM after the 12 hours, you lose access to the previous VM instance — meaning that you lose all data setups you have on it that you haven’t saved to Google Drive. Therefore, you can’t run a 24-hour training script with Colab unless you decide to take the occasional snapshots and save it to Drive manually. However, I don’t think this is a beginners problem.

So, What’s the Catch?

If you opt for Cloud computing, when you are using Google Colab (or any Cloud computing tbh) you get to save yourself data costs, compared to if you have to download datasets and install deep learning libraries on your personal PC. There are datasets that are up to 10GB and more out there. Using Google Colab’s VM you can download them faster and work with them directly on the VM without having to worry about the speed and costs of data/internet connection and the hard drive space they’d consume on your local PC or the cloud VM but the real catch here is — it’s really Free!

The downside is that when using Google Colab instead of Google Cloud machines, when the 12-hour time lapses, you lose all the data including the datasets you’ve downloaded. Hence, you’d have to download them afresh on the new VM if you still need them.

To get started, I have created this Colab file to set up fastai on your new GPU-based VM, following this post. When you are just getting started or connecting to a new VM, all you need is to run the file on the VM (before doing other stuff that may require the fastai library) — Cool yeah?

The Colab file also provides basic information on the current VM at the end of the script.

For me, I have a 12GB RAM system, 49GB hard drive space and I am the root user.

After running the script successfully you can go ahead to import your Jupyter notebooks into the VM and start working with them.

Happy Hacking!

AISaturdayLagos wouldn’t have happened without my fellow ambassador Azeez Oluwafemi, our Partners FB Dev Circle Lagos, Vesper.ng and Intel.

A big Thanks to Nurture.AI for this amazing opportunity.

Also read how AI Saturdays is Bringing the World Together with AI

See you next week 😎.

View our pictures here and follow us on twitter :)

--

--