5 Google Colab Hacks One Should Be Aware Of
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. RAM Expansion 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 = [] while(True): i.append(‘a’) 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. Stay Connected 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. A user needs to open the Chrome DevOps tool by pressing F12 or Ctrl+Shift+I on Linux and input the code mentioned below on the JavaScript code: function KeepClicking(){ console.log(“Clicking”); document.querySelector(“colab-toolbar-button#connect”).click() }setInterval(KeepClicking,60000) 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. Custom Snippets 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 ToolsClick on Settings A pop-up box will appear where a user can paste the link of the notebook with snippets and click on Save. Keyboard Shortcuts 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. Modes 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: ToolsGo to SettingsClick on SiteSelect 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: Via Lynn Le To get these, one needs to follow the steps mentioned below: Go to SettingsClick on MiscellaneousSelect Corgi, Kitty or BothClick on Save
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 […]
Here are some hacks and tricks that can enhance and streamline a user’s experience with Google Colab, and also broaden their knowledge.
["devop", "devops tools", "Google Colab"]
["data science", "machine learning", "TPU", "AI", "R", "ML", "JavaScript", "devops tools", "Colab", "deep learning", "Google Colab", "Jupyter", "devop"]
["AI", "machine learning", "ML", "deep learning", "data science", "Jupyter", "Colab", "TPU", "R", "JavaScript"]