本文介绍了在与Docker安装的Tensorflow上运行mnist_softmax.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据本文给出的教程(支持GPU),我在Ubuntu 16.04 LTS上安装了Tensorflow:



通过此命令管理运行docker:

  nvidia-docker run -it -p 8888:8888 -v / home / myusername / notebooks:/ notebooks gcr.io/tensorflow/tensorflow:latest-gpu 

docker exec -it [my_DOCKER_ID] bash

一旦我设法进入码头bash成功,我发现这里有tensorflow目录:

  cd /usr/local/lib/python2.7/dist-我继续尝试示例代码,并成功地到达了测试。错误为0.8%:

  python convolutional.py 

接下来,在教程页面,我想尝试一下mnist_softmax.py。所以我将tensorflow的软件包克隆到/笔记本上:

  cd / notebooks 
git clone https:// githubcom / tensorflow /但是,运行代码时我发现问题:




  cd tensorflow / tensorflow / examples / tutorials / mnist / 

python mnist_softmax.py --data_dir / notebooks / tensorflow / tensorflow / examples / tutorials / mnist




这个错误是由安装错误引起的还是因为我没有完成的步骤,我很无知。我的问题:


  1. 我的安装是否完成?我假设我有一个干净的安装知道我可以运行码头和进入码头巴什。另外,我设法运行convolution.py

  2. 如果我正确理解Docker,我根本不需要克隆和构建tensorflow包?


解决方案

我有同样的问题,这是由于运行更新版本(例如v0.12)的教程代码与旧版本在我的码头容器(在我的情况下为v0.11)的张量流。
同样的问题在此讨论:



app.run()方法在v0.12之前没有argv参数。


I installed Tensorflow on Ubuntu 16.04 LTS following the tutorial given here (with GPU support): Docker Installation for Tensorflow

Managed to run docker with this command:

nvidia-docker run -it -p 8888:8888 -v /home/myusername/notebooks:/notebooks gcr.io/tensorflow/tensorflow:latest-gpu

docker exec -it [my_DOCKER_ID] bash

Once I managed to get into the docker bash successfully, I found that there is tensorflow directory here:

cd /usr/local/lib/python2.7/dist-packages/tensorflow/models/image/mnist/

I proceeded to try the example code and successfully reached Test error of 0.8%:

python convolutional.py

Next, following https://www.tensorflow.org/versions/r0.11/tutorials/mnist/pros/index.html tutorial page, I would like to try mnist_softmax.py. So I cloned tensorflow's package to /notebooks:

cd /notebooks
git clone https://githubcom/tensorflow/tensorflow.git

However, I found problem when running the code:

cd tensorflow/tensorflow/examples/tutorials/mnist/

python mnist_softmax.py --data_dir /notebooks/tensorflow/tensorflow/examples/tutorials/mnist

At this point I'm pretty clueless whether the error was caused by bad installation or it's because there are steps that I havent done. My questions:

  1. Is my installation complete? I assumed I had a clean installation knowing that I can run docker and get into the docker bash. Plus, I managed to run convolution.py
  2. If I understand Docker correctly, I do not need to clone and build tensorflow package at all?
解决方案

I had the same problem and it was caused by running tutorial code from a later version (eg v0.12) against an older version of tensorflow which was in my docker container (v0.11 in my case).The same problem is discussed here: https://github.com/tensorflow/tensorflow/issues/5643

The app.run() method didn't have the argv parameter until v0.12.

这篇关于在与Docker安装的Tensorflow上运行mnist_softmax.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 19:58