首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bazel & Tensorflow:初始v3再培训: AttributeError:'int‘对象属性'__doc__’是只读的

Bazel & Tensorflow:初始v3再培训: AttributeError:'int‘对象属性'__doc__’是只读的
EN

Stack Overflow用户
提问于 2017-08-21 19:39:29
回答 2查看 1.1K关注 0票数 1

我目前正在按照本教程重新训练初始v3神经网络的顶层:https://www.youtube.com/watch?v=m2D02eZTB4s https://www.tensorflow.org/tutorials/image_retraining

我设置了一个运行Ubuntu14.04.5LTS64位的VirtualBox

python 2.7.6

tensorflow 1.3.0

bazel build标签: 0.5.3

但是,当我使用以下命令时

代码语言:javascript
复制
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir /media/myImageDir

然后,我的过程与教程背道而驰。出现了两个导入错误,可以通过安装包轻松解决。

代码语言:javascript
复制
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/ops.py", line 28, in <module>
    from autograd import core as ag_core
ImportError: No module named autograd

File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variable_scope.py", line 24, in <module>
    import enum  # pylint: disable=g-bad-import-order
ImportError: No module named enum

安装autograd和enum后,再次尝试执行命令重新训练时,出现以下错误:

代码语言:javascript
复制
Traceback (most recent call last):
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 108, in <module>
import tensorflow as tf
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 63, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 102, in <module>
from tensorflow.python.framework.importer import import_graph_def
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/importer.py", line 30, in <module>
from tensorflow.python.framework import function
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/function.py", line 34, in <module>
from tensorflow.python.ops import variable_scope as vs
File "/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variable_scope.py", line 191, in <module>
"""
AttributeError: 'int' object attribute '__doc__' is read-only

文件"/home/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variable_scope.py“的第191行如下:

代码语言:javascript
复制
AUTO_REUSE.__doc__ = """
When passed in as the value for the `reuse` flag, AUTO_REUSE indicates that
get_variable() should create the requested variable if it doesn't exist or, if
it does exist, simply return it.
"""

现在我真的不想干预这段代码,因为它不是我编写的自定义代码。我怀疑还有另一个问题,但我完全不知道它可能是什么。我希望这里有人也有类似的问题,并且/或者可以给我任何建议。

EN

回答 2

Stack Overflow用户

发布于 2017-08-27 03:20:35

我也遇到了这一点,我注意到最近在tensorflow中有一个关于这方面的issue。解决方案是以下解决方法:

如果您已经安装了enum,请将其卸载:sudo pip remove enum

  • Install此兼容版本的enum:sudo apt-get install python-enum34

  • Try。
票数 2
EN

Stack Overflow用户

发布于 2017-08-22 04:10:21

我通过粗暴地修改源代码解决了这个问题!

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45796177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档