Training your model is hands down the most time consuming and expensive part of machine learning. Training your model on a GPU can give you speed gains close to 40x, taking 2 days and turning it into a few hours. However, this normally comes at a cost to your wallet.
The other day I stumbled upon a great tool called Google Colab. I would describe Colab as the google docs equivalent of Jupyter notebooks. Colab is aimed at being an education and research tool for collaborating on machine learning projects. The great part is, that it’s completely free forever.
There is no setup to use it. I didn’t even need to log in. (I was already logged into my google account)
The best part is that you get an unlimited supply of 12 hours of continuous access to a k80 GPU, which is pretty powerful stuff. (You get disconnected after 12 hours, but you can use it as many times as you want)
I want our focus to be training on a GPU and Colab specific so the notebook is extremely bare bones.
The first step is to download the notebook (or another notebook of your choice)
Then, head over to Google Colab, sign into your google account (or create one if you somehow made it this far through life without one)
Upload the notebook you downloaded:
Change runtime type:
Now you should be able to run your notebooks how you normally would. The only difference is the very last part at the end. If you want to download your model or any other files via the browser, you can use their python library:
from google.colab import files
This was a pretty short post, but hopefully it ends the painful days of training your models on your poor little old laptop for days at a time or dropping a ton of 💰 on AWS bills.
If you found this article helpful, it would mean a lot if you gave it some applause👏 and shared to help others find it! And feel free to leave a comment below.