Can I run a google colab (free edition) script and then shutdown my computer?
I am training several deeplearning models with crossvalidation, and therefore I would like to know if I can close the window or the computer with the training running at the same time in the cloud.
Edited: With the browser closed, a Colabs instance will run for at most
12 hours90 minutes before your runtime is considered idle and is recycled.
At the same time, it would be good practice to save your model weights periodically to avoid losing work.
Details:
There are no official references for 'Idle' and 'Maximum Lifetime' durations, but testing done by Korakot Chaovavanich shows that:
A sneaky workaround you can try is to have the Colabs instance open in your mobile browser in order to prevent the instance from being considered "Idle".
Your own milage will vary as from personal experience I sometimes get slighty shorter durations. But as long as you checkpoint your models (periodically save the training weights), you should be able to get a substantial amount of training done before the VM is recycled, after which you could simply load the weights into the model on a new VM instance and resume training.
If you'd like to train your model for more than 12 hours at a single go however, you can run Google Colaboratory on a local instance or a standard Jupyter Notebook. But you would forego the free GPU/TPU that Colaboratory provides. (Checkpointing would still be a good idea here!)
Relevant questions from the Google Colaboratory FAQ:
Where is my code executed? What happens to my execution state if I close the browser window?
Code is executed in a virtual machine dedicated to your account. Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.
How may I use GPUs and why are they sometimes unavailable?
Colaboratory is intended for interactive use. Long-running background computations, particularly on GPUs, may be stopped. Please do not use Colaboratory for cryptocurrency mining. Doing so is unsupported and may result in service unavailability. We encourage users who wish to run continuous or long-running computations through Colaboratory’s UI to use a local runtime.