Google Colab中的检查点 [英] Checkpoints in Google Colab

查看:158
本文介绍了Google Colab中的检查点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将训练有素的模型存储在Google Colab上并在本地磁盘上进一步检索? 检查站会工作吗?我如何存储它们并在一段时间后检索它们?能否请您提及代码.太好了.

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.

推荐答案

Google Colab实例是在您打开笔记本时创建的,以后会被删除,因此您无法在不同的运行中访问数据.如果要将训练后的模型下载到本地计算机,可以使用:

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>)

另一种可能的解决方案(我认为更好)是使用github存储库存储模型,然后简单地将模型提交并推送到github,然后克隆存储库以将模型取回.

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.

这篇关于Google Colab中的检查点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆