我在使用 Python 和 Google Cloud ML-Engine 工作。我找到的文档表明应该使用 Buckets 和 Blob 来存储数据
https://cloud.google.com/ml-engine/docs/tensorflow/working-with-cloud-storage
但是,我的大部分代码以及它调用的库都适用于文件。我能否以某种方式将 Google Storage 视为我的 ml-engine 代码中的文件系统?
我希望我的代码读起来像
with open(<something>) as f:
for line in f:
dosomething(line)
请注意,在 ml-engine 中,不会创建和配置 VM 实例。所以我不能用 Filestore 挂载我自己的共享文件系统。
最佳答案
让云存储显示为文件系统的唯一方法是 mount a bucket as a file system :
You can use the Google Cloud Storage FUSE tool to mount a Cloud Storage bucket to your Compute Engine instance. The mounted bucket behaves similarly to a persistent disk even though Cloud Storage buckets are object storage.
但如果您不能创建和配置 VM,就无法做到这一点。
Note that in ml-engine one does not create and configure VM instances.
这不完全正确。我看到 ML 引擎支持 building custom containers ,这通常是安装和配置操作系统级依赖项的方式。但仅限于培训领域,因此如果您的需求在该领域,则可能值得一试。
我假设您已经检查过该库不支持通过已经打开的类似文件的处理程序进行访问(如果不支持,那么可能感兴趣的是 How to restore Tensorflow model from Google bucket without writing to filesystem?)
关于python - 谷歌机器学习引擎云存储作为文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55150560/