If you are a Python user, you must be familiar with Jupyter Notebook. The good news is Google has a cloud based service called CoLab. It is just like running Jupyter Notebook on Google Drive. No need to apply for additional accounts, and no need to apply for the service. All you need is a Google Drive account, and that’s it. Easy & Simple! The best thing is that it gives users free TPU access to run your task! Therefore, if your local machine does not have enough GPU power, for example, my T470P laptop has only 2G VRAM (graphic card memory) and couldn’t run a training task that needs approximately 4G memory, then Google CoLab can be one solution.

In this blog, I will introduce:

  • How to create a CoLab in Google Drive
  • How to install library in CoLab
  • How to import modules in CoLab

1. Create a Colab document

As the below image shows, use the normal way you created a Google doc to add a **coLab **document. If you are using it for the first time, you would have to add the service in the Connect more apps section and search Colaboratory in the pop-up App searching box.

Image for post


2. Edit and run a Colab document

Image for post

This is how it looks in a Colab document. It is almost identical to JupyterNoteBook. It has CODE and TEXT to allow you add a new cell to write your code or text, and when you hit SHIFT+ENTER, it will execute the cell. The TEXT cell also support Markdown syntax.


3. How to Install Python Library in Colab

Colab has command line support, so simply add ! exclamation mark to run Linux commands in the cell. You can simply run !pip install <package-name>to perform pip install. So when you go to Pytorch official installation website, and choose the specifications of the pytorch version you want to download, make sure you choose Linux, Pip, and Python, and then the CUDA version you want to install, and you would see a pip command line shown at the bottom:

Image for post

Then copy paste that command to CoLab cell with a prefix !

#colab #jupyter-notebook #deep-learning #deep learning

How to setup a Deep Learning Environment on CoLab
1.65 GEEK