fabiprogramiert
fabiprogramiert

Reputation: 91

How can I use Google Colab to train my model overnight?

I have an agent which is trying to lear an upswing with an inverted pendulum on a cart. This takes ages on my Notebook. Then I found Google Colab. I thought this is my golden ticket for fast learning. But when I start my code and close my laptop it doesn't continue overnight. How can I change this? I read about the maximum time you have on the server, but I´m nowhere near this limit. Do I have to include some type of activation or am I just dumb?

Upvotes: 5

Views: 6721

Answers (2)

ashraful16
ashraful16

Reputation: 2782

Run the following code in the console and it will prevent you from disconnecting. Ctrl+ Shift + i to open inspector view . Then go to console.

function ClickConnect(){
    console.log("Working"); 
    document.querySelector("colab-toolbar-button#connect").click() 
}
setInterval(ClickConnect,60000)

Also, there are many methods described here. You can try with these methods.

Upvotes: 2

shakhyar.codes
shakhyar.codes

Reputation: 249

Well there are tons of different ways of doing this:

  1. Right click on the colaboratory or open Inspect element of your browser. This might vary upon various browsers, so I suggest to search the keyboard shortcut for inspecting element of your browser, might be "Ctrl+Shift+i".....
  2. Navigate and go to console panel of the inspect element window, type this on the console:
function ConnectButton(){
    console.log("Connect pushed"); 
    document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() 
}
setInterval(ConnectButton,60000);

What this does is that clicks on the Connect button every 60 seconds of idleness and you should be good to go....BUT You can also click on runtime tab of colaboratory, click on change runtime type, and use Google's dedicated GPU or TPU as this will dramatically increase training process. Good luck!

Upvotes: 4

Related Questions