Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Colab session timeout

In the FAQs it is mentioned that

Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.

Are the maximum lifetime and idle times fixed or variable? Is there any way to predict them?

like image 607
Sia Avatar asked Jan 05 '19 22:01

Sia


People also ask

How long does colab idle take?

Colab has implemented a limit on the free usage, so that they can allocate the resources across all users and platforms. Notebooks run by connecting to virtual machines that have maximum lifetimes that can be as much as 12 hours. Notebooks will also disconnect from VMs when left idle for too long.


2 Answers

It's 90 minutes if you close the browser. 12 hours if you keep the browser open. Additionally, if you close your browser with a code cell is running, if that same cell has not finished, when you reopen the browser it will still be running (the current executing cell keeps running even after browser is closed)

like image 89
korakot Avatar answered Oct 02 '22 16:10

korakot


PROBLEM: I have to training my model for hours but the google colab keeps disconnecting after 30 mins automatically if I do not click frequently, leading to loss of all data.

SOLUTION:

Steps:

  1. Open the inspector view by typing Ctrl+ Shift + i and then clicking on console tab at top.
  2. Paste the below code snippet at bottom of console and hit enter
function ClickConnect(){ console.log("Working");  document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click(); } setInterval(ClickConnect,60000) 
  1. Believe me, that's all folks. Above code would keep on clicking the page and prevent it from disconnecting.

Below is the image showing console view of above steps:-

enter image description here

enter image description here

Alternatively you can also try below snippet:

interval = setInterval(function() {      console.log("working")     var selector = "#top-toolbar > colab-connect-button"     document.querySelector(selector).shadowRoot.querySelector("#connect").click()     setTimeout(function() {             document.querySelector(selector).shadowRoot.querySelector("#connect").click()     }, 1000) }, 60*1000) 
like image 35
Ashish Anand Avatar answered Oct 02 '22 16:10

Ashish Anand