paint-brush
Train Your Machine Learning Models on Google’s GPUs for Free — Foreverby@bourdakos1
67,955 reads
67,955 reads

Train Your Machine Learning Models on Google’s GPUs for Free — Forever

by Nick BourdakosMarch 3rd, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Train Your Machine Learning Models on Google’s GPUs for Free — Forever
Nick Bourdakos HackerNoon profile picture

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)

Choose File > Upload notebook...:

Upload the notebook you downloaded:

Choose Runtime > Change runtime type:

Then choose GPU:

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 filesfiles.download("PATH/TO/FILE")

Final Thoughts

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.

Thanks for reading! If you have any questions, feel free to reach out at [email protected], connect with me on LinkedIn, or follow me on Medium and Twitter.

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.