In this tutorial, we will learn how to take advantage of free GPUs and TPUs to accelerate your Machine Learning projects
The GitHub links for this tutorial
- To efficiently train a machine learning model on massive amounts of data, data scientists or machine learning engineers often need to use specialized hardware, such as:
- Graphics Processing Units - GPUs
- Tensor Processing Units - TPUs
- With these specialized hardwares, the training task that used to take weeks or months to complete now only take minutes. The problem is these hardwares are very expensive, so it requires a huge upfront cost to get started.
- The good news is now you can take advantage of free GPUs and TPUs to develop your machine learning or deep learning models using Google Colaboratory.
Getting started on Google Colab
- Google Colaboratory is a research tool for machine learning education and research. It’s a Jupyter notebook environment that requires no setup to use.
- It runs on your browser and lets you write, run and share code within Google Drive
- Tips on using Google Colab - medium
Tips on using Google Colab
- TensorFlow is already pre-installed
import tensorflow as tf, and start coding
- Setup your libraries and data dependencies in code cells
!apt-getto install extra dependencies. For example:
- Integrate with Github
- Easy to create a link from Github notebook to Google Colab
- Using Google Colab with GitHub
- Colab can load public github notebooks directly, with no required authorization step.
- For example, consider the notebook at this address: https://github.com/tuanavu/deep-learning-tutorial/blob/master/colab-example-notebooks/colab_github_demo.ipynb.
- The direct colab link to this notebook is: https://colab.research.google.com/github/tuanavu/deep-learning-tutorials/blob/master/colab-example-notebooks/colab_github_demo.ipynb.
- Share and edit collaboratively
- All Colaboratory notebooks are stored in Google Drive.
- Colaboratory notebooks can be shared just as you would with Google Docs or Sheets.
- Hardware acceleration
- By default, Colab notebooks run on CPU.
- Switch to use GPU or TPU, by going to
Runtime > Change runtime type > Hardware Accelerator > GPU
- Google offers a Tesla K80 GPU for the GPU option.
- Extra tips
- Insert code snippets in Colab
- Upload your train/test data to Colab
- Explore Seedbank project: Collection of Interactive Machine Learning Examples
Ideas on using Google Colab
If you are just getting started on the machine learning journey, here are a few ideas on how you should use it:
- Create a machine learning porfolio on Github, and share it with your future employers.
- Create learning notes for future reference. Example: data-science-ipython-notebooks
- Use Google Colab for reproducible research if you have interesting experiments.
- Share your codes, and work collaboratively with friends and colleages.
- Use Colab for Kaggle competitions.
- Colab: An easy way to learn and use TensorFlow - medium
- Get started with Google Colaboratory - youtube
- How to take advantage of GPUs and TPUs for your ML project - youtube
- Using Google Colab with GitHub - colab notebooks
- Getting started with PyTorch on Google Colab - medium