In the previous post we installed TensorFlow locally, in this post we will learn about Google Colaboratory that allows anybody to write and execute arbitrary python code through the browser.
In the previous section we installed TensorFlow locally, in this section we will learn about Google Colaboratory that allows anybody to write and execute arbitrary python code through the browser and Colab is free of charge to use.
What is Google Colaboratory
Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education. More technically, Colab is a hosted Jupyter notebook service that requires no setup to use, while providing access free of charge to computing resources including GPUs.
Difference between Jupyter and Colab
Jupyter is the open source project on which Colab is based. Colab allows you to use and share Jupyter notebooks with others without having to download, install, or run anything.
How to use Google Colaboratory
Follow below steps to get started with Google Colab.
1. Navigate to Google Colab and Sign in using google account.
2. In the File Menu click on New notebook. It should open an Untitled notebook in other tab.
3. In the File Menu click on Rename and provide name for your notebook i.e. tf_with_gcptutorials.
4. Write below code snippet in the code cell to import TensorFlow and to check it's version and click on Run cell.
import tensorflow as tf
Using Free GPU on Google Colaboratory
Colab offers optional accelerated compute environments, including GPU and TPU. Follow below steps to use GPU to run the above code snippet.
5. Navigate to Runtime Menu and click on Change runtime type.
6. In the Hardware accelerator select GPU and click on Save.
7. Navigate to Runtime Menu and click on Restart and run all to run the code on GPU.