Code to Prevent Google Colab From disconnecting

Ø What is Google Colab

Google Colab is a newer better version of old style Jupyter Notebook which is stored in a google drive. It allows you to work on big data sets for free and runs your python codes in a jiffy. So, Google Colab provides you with free cloud service and now assists you with free GPU.

Google Colab helps you refine your skills in machine learning (ML) and Deep Learning with uttermost ease. As it is a cloud platform you can save your data on the cloud and share it from cloud with minimal of fuss, but while working many users have complained about Colab disconnecting so here, we will discuss this issue and how to resolve it.

 Ü     Problem:

Google Colab keeps getting disconnected after 90 minutes of inactivity and keeps resetting everything and all of the progress and data keeps getting lost.

 Ü     Solution:    

To prevent Colab from disconnecting just run the following command in the console and it will prevent your Colab notebook from disconnecting.

Ctrl+ Shift + i to open inspector view. Then go to console.


 It would keep clicking on the page and prevent it from disconnecting. This solves the issue.

 Ü     Error:

Users have been reporting like errors:

 1.     Uncaught Type Error: Cannot read property ‘click’ of null at <anonymous>:1:35

 2.     Uncaught TypeError: Cannot read property ‘click’ of null at <anonymous>:1:55

 3.    document.querySelector(“#connect“).click() VM5916:1 Uncaught TypeError: Cannot read property        ‘click’ of null at <anonymous>:1:35.

Ü Quick Fix for error:

Users can try this for the ones whose 1st program is giving them errors. There might be an error if the console window is taking a lot of image and the connect button is not visible in the page.

Ø Or can try this:

Though you get “undefined” message. Take a look at the connect button it starts connecting.

Here is a solution for stopping Colab from disconnecting and in the process, user losing all the unsaved data. If you are new to Google Colab, here is how you can get started.


Categorized in:

Tagged in: