Tensorflow ArgumentError运行CIFAR-10示例

时间:2016-01-12 01:19:21

标签: python argparse tensorflow

我正在尝试运行Tensorflow的CIFAR-10示例。但是,在执行python cifar10.py时,我收到的错误如下。

我使用pip安装了Tensorflow软件包的0.6.0版本。该框架在其他模型上运行良好,包括MNIST教程和一些自行开发的网络。有人对这个问题的根源有所了解吗?你认为我应该在github上打开一个问题吗?

I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcublas.so.7.0 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcudnn.so.6.5 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcufft.so.7.0 locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcuda.so locally
I tensorflow/stream_executor/dso_loader.cc:101] successfully opened CUDA library libcurand.so.7.0 locally
Traceback (most recent call last):
  File "cifar10.py", line 54, in <module>
    """Number of images to process in a batch.""")
  File "/disk/no_backup/teichman/tensorflow/gpu_mode/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_flags.py", line 86, in DEFINE_integer
    _define_helper(flag_name, default_value, docstring, int)
  File "/disk/no_backup/teichman/tensorflow/gpu_mode/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_flags.py", line 60, in _define_helper
    type=flagtype)
  File "/usr/lib/python2.7/argparse.py", line 1297, in add_argument
    return self._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1671, in _add_action
    self._optionals._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1498, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1311, in _add_action
    self._check_conflict(action)
  File "/usr/lib/python2.7/argparse.py", line 1449, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib/python2.7/argparse.py", line 1456, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --batch_size: conflicting option string(s): --batch_size

1 个答案:

答案 0 :(得分:6)

解决了这个问题。一个不应该直接执行python cifar10.py,而是应该运行python cifar10_train.pypython cifar10_eval.py