How to Avoid Disconnection in Google colab

Google Colab can disconnect when there’s no interaction for 90 minutes which can be prevented by triggering an interaction within 90 minutes.

If you press F12 or Ctrl+shift+i on web browser, a console will pop up.

You can add the following JS code in the console.

function ClickConnect(){
    console.log("Prevent Colab Disconnection");
    document.querySelector("colab-toolbar-button#connect").click()
}
setInterval(ClickConnect, 60 * 1000)

This will execute the ClickConnect() funcdtion every minute.


© 2021. All rights reserved.

Connecting Dots