TensorFlow r0.11 给出了 TypeError:run() 有一个意外的关键字参数'argv'



我正在尝试运行一个tensorflow示例。

下面是我的设置:

Ubuntu 16.04

cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb

cudnn - 8.0 - linux - x64 v5.0 ga.tgz

https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp35-cp35m-linux_x86_64.whl

我试着运行这个:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))

I saw this:

dan@e80:~/tf11 $ 
dan@e80:~/tf11 $ python tf10.py 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 
name: GeForce 940MX
major: 5 minor: 0 memoryClockRate (GHz) 1.2415
pciBusID 0000:01:00.0
Total memory: 3.95GiB
Free memory: 3.50GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0)
b'Hello, TensorFlow!'
42
dan@e80:~/tf11 $ 
dan@e80:~/tf11 $ 
dan@e80:~/tf11 $

我试着运行这个:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

I saw this:

dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ python mnist_with_summaries.py 
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
Traceback (most recent call last):
  File "mnist_with_summaries.py", line 205, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
TypeError: run() got an unexpected keyword argument 'argv'
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ 
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $

我欢迎任何关于如何调试这个的想法

argv最近加入app.run()功能。因此,要使其工作,您必须删除argv=...参数或从源代码构建TensorFlow。

我也遇到了同样的问题。原来是使用主分支,得到一个发布版的tensorflow库解决了它。

git clone -b r0.11 https://github.com/tensorflow/tensorflow.git

如果您正在使用conda,请确保按照以下方式安装/升级到较新的版本:https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html

1)创建一个名为tensorflow的conda环境:

"Python 2.7 "
$ conda create -n tensorflow python=2.7
"Python 3.4"
$ conda create -n tensorflow python=3.4
"Python 3.5"
$ conda create -n tensorflow python=3.5
2)激活张量流:
source activate tensorflow

3)安装
 conda install -c jjhelmus tensorflow=0.10.0rc0

我选择一个特定的发行版作为conda包。

相关内容

最新更新