Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow Can';在google cloud ml上加载mnist数据集_Tensorflow_Mnist_Google Cloud Ml - Fatal编程技术网

Tensorflow Can';在google cloud ml上加载mnist数据集

Tensorflow Can';在google cloud ml上加载mnist数据集,tensorflow,mnist,google-cloud-ml,Tensorflow,Mnist,Google Cloud Ml,我想在google cloud ml上运行MNIST的简单深度学习模型。我尝试通过tensorflow的实用方法tensorflow.examples.tutorials.MNIST下载并解包它。不幸的是,当我在云中使用它时,我的代码看不到它。我有这样的例外:没有这样的文件或目录:“gs://bucket/path/train-images-idx3-ubyte.gz当我浏览bucket时,文件在那里,但tensorflow没有看到它 有什么问题吗?问题是我使用了tensorflow附带的阅读器

我想在google cloud ml上运行MNIST的简单深度学习模型。我尝试通过tensorflow的实用方法tensorflow.examples.tutorials.MNIST下载并解包它。不幸的是,当我在云中使用它时,我的代码看不到它。我有这样的例外:没有这样的文件或目录:“gs://bucket/path/train-images-idx3-ubyte.gz当我浏览bucket时,文件在那里,但tensorflow没有看到它


有什么问题吗?

问题是我使用了tensorflow附带的阅读器,它只能与本地文件系统一起工作。为了读取mnist,您必须使用tensorflow.python.lib.io包。

不幸的是,tensorflow的文件系统抽象不能正确支持python的gzip库。因此,mnist.read_data_set仅支持本地文件系统上的
train_dir
,即不能将GCS与实用程序功能一起使用

解决方法是在本地文件系统上创建一个临时目录,然后使用它

在我看来,这是示例中的默认值,例如,有一个标志,
--data dir
,默认情况下指向“/tmp/tensorflow/mnist/input_data”。为了验证,我将的内容复制到一个新的Python脚本中,该脚本在云机器学习引擎上成功运行。也曾为


但是,如果要手动使用(通过
tensorflow/examples/tutorials/mnist/input_data.py
),请确保将本地目录作为第一个参数传递。

但是如何在本地文件系统上使用临时目录?它位于哪里?当您向云提交作业时,您可以完全访问工作人员的文件系统。上面的脚本是硬代码
/tmp
。那很好。您还可以使用Python的
tempfile.mkdtemp
@KonstantinSolomatov如果您在问题中添加一个代码片段,我可能会帮助您更好。好的。我会试试的。我现在用手工编写的阅读器解决了这个问题:-)