Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to autosave notebooks in Google colab?

I was recently working in a notebook on Google Colab and my computer ran out of battery and died. All the progress I had made was not saved anywhere! I'm very used to having jupyter notebooks, which saves my files pretty much every time I execute a cell. Is there a way to have an equivalent feature in Google Colab?

like image 477
polortiz40 Avatar asked Mar 07 '19 05:03

polortiz40


2 Answers

Autosave is already implemented in Google Colab, but there is a certain delay between the moment you execute a cell and when the save occurs.

You can try this yourself by going into File>Revision History, executing a cell, and waiting for the list to refresh.

That being said, I have also experienced loss of data in the past, which I can't explain. It might be a glitch.

As a good practice, I try to save every time I remember.

Good luck.

like image 117
Valentin Schmidt Avatar answered Sep 26 '22 03:09

Valentin Schmidt


Autosave every 60 seconds by running this "magic command" into a new code cell :

%autosave 60

Colab will confirm it when you run the cell with printing : "Autosave changes every 60 seconds"

To display the list of all magic commands you can use the command :

%lsmagic

Additionally, you can call the Quick Reference Guide, describing all the magic commands and what they do using the command :

%quickref

Enjoy!

like image 36
Geoffroy de Viaris Avatar answered Sep 24 '22 03:09

Geoffroy de Viaris