Checkpoints in Google Colab

Vinit Bodhwani picture Vinit Bodhwani · Mar 16, 2018 · Viewed 10k times · Source

How do I store my trained model on Google Colab and retrieve further on my local disk? Will checkpoints work? How do I store them and retrieve them after some time? Can you please mention code for that. It would be great.

Answer

Ankur Ankan picture Ankur Ankan · Mar 16, 2018

Google Colab instances are created when you open the notebook and are deleted later on so you can't access data on different runs. If you want to download the trained model to your local machine you can use:

from google.colab import files
files.download(<filename>)

And similarly if you want to upload the model from your local machine you can do:

from google.colab import files
files.upload(<filename>)

Another possible (and better in my opinion) solution is to use a github repo to store your models and simply commit and push your models to github and clone the repo later to get the models back.