本文介绍了运行 CIFAR-10 示例的 Tensorflow ArgumentError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我已经使用 pip 安装了 0.6.0 版的 Tensorflow 包.该框架在其他模型上运行良好,包括 MNIST 教程和一些自主开发的网络.有人知道问题的根源吗?你认为我应该在github上开一个问题吗?

I tensorflow/stream_executor/dso_loader.cc:101] 本地成功打开CUDA库libcublas.so.7.0我 tensorflow/stream_executor/dso_loader.cc:101] 在本地成功打开了 CUDA 库 libcudnn.so.6.5我tensorflow/stream_executor/dso_loader.cc:101]在本地成功打开了CUDA库libcufft.so.7.0我 tensorflow/stream_executor/dso_loader.cc:101] 在本地成功打开了 CUDA 库 libcuda.so我tensorflow/stream_executor/dso_loader.cc:101]在本地成功打开了CUDA库libcurand.so.7.0回溯(最近一次调用最后一次): 中的文件cifar10.py",第 54 行"""批量处理的图像数量.""")文件/disk/no_backup/teichman/tensorflow/gpu_mode/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_flags.py",第86行,DEFINE_integer_define_helper(flag_name, default_value, docstring, int)文件/disk/no_backup/teichman/tensorflow/gpu_mode/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_flags.py",第60行,在_define_helper类型=标志类型)文件/usr/lib/python2.7/argparse.py",第 1297 行,在 add_argument 中返回 self._add_action(action)_add_action 中的文件/usr/lib/python2.7/argparse.py",第 1671 行self._optionals._add_action(action)文件/usr/lib/python2.7/argparse.py",第 1498 行,在 _add_actionaction = super(_ArgumentGroup, self)._add_action(action)文件/usr/lib/python2.7/argparse.py",第 1311 行,在 _add_actionself._check_conflict(action)_check_conflict 中的文件/usr/lib/python2.7/argparse.py",第 1449 行冲突处理程序(行动,confl_optionals)文件/usr/lib/python2.7/argparse.py",第 1456 行,在 _handle_conflict_error引发 ArgumentError(action, message % conflict_string)argparse.ArgumentError:参数 --batch_size:冲突的选项字符串:--batch_size
解决方案

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

I am trying to run the CIFAR-10 example of Tensorflow. However when executing python cifar10.py I am getting the error attached below.

I have installed Version 0.6.0 of the Tensorflow package using pip. The framework is working fine on other models including the MNIST tutorial and some self developed networks. Does anybody has an idea about the origin of the problem? Do you think I should open an issue on 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
解决方案

Solved the problem. One is not supposed to execute python cifar10.py directly, but one should run python cifar10_train.py or python cifar10_eval.py instead.

这篇关于运行 CIFAR-10 示例的 Tensorflow ArgumentError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 15:03