如何将训练有素的模型存储在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中的检查点
发布评论