In this post, we are going to understand how to set up Google Colab for deep learning. Google provides us with free service in the form of Colab. Colab permits us to run a python notebook without installing python. Colab offers a number of features in which the most important features are given below.

Features:

  • For basic notebooks, no need to the configuration is required
  • You can access GPU for Free and easily
  • Easily sharing of codes and link the notebooks to GitHub
  • You can upload datasets directly from Google drive and you can send the same notebooks or trained models into your drive.
  • Pro feature also mentioned in Google Colab. If you want to learn more about pro features then click here

Installation Dependencies:

Although Colab is installed with installing decencies such as Tensorflow, PyTorch, sci-kit-learn, pandas, and many more. In order to increase the chances for install external packages, you have to show the command below.

pip install

For example, we can install ttach library for the augmentation of images during the test phase by using this command.

pip install library-name

This will give us the following output

Mounting Google Drive

Now you can mount your Google Drive using the simple script given below:

First, go Google Colab then type the following script

from google.colab import drive

drive.mount('/content/drive') 

This link will redirects you to choosing those accounts whose Google drive mount. Choose the account and accept the permission request and copy the code that appears on the screen and paste that in the dialog box and press enter.

Now Your Google Drive is mounted and you can access it via the files menu on your left. The output would look something like this:

Cloning GitHub Repositories:

For working on complex projects a GitHub repository is cloned to your Goggle Colab. Multiple scripts are used in complex projects

By using this command we can be done it.

git clone link-to-repository

Running the cell would clone the repository to your working directory.

If you have to plug this in your Google drive then you can also clone this. This can be done by using this command

git clone link-to-repository path-to-drive

The output is in the form of just like this

Accessing GPU runtime:

With a free GPU runtime is given in the Colab you can access GPU runtime by following steps.

  1. Go to Runtime
  2. Select Change runtime type
  3. Select GPU from the drop-down menu and click on save

In this way, you can access your GPU runtime on Colab. In order to check which GPU is provided, you can use the following

The consuming GPU memory is shown through this output.

Conclusion:

Now we conclude our discussion by saying that Colab setting up is necessary for machine learning and deep learning.

You can easily clone GitHub Storages in Google drive and implement them by using GPU runtime. In order to do this, you don’t have to need the installation of Python in your local Machine.

 

Posted 
Dec. 29, 2021
 in 
Machine Learning
 category

More from 

Machine Learning

 category

View All

No posts found in this category!