Sign-Up

Google Colab Overview

In this free 5-minute tutorial, you will get an overview of how to get started with Google Colab, a free service that lets you develop Python projects using your web browser.  You will get an overview of how to access Google Colab, develop your own code and change hardware acceleration settings.

Level:  Beginner

Time:  5 minutes

Equipment:  Google Account (free), Chrome Browser (free)

Start
 

Google Colab Overview (5 minutes)

In this quick 5-minute tutorial, you will get a quick introduction to Google Colab, an amazing free tool from Google that lets you code directly in your own web browser with no specialized hardware or software required.  Simply open a web browser and head over to colab.research.google.com to get started.  

Colab Overview

When you write code in your browser, the code actually runs inside of Google’s datascenter.  When the code completes executing, the results are sent back and displayed in your browser.  This way, you don’t need a powerful PC or laptop (or even any special software installed) to get started.   You can use Colab to develop your own A.I. projects for free.  Colab even offers some time for free on their hardware accelerated servers that will help you when you build more demanding A.I. projects.

How to Get Started

Open a web browser and head over to colab.research.google.com.   Then, hit the “Sign-In” button and login with your Google account.  Next, click “Connect” in the upper right-hand side.  Voila, you now have a running environment where you can execute code!

Start to Program

Click on a cell and type in:

print (“Hello World”)

Then click on the play icon to the left of the cell.  Notice that once the cell finishes executing, the result will be displayed below.

Step 2 – Import a Deep Learning Library and Check the Version

Next, try to create a new cell and then type:

import torch
torch.__version__

This will load the PyTorch (an open source deep learning A.I. library from MetaAI) and check the version number. 

Step 2 – Enable Hardware Acceleration for A.I. Development

Next try to type:

torch.cuda.is_available()

This function will return True or False depending on whether or not PyTorch detect hardware acceleration. 

To change the runtime to hardware acceleration, click on Runtime, then Change Runtime Type, then select GPU from the drop down and hit SAVE.  Once you have reconnected the notebook, execute all the cells again by clicking on Runtime, Run all.  You should now see that cuda is available.

Step 3 – Turn Off Hardware Acceleration

Make sure to turn hardware acceleration off again by clicking on Runtime, Change Runtiem Type and selecting None followed by SAVE.

Step 4 – Save and Load your Notebook

You can save the notebook by downloading it by clicking File, Download and clicking on the ipynb file.  To load a notebook, you can click File and Upload and select the notebook you wish to load from your local computer.

You are now ready to start developing your own A.I. programs using Colab!

Next Steps

As a next step, consider tackling our free tutorial “Building your First Neural Network (30 Minutes)”. If you want to learn more about developing your own A.I. projects, take the 4-week on-demand Introduction to A.I. programming course!

Happy Learning!

leaky.ai team

Join our A.I. Trends and Free Tutorials Email List

It’s Free, No Spam, Opt-Out Anytime