【问题标题】:Google Colab - Where is the output saved?Google Colab - 输出保存在哪里?
【发布时间】:2018-10-02 17:05:43
【问题描述】:

我正在谷歌的 colab 上训练机器学习模型。我正在使用带有 tensorflow 后端的 keras(python 3.6)。 我正在使用 keras 提供的 model.save() 函数保存我的模型。当我调用model.save('model_name)`时,文件保存在哪里?我在任何地方都找不到它。

【问题讨论】:

  • 您的驱动器安装了吗?
  • 不,我该怎么做?
  • 所以我安装了我的驱动器,当我执行 !ls 时,我看到了保存的模型。我如何下载它/它保存在哪里?我还是不明白:(

标签: python-3.x keras drive google-colaboratory


【解决方案1】:

首先,安装你的驱动器:

!mkdir -p drive
!google-drive-ocamlfuse drive

现在,添加您的路径:

import sys
sys.path.append('drive/Project')

您应该能够使用以下方式在本地和基于 Web 的驱动器上查看您的文件:

model.save('drive/Project/myModel.h5')

【讨论】:

  • fuse:挂载点不是空 fuse:如果您确定这是安全的,请使用“非空”挂载选项。如何清空挂载点?
  • 授权并安装我的驱动器。我收到此错误:无法创建文件(无法打开文件:名称 = 'DL/Project/gen0.h5',errno = 2,错误消息 = '没有这样的文件或目录',标志 = 13,o_flags = 242 )
  • 从 google.colab 导入驱动器 drive.mount('/content/drive')
【解决方案2】:

虽然有点晚了,但我也在为同样的问题苦苦挣扎。然后我发现在 colab 中安装驱动器,然后提供驱动器路径,文件将存储在谷歌驱动器中

from google.colab import drive
drive.mount('/content/gdrive')
#using model.save_weights() to save the weights of the model in HDF5 format
model.save_weights("/content/gdrive/My Drive/weights.h5")

文件保存在名为“weights.h5”的驱动器中

【讨论】:

    猜你喜欢
    • 2021-02-18
    • 1970-01-01
    • 2019-04-05
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多