python - 如何重新连接到 Google Colab 上正在进行的进程

标签 python deep-learning keras jupyter-notebook google-colaboratory

我最近开始使用 Google Colab 来训练我的 CNN 模型。训练一次总是需要10+小时左右。但是在这10多个小时里我不能呆在同一个地方,所以我总是把笔记本关机,让这个过程继续进行。

我的代码会自动保存模型。我发现当我与 Colab 断开连接时,该过程在断开连接后仍在保存模型。

问题如下:

  1. 当我尝试重新连接到 Colab notebook 时,它总是停留在“INITIALIZAING”阶段,无法连接。我确定该过程正在运行。我怎么知道流程是否结束?

  2. 有什么方法可以重新连接到正在进行的进程吗?在训练过程中观察训练损失对我来说会很好。

抱歉我的英语不好,非常感谢。

最佳答案

将丢失结果输出到保存在驱动器中的日志文件中,并定期检查此文件。

您可以像这样运行训练过程:

!log_file = "/content/drive/My Drive/path/log.log"

!python train.py > "${log_file}"

关于python - 如何重新连接到 Google Colab 上正在进行的进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49790025/

相关文章:

python - 如何将神经网络的输出限制在特定范围内?

python - 通过python在文本文件中查找变量的数量

Python for Windows 在调用 MinGW-w64 编译库的函数时挂起

tensorflow 2 : Customized Loss Function works differently from the original Keras SparseCategoricalCrossentropy

machine-learning - 通过跨 channel 局部响应归一化(LRN)层的反向传播算法

sql-server - 将keras模型保存到数据库

python - 在 Python 中将基类动态混合到实例中

python - 如何在 Python 的 xml.dom.minidom 中设置元素的 id?

python - 如何确保 Keras 模型权重在每次模型拟合时随机初始化

python - 属性错误: 'Node' object has no attribute 'outbound_layers'