The world’s leading publication for data science, AI, and ML professionals.

Sharable Jupyter Notebooks!

Finally, a way for a team to share and run code easily

Alright, so it called Colaboratory, and it’s available in Google Drive.

What’s Awesome?

  • Sharable Notebooks for teams and collaborators.
  • Decent specs
  • Free GPU access
  • Preinstalled machine learning libraries like NumPy or Tensorflow
  • Importing existing Notebooks

Here’s Google describing it:

Installation

On your google drive just right-click anywhere in a folder.

Go to ‘More‘ > ‘Connect more apps

In the G Suite Marketplace, you can search for ‘Colaboratory‘ and just install it.

Done!

Using Colaboratory

Opening it up you’ll see what looks like a very similar interface to Jupyter notebook.

I won’t get into the coding part since I assume you’re all familiar with Jupyter Notebooks but let’s take a look around at some features.

Getting Dark Mode

Go to Settings (Gear Icon) at the top left of the interface. In the ‘Site’ Tab under ‘Theme’ select dark.

Phew! Now we can get started.

Table of Contents

On the right side, we can see 3 tabs.

The first one lets us see the Table of Contents. In the notebook that I was playing with, you can see that I created a section called ‘PDF and CDF‘ and another called ‘Convolution‘.

Sections are a great way to organize your notebooks.

In Colaboratory, they can be created by :

  • clicking the ‘+section‘ button in the Table of Contents tab
  • or just by adding text and formatting it as a title (ex: ‘# Title1’).

Code Snippets

The next tab is code snippets. Colaboratory provides you with a few default code snippets that can be pretty useful. Some are kinda cool, like the ‘Camera Capture‘ one.

You can add your own code snippets. But as far as I can tell, it’s a little convoluted. Here’s how I go about doing it.

  1. Create a new NoteBook and call it whatever you want. I called my notebook Snippets.
  2. For each snippet create a title and add your snippet. For example, here I have 2 snippets with some random code.
  1. Then just copy the URL of your snippet notebook and open Settings (Gear Icon in the top left-hand corner). On the ‘Site‘ tab > under ‘Custom snippet notebook URL‘ > paste your snippet URL and hit ‘Save’.

  2. Done! Your snippets are now searchable in the snippet section based on their title name. So for example, if I search for Imports in any of my new notebooks,

I can know access the snippet that I had created! This is a super useful feature for when code gets reused constantly.

The File Manager

This is great because it gives you an easy way to view all your files. My original Notebook seems to come with some sample data which I found weird but thanks Google.

If you notice the Pikachu image, I was able to grab a picture online and easily save it to my File Manager (via !wget). The cool thing is that we can click on these files and view them right from Colaboratory.

You can see that both CSV files and images are supported and viewable. This is great for being able to look through files quickly without having to go to my local file directory or GDrive.

Sharing

If you’ve ever used google docs you probably already know how to share docs. Simply, click on the share icon and add people to your notebook or send them a link.

You can also link to a specific cell (for when your notebooks get crazy) by hovering over a cell and selecting the share icon.

GPU Access

One of the best features is the GPU access provided. On the toolbar select ‘Runtime’ > ‘Change Runtime Type’ and you can choose between a GPU or TPU.

This makes some complex processes significantly faster. Head here to see more information about the specs Google provides because it may change over time. Currently, you can run a notebook with GPU enabled for 12 hours, which is pretty decent considering its free. If you want to go beyond that they do provide a paid-tier option.


Colaboratory is actually a pretty old thing that I just didn’t know about. I think it was released back in 2017 but I never heard about it until recently. But I have to say the features are super cool and useful. There’s a ton of awesome features that I didn’t cover so if there’s anything awesome that I missed, feel free to comment on it in the comment section, I’m sure it’ll help everyone out and thanks for reading!

If you liked this story check out some of my others,

Data Visualization: Animate Bar Graphs!

Machine Learning – Handling Missing Data


Related Articles