Google Colab has been a boon to the data science community since it allows users to work with large datasets of machine learning or deep learning algorithms on their own machines, without relying on an upgrade, which can be a costly affair. With several pre-installed libraries and the availability of GPU and TPU options, it is already popular among many.
Users who are just getting started with Google Colab can go through this article and learn how to navigate the platform. Since we are through with the step-by-step guide, what follows are some hacks and tricks that can further enhance and streamline a user’s experience with Google Colab. These hacks will help save their time, and also broaden their overall knowledge of the platform.
Google Colab comes with a RAM capability of 13GB. While this can be termed good, it may be insufficient at times since several deep learning models require a lot more space. When a situation like this arises, there is a way to expand the RAM.
The trick is simple and almost doubles the existing RAM of 13GB. This can be done by inputting a certain code in the Google Colab cell and waiting for the Colab to crash.
i = 
As soon as the platform crashes due to lack of RAM, the platform automatically shows an option which readers – Your Session Crashed After Using All Available RAM.
One needs to click on the option- Get More RAM
Once the option is clicked, the platform creates a dialogue box which comes with a message ‘Switch to a high-Ram runtime?’
Clicking on ‘Yes’ will do the magic and a user will have 25 GB of RAM in hand.
Google Colab often disconnects the notebook if a system is kept idle for more than 30 minutes. This can be a huge disappointment for someone who has kept a model on training and left to do some other work. But there is an easy solution, which is nothing but a simple code.
The figure 60,000 stands for the millisecond of a minute, so when the code is entered, it automatically makes a click on Colab after every 60 seconds. Thus, Colab assumes that the notebook is not kept idle and the user is still working.
Whether a beginner or an expert, remembering code syntax can be a problem and may kill the desire to further work on a model. However, there is a way to skip the entire memorization process and get the job done easily by creating a snippet of the code.
A user can create custom snippets in Google Colab after creating a notebook. Once a notebook is created, one needs to add a text cell and type the name of the snippet. Below that, code cells are to be created, after which, one can type the code.
It is also possible to use snippets in multiple notebooks by following these steps:
- Access Tools
- Click on Settings
A pop-up box will appear where a user can paste the link of the notebook with snippets and click on Save.
Shifting from mouse to keyboard and vice versa leads to wastage of time. As a data scientist, it is imperative to increase productivity, which is not possible with mouse and keyboard at the same time. Keeping this in mind, Google Colab has come with several keyboard shortcuts which can help data scientists get the job done faster. Here is a list of keyboard shortcuts one can learn to avoid using a mouse.
This hack allows a user to view Google Colab in different avatars, which can be helpful in the longer run. Human eyes often get strained when it is exposed to the same colour for a long period. However, Google Colab comes with a dark mode, apart from the light mode, which is set by default. Even Jupyter Notebook misses out on this feature.
To get the dark mode, one needs to follow these steps:
- Go to Settings
- Click on Site
- Select theme (Dark\Light)
- Click on Save
That is not all as Colab has tried to be a little quirky with its Corgi and Kitty modes. In the Corgi mode, one can see puppies running on the Colab screen and in the Kitty mode, one can find kittens as is shown the pictures below:
To get these, one needs to follow the steps mentioned below:
- Go to Settings
- Click on Miscellaneous
- Select Corgi, Kitty or Both
- Click on Save