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

Getting Started With Google Colab - Deep Learning - Great Learning

Uploaded by

Ajanta Bearing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Getting Started With Google Colab - Deep Learning - Great Learning

Uploaded by

Ajanta Bearing
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Go Back to Deep Learning

Course Content

Getting Started with Google Colab

Why do we use Google Colab for Deep Learning?

1. Google Colab notebooks allow you to write and execute Python in your browser, with zero configuration
required, and are highly integrated with Google Drive, making them easy to set up access, and share. The
Google Setup process is relatively easy and can be completed by signing in with the Gmail account and
having a Google account is enough to get started with Google Colab.
2. While installing deep learning and/or recommendation systems libraries you may face some installation
errors due to their dependency requirements. In Google Colab, there are many pre-installed libraries we
can use and it is much easier to install new libraries as well.
3. Google Colab provides free Graphical Processing Unit (GPU) and Tensor Processing Unit (TPU) support
which enhances the graphical performance and faster computation for neural networks. This makes it
perfect for deep learning and data analytics enthusiasts because of computational limitations on local
machines.
4. Colab notebook can be accessed remotely from any machine through a browse and when it comes to data
security, Colab is considered to be more portable and easy to set up, hence it's well suited for commercial
purposes as well.
5. Colab also makes it easier to collaborate with the team. The collaboration feature allows developers to use
and share Jupyter notebooks with each other without having to download, install, or run anything other
than a browser.

The working of Google Colab is similar to the Jupyter but since Colab runs on the browser, there is one major
difference in the ways the dataset is loaded in Google Colab. Let's see how to load datasets in Google Colab.
We will focus on reading datasets into Google Colab in 2 ways.

Step 1: Click on the following link - Welcome to Colaboratory.

https://colab.research.google.com/notebooks/intro.ipynb?utm_source=scs-index
Step 2: To create a new notebook, click on the File menu on the top left and select New notebook.

Step 3: A new notebook will be opened. The name of this new notebook is Untitled2.ipynb. You can rename it
by just clicking on the notebook name and changing it according to your need. We have changed the name
below to Project1.ipynb.
We can read a dataset on Google Colab in one of two ways:

1. From your local device


2. From Google drive

Let’s see how to upload this data from a local device into Google Colab:

The first three steps are common to the steps discussed above to create a new notebook.

After that, paste the following lines of code into Google Colab and hit SHIFT+ENTER.

from google.colab import files


uploaded = files.upload()
Click on Choose file, select the file you want to upload from your local device, and click on open. Check the
image below.

It will look like the below image:


After that, just read in the dataset using the pandas read_csv() function, as shown below:

This is how to upload a dataset directly from your local device to Google Colab.

Now, let’s see how to upload the dataset from Google drive into Google Colab:

For this, you first have to save the dataset on your Google Drive.

Choose any dataset you want to upload and make a folder in your google drive and name it DSML (or any other
name you want). The dataset has to be located inside this folder.

After doing this, go to the notebook and run the following lines of code:

from google.colab import drive


drive.mount('/content/drive')
Click on "Connect to Google Drive", select your Google account, and click on "allow" to give the required
permissions. Once the process is done, you will get an output saying Mounted at /content/drive

After that, go to the small folder icon on the left, Go to Drive->MyDrive->DSML (or whichever folder name
you've given), right-click on the file, and select the Copy path as shown below:

Copy-paste the following code (with the path of the file) inside a code block in Google Colab:

import pandas as pd
data=pd.read_csv('/content/drive/MyDrive/DSML/Admission_Predict.csv')
Press SHIFT+ENTER and your data will be loaded from Google drive to Google Colab.

These were the steps required to load a dataset into the notebook from Google drive.

Previous Next

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

© 2022 All rights reserved Privacy Terms of service Help

You might also like