tensorflow - 导入 Tensorflow Hub 时出现问题“模块‘tensorflow.tools.docs.doc_controls’没有属性‘inheritable_header’”
问题描述
我面临一个关于 TensorFlow hub 导入的问题。以下是在终端中发布的错误。我用的tensorflow的版本是2.6,tensorflow-hub的版本是0.12.0。我使用 pip install 安装了它们。我有点急于完成我的项目,非常感谢您的帮助。
File "/home/bannigo/catkin_ws/src/motorAI_assign/scripts/task1_1.py", line 21, in
import tensorflow_hub as hub
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_hub/init.py", line
88, in
from tensorflow_hub.estimator import LatestModuleExporter
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_hub/estimator.py",
line 62, in
class LatestModuleExporter(tf.compat.v1.estimator.Exporter):
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow/python/util/lazy_loader.py", line 62, in getattr
module = self._load()
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow/python/util/lazy_loader.py", line 45, in _load
module = importlib.import_module(self.name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/init.py",
line 10, in
from tensorflow_estimator._api.v1 import estimator
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow_estimator/_api/v1/estimator/init.py", line 10, in
from tensorflow_estimator._api.v1.estimator import experimental
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow_estimator/_api/v1/estimator/experimental/init.py", line 10, in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow_estimator/python/estimator/canned/dnn.py", line 27, in
from tensorflow_estimator.python.estimator import estimator
File "/home/bannigo/.local/lib/python3.6/site-
packages/tensorflow_estimator/python/estimator/estimator.py", line 70, in
@doc_controls.inheritable_header
AttributeError: module 'tensorflow.tools.docs.doc_controls' has no attribute
'inheritable_header'
解决方案
这是一个已知问题:https ://github.com/tensorflow/hub/issues/819 。一种临时解决方法是降级tensorflow-estimator
:
pip install -U tensorflow-estimator==2.6.0
推荐阅读
- android - 为什么按存储库流不更新我的 viewModels 实时数据?
- python - 如何在不影响和减慢相机视频的情况下在 python 中进行延迟?
- html - 十月CMS中的魔术表格
- javascript - 如何在 p5.js 中重置动画
- curl - 为什么我无法从服务器下载 https 对等证书颁发者无法识别。颁发者:CN=Cisco Umbrella Secondary SubCA
- libgdx - 如何在 libgdx 的节点上设置材质?
- python - 我无法将数据从线程传递到 GUI JLabel
- reactjs - 部署到 Kubernetes 后看不到我的反应应用程序
- javascript - 加载表后调用外部 JavaScript
- python - 在 Python 中将 JSON 结构重新排列为数据框