0% found this document useful (0 votes)
19 views

How To Use Google Colab

Uploaded by

b001230002gideon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

How To Use Google Colab

Uploaded by

b001230002gideon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

How to use Google Colab

Google Colab

• Google provides a free & fast way to work on


notebook.
– We can use GPU as a backend for free for 12 hours at a
time.
– The GPU used in the backend is K80.
– The 12-hour limit is for a continuous assignment of VM. It
means we can use GPU compute even after the end of 12
hours by connecting to a different VM.
Step 1: Setting up drive
• Create a folder for your notebooks
Step 2: Create New Google Colab notebook
• Once we have created folder in Google Drive we can
create a new Colab notebook.
• Just click “New” and drop the menu down to “More”
and then select “Colaboratory.”
Step 3: Rename notebook
• You can rename your notebook by clicking on the
name of the notebook and changing it or by
dropping the “File” menu down to “Rename.”

Here we have name the Colab file "demo.ipynb". By double clicking


on Untitiled1.ibynb. Now Assign a new name to Colab file
"demo.ipynb".
Step 4: Set up free GPU
• It’s as simple as going to the “runtime” dropdown
menu, selecting “change runtime type” and selecting
GPU in the hardware accelerator drop-down menu.
After clicking Notebook settings option next windows will appear, now select
GPU from drop down menu.

To cross check if notebook is running on GPU backend


we can run this command:
tf.test.gpu_device_name()
output: /device:GPU:0'
Step 5: Importing libraries
• Imports are pretty standard, with a few exceptions.
For the most part, you can import your libraries by
running import like you do in any other notebook.

run this command to install PyTorch in notebook. (Although its now supported
by Colab notebook)
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.1-
{platform}-linux_x86_64.whl
import torch
Step 6: Saving notebook
• Saving our work is simple as we can ctrl+s or drop
the “File” menu down to save.
• We can create a copy of your notebook by dropping
“File” -> “Save a Copy in Drive.”
• We can also download notebook by going from “File”
-> “download .ipyb” or “download .py.”
Saving notebook

You might also like