Python 我可以运行 Google Colab(免费版)脚本然后关闭我的计算机吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55050988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I run a Google Colab (free edition) script and then shutdown my computer?
提问by S.MC.
Can I run a google colab (free edition) script and then shutdown my computer?
我可以运行 google colab(免费版)脚本然后关闭我的计算机吗?
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.
我正在用交叉验证训练几个深度学习模型,因此我想知道我是否可以关闭窗口或计算机,同时在云中运行训练。
回答by MoltenMuffins
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.
编辑:关闭浏览器后,一个 Colabs 实例最多可以运行
12小时在您的运行时被视为空闲并被回收之前 90 分钟。
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 Chaovavanichshows that:
没有关于“空闲”和“最长寿命”持续时间的官方参考,但Korakot Chaovavanich 进行的测试表明:
- The 'maximum lifetime'of a running notebook is 12 hours(browser open)
- An 'Idle'notebook instance cuts-off after 90 minutes
- You can have a maximum of 2 notebooksrunning concurrently
- If you close the notebook window and open it while the instance is still running, the cell outputs and variables will still persist. However if the notebook instance has been recycled, your cell outputs and variables will no longer be available.
- 正在运行的笔记本的“最长寿命”为12 小时(浏览器打开)
- 一个“空闲”笔记本实例削减起飞后90分钟
- 您最多可以同时运行2 个笔记本
- 如果您在实例仍在运行时关闭笔记本窗口并打开它,则单元格输出和变量仍将保留。但是,如果笔记本实例已被回收,您的单元格输出和变量将不再可用。
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".
您可以尝试的一个偷偷摸摸的解决方法是在您的移动浏览器中打开 Colab 实例,以防止该实例被视为“空闲”。
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.
您自己的里程会有所不同,因为根据个人经验,我有时会缩短持续时间。但是只要你检查你的模型(定期保存训练权重),你应该能够在 VM 被回收之前完成大量的训练,之后你可以简单地将权重加载到新 VM 实例上的模型中并恢复训练。
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 instanceor a standard Jupyter Notebook. But you would forego the free GPU/TPU that Colaboratory provides. (Checkpointing would still be a good idea here!)
但是,如果您希望一次训练模型超过 12 小时,您可以在本地实例或标准 Jupyter Notebook上运行 Google Colaboratory。但是您会放弃 Colaboratory 提供的免费 GPU/TPU。(检查点在这里仍然是一个好主意!)
Relevant questions from the Google Colaboratory FAQ:
Google Colaboratory 常见问题解答中的相关问题:
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.
我的代码在哪里执行?如果我关闭浏览器窗口,我的执行状态会发生什么变化?
代码在专用于您的帐户的虚拟机中执行。虚拟机在闲置一段时间后会被回收,并具有系统强制执行的最长生命周期。
我可以如何使用 GPU,为什么它们有时不可用?
Colaboratory 旨在用于交互式使用。可能会停止长时间运行的后台计算,尤其是在 GPU 上。请不要使用 Colaboratory 进行加密货币挖掘。这样做不受支持,并且可能会导致服务不可用。我们鼓励希望通过 Colaboratory 的 UI 运行连续或长时间运行计算的用户使用本地运行时。