python - 谷歌机器学习引擎云存储作为文件

标签 python google-app-engine google-cloud-platform google-cloud-storage google-cloud-ml

我在使用 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/

相关文章:

python - 如何从调用者访问变量,即使它不是封闭范围(即实现动态范围)?

python - Python 中的 'type' 是什么?

python - 如何将我的用户输入限制为单个数字? (Python)

python - 加载到 pd.DataFrame 时日期时间的奇怪行为

python - 未安装requirement.txt中的依赖项

python - 如何从 webapp2 中的 cookies/headers/session 中决定语言?

java - .jsp 页面无法与 Google App Engine 配合使用

google-cloud-platform - 如何禁用所有已启用的 API/服务?

api - ml.googleapis.com 需要 OAuth 2 访问 token 、登录 cookie 或其他有效身份验证凭据

google-cloud-platform - 空闲 Kubernetes 集群上的高内存消耗