【发布时间】:2016-11-03 08:08:55
【问题描述】:
Google 最近发布了 Cloud ML,https://cloud.google.com/ml/,它非常有用。然而,一个限制是 Tensorflow 程序的输入/输出应该支持 gs://。
如果我们使用所有 tensorflow API 来读/写文件,应该没问题,因为这些 API 支持gs://。
但是,如果我们使用open之类的原生文件IO API,就不行了,因为他们不理解gs://
例如:
with open(vocab_file, 'wb') as f:
cPickle.dump(self.words, f)
此代码在 Google Cloud ML 中不起作用。
但是,将所有原生文件 IO API 修改为 tensorflow API 或 Google Storage Python API 确实很繁琐。有什么简单的方法可以做到这一点吗?任何支持谷歌存储系统的包装器,gs:// 在原生文件 IO 之上?
正如这里建议的Pickled scipy sparse matrix as input data?,也许我们可以使用file_io.read_file_to_string('gs://...'),但这仍然需要大量的代码修改。
【问题讨论】:
标签: tensorflow google-cloud-storage google-cloud-ml