Professional Documents
Culture Documents
Seminar report
On
Google Colab
Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write
and execute arbitrary python code through the browser, and is especially well suited to machine
learning, data analysis and education. More technically, Colab is a hosted Jupyter notebook service that
requires no setup to use, while providing access free of charge to computing resources including GPUs.
You will quickly learn and use Google Colab if you know and have used Jupyter notebook before. Colab is
basically a free Jupyter notebook environment running wholly in the cloud. Most importantly, Colab
does not require a setup, plus the notebooks that you will create can be simultaneously edited by your
team members – in a similar manner you edit documents in Google Docs. The greatest advantage is that
Colab supports most popular machine learning libraries which can be easily loaded in your notebook.
What Colab Offers You?
As a developer, you can perform the following using Google Colab;
Create/Upload/Share notebooks
To use Colaboratory, you must have a Google account and then access Colaboratory using your account.
Otherwise, most of the Colaboratory features won’t work.
As with Jupyter Notebook, you can use Colaboratory to perform specific tasks in a cell-oriented
paradigm. If you’ve used Jupyter Notebook before, you notice a strong resemblance between Notebook
and Colaboratory. Of course, you also want to perform other sorts of tasks, such as creating various
cell types and using them to create notebooks that look like those you create with Notebook.
Getting Google Colab Ready to Use
Creating Folder on Google Drive
Since Colab is working on your own Google Drive, you first need to specify the folder you’ll work in. Give
the folder a name on your Google Drive. You can use a name or choose the default Colab Notebooks
folder instead of the named folder.
Why Should You Use Google Colab?
Some reasons why you want to opt to use Colab over plain Jupyter Notebook include;
Pre-installed Libraries
Collaboration
Pre-Installed Libraries
Anaconda distribution of Jupyter Notebook is shipped with several pre-installed data libraries, such as
NumPy, Pandas, Matplotlib. Colab, on the other hand, provides more pre-installed machine learning
libraries including Keras, PyTorch, TensorFlow.
When you opt to use a plain Jupyter notebook as your development environment, everything is saved in
your local machine. If you are cautious about privacy, this may be a preferred feature for you. However,
if you want your notebooks to be accessible to you from any device with a simple Google log-in, then
Google Colab is the way to go. All of your Google Colab notebooks are saved under your Google Drive
account, just like your Google Docs and Google Sheets files.
Collaboration
The other great feature that Google Colab offers is the collaboration feature. If you are working with
multiple developers on a project, it is great to use Google Colab notebook. Just like collaborating on a
Google Docs document, you can co-code with multiple developers using a Google Colab notebook.
Besides, you can also share your completed work with other developers.
Wrapping Up
Google Colab is a specialized version of the Jupyter Notebook. It runs on the cloud and offers free
computing resources. The relationship between iPython, Jupyter Notebook, and Google Colab is shown
below;
4 Reasons Why You Should Use Google
Colab for Your Next Project
Colaboratory, or Colab for short, is a Google Research product, which allows developers to write
and execute Python code through their browser. Google Colab is an excellent tool for deep
learning tasks. It is a hosted Jupyter notebook that requires no setup and has an excellent free
version, which gives free access to Google computing resources such as GPUs and TPUs.
Since Google Colab is built on top of vanilla Jupyter Notebook, which is built on top of Python
kernel, let’s look at these technologies before diving into why we should and how we can use
Google Colab.
Please note that this is not a sponsored post. I am sharing my views on a product that I have been
using for years.
There are several tools used in Python interactive programming environments. The central
technology making interaction possible is iPython. IPython is an improved shell and read–eval–
print loop (REPL) for Python.
“iPython Notebook” is a product developed with iPython accessed as a “notebook” via a web
browser. IPython handles two fundamental roles:
Developers can write codes, take notes, and upload media to their iPython notebook. The growth
of the iPython notebook project led to Project Jupyter, which contains the notebook tool and the
other interactive tools for multiple languages (Julia, Python, and R). Jupyter Notebook and its
flexible interface extend the notebook beyond code to visualization, multimedia, collaboration,
and many other features, which creates a comfortable environment for data scientists and
machine learning experts.
Let’s get into a more detailed analysis of iPython, Jupyter Notebook, and Google Colab.
iPython
iPython is a command shell and a kernel, which powers interactive Python notebooks. iPython
allows programmers to run their code in a notebook environment quickly. The features that
iPython provides can be summarized as follows:
A web-based notebook interface with support for code, text, and media.
iPython Project has grown beyond running Python scripts and is on its way to becoming a
language-agnostic tool. As of iPython 4.0, the language-agnostic parts are gathered under a new
Project, named Project Jupyter. The name Jupyter is a reference to core programming languages
supported by Jupyter, which are Julia, Python, and R. As of the implementation of this spin-off
decision, iPython, now only focuses on interactive Python whereas Jupyter focuses on tools like
the notebook format, message protocol, QT Console, notebook web application.
Jupyter Notebook
Project Jupyter is a spin-off open-source project born out of the iPython Project in 2014. Jupyter
is forever free for all to use, and it is developed through the consensus of the Jupyter community.
Several useful tools are released as part of the Jupyter Project, such as Jupyter
Notebook, JupyterLab, Jupyter Hub, and Voilà. While all these tools may be used simultaneously
for accompanying purposes, installing Jupyter Notebook suffices the environmental requirements
for a basic machine learning project.
On the other hand, as an open-source project, Jupyter tools may be integrated into different
toolsets and bundles. Instead of installing Jupyter Notebook through Terminal (for macOS and
Linux) or Command Prompt (for Windows), you can use the Anaconda distribution, which will
also take care of the environment installation on local machines.
If you want to take your development experience to the next level, Google Colab, which is a cloud-
based Jupyter Notebook environment, is the ultimate tool.
There are several reasons to opt to use Google Colab instead of a plain Jupyter Notebook
instance:
Pre-Installed Libraries
Collaboration
Pre-Installed Libraries
Anaconda distribution of Jupyter Notebook shipped with several pre-installed data libraries, such
as Pandas, NumPy, Matplotlib, which is awesome. Google Colab, on the other hand, provides
even more pre-installed machine learning libraries such as Keras, TensorFlow, and PyTorch.
When you opt to use a plain Jupyter notebook as your development environment, everything is
saved in your local machine. If you are cautious about privacy, this may be a preferred feature
for you. However, if you want your notebooks to be accessible to you from any device with a
simple Google log-in, then Google Colab is the way to go. All of your Google Colab notebooks
are saved under your Google Drive account, just like your Google Docs and Google Sheets files.
Collaboration
Another great feature that Google Colab offers is the collaboration feature. If you are working
with multiple developers on a project, it is great to use Google Colab notebook. Just like
collaborating on a Google Docs document, you can co-code with multiple developers using a
Google Colab notebook. Besides, you can also share your completed work with other developers.
For me this is a great option since I share all my Colab notebooks with my subscribers thanks to this
feature. Subscribe today to get them!
I think this is an absolute no brainer to choose Google Colab instead of a local Jupyter notebook.
Google Research lets you use their dedicated GPUs and TPUs for your personal machine
learning projects. Speaking from experience, for some projects, the GPU and TPU acceleration
make a huge difference even for some small projects. This is one of the main reasons for me to
code all my educational projects on Google Colab. Besides, since it uses Google resources, the
neural network optimization operations do not mess with my processors, and my cooling fan
doesn’t go crazy.
In Summary
Google Colab is just a specialized version of the Jupyter Notebook, which runs on the cloud and
offers free computing resources. The relationship between iPython, Jupyter Notebook, and
Google Colab is shown in Figure 3.
Figure 3. The relation between iPython, Jupyter Notebook, and Google Colab (Figure by Author)
So, I assume that you are now convinced that you will use Google Colab for your next project.
How are you going to set it up?
The Google Setup process is relatively easy and can be completed with the following steps
across all devices:
Visit the Google Colab page, which will direct you to the Google Colaboratory Welcome Page.
3. Sign in with your Gmail account. Create one if you don’t have a Gmail account.
5. You may easily create a new Colab notebook on this page by clicking File> New notebook.
Congratulations
You have successfully created a Google Colab notebook within minutes. Now you can start
working on your machine learning project.
I can think of two scenarios where you should opt for a local Jupyter Notebook instance:
1 — If you care about privacy and want to keep your code hidden, stay away from Google
Colab; or
2 — If you have an incredibly powerful local machine with access to GPUs and TPUs, also local
Jupyter Notebook is the way to go.
But, for almost all the other scenarios, I’d recommend Google Colab. I hope this post was
helpful in understanding the relationship between iPython, Jupyter Notebook, and Google Colab
notebook.
Drawbacks Of Google Colab
Closed-Environment: Anyone can use Google Colab to write and run arbitrary Python code in
the browser. However, it is still a relatively closed environment, as machine learning
practitioners can only run the python package already pre-added on the Colab. There is no way
that one can add their own python package and start running the code. Hence, the platform can
provide common tools but is not suitable for specialisation.
Repetitive Tasks: Imagine one has to repeat the same set of actions repeatedly to execute a task
— not only will it be exhausting, but it will also consume a lot of time. Similarly, for every new
session in the Google Colab, a programmer must install all of the specific libraries that aren’t
included with the standard Python package.
No Live-Editing: Writing a code and sharing the same with your partner or a team allows you to
collaborate. However, the option for live editing is completely missing in Google Colab, which
restricts two people to write, or edit codes at the same time. Hence, it further leads to a lot of
back and forth re-sharing. Additionally, this feature is provided by its other competitors,
including CoCalc.
Saving & Storage Problems: Uploaded files are removed when the session is restarted because
Google Colab does not provide a persistent storage facility. So, if the device is turned off, the
data can get lost, which can be a nightmare for many. Moreover, as one uses the current session
in Google Storage, a downloaded file that is required to be used later needs to be saved before
the session’s expiration. In addition to that, one must always be logged in to their Google
account, considering all Colaboratory notebooks are stored in Google Drive.
Limited Space & Time: The Google Colab platform stores files in Google Drive with a free
space of 15GB; however, working on bigger datasets requires more space, making it difficult to
execute. This, in turn, can hold most of the complex functions to execute.
Google Colab allows users to run their notebooks for at most 12 hours a day, but in order to work
for a longer period of time, users need to access the paid version, i.e. Colab Pro, which allows
programmers to stay connected for 24 hours. Finally, the less talked about drawback of the
platform is its inability to execute codes or run properly on a mobile device.
Conclusion
Google Colab entered the market with a pure focus to provide machine learning practitioners
with a platform and tools to advance their machine learning capabilities. However, over time, the
volume, intensity, and quality of data changed, and so did ML practitioners’ requirements to find
solutions to complex problems. Coming out with a paid version is easy, but for the larger good, it
needs to be upgraded and freely accessible to anyone for the entire machine learning ecosystem
to grow.