Model 从google cloud ml bucket加载Keras模型

Model 从google cloud ml bucket加载Keras模型,model,keras,google-cloud-platform,load,google-cloud-ml,Model,Keras,Google Cloud Platform,Load,Google Cloud Ml,在Google cloud ml上使用Keras: 从培训中保存模型: model.save('model.h5') 注意:不保存到job_文件夹,我需要稍后阅读,不想跟踪最新的作业(即使这是一种将模型分开的好方法) 现在我想阅读下一次跑步的内容: f = file_io.FileIO(model_file, mode='rb') model = load_model(f) model.load_weights(f) 其中“model_file”作为我提交的输入,指向 --model-file

在Google cloud ml上使用Keras:

从培训中保存模型:

model.save('model.h5')

注意:不保存到job_文件夹,我需要稍后阅读,不想跟踪最新的作业(即使这是一种将模型分开的好方法)

现在我想阅读下一次跑步的内容:

f = file_io.FileIO(model_file, mode='rb')
model = load_model(f)
model.load_weights(f)
其中“model_file”作为我提交的输入,指向

--model-file gs://$BUCKET_NAME/resources/model.h5
谷歌云ml作业投诉:

TypeError: expected str, bytes or os.PathLike object, not FileIO

我尝试了很多方法,但我的基本问题是:在gcp存储桶中编写模型,尤其是读取模型的最佳实践是什么?

最后,我使用这里的解决方案使它工作起来:


感谢Tíarnán McGrath(我没有足够的分数来做+1)

请澄清在代码中发生此异常的位置,是在load_模型(f)的代码中还是在sdk代码中?感谢Oliver,我做了一些调试来更详细地回答您的问题,在这样做的同时,我找到了下面的解决方案。那就是将模型文件从gs复制到本地文件系统,对吗?@user2427317您可以接受您的答案(考虑编辑并添加重要信息)
TypeError: expected str, bytes or os.PathLike object, not FileIO