我目前正在尝试使用tensorflow运行一个聊天机器人。 聊天机器人的示例来自此存储库: Github
当我尝试在tensorflow docker容器中运行它时遇到了一些问题。 启动脚本时,脚本退出并出现“属性错误”。
Traceback (most recent call last):
File "chatbot.py", line 5, in <module>
import tensorlayer as tl
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/__init__.py", line 47, in <module>
from tensorlayer import initializers
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/initializers.py", line 7, in <module>
from tensorlayer.layers.core import LayersConfig
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/__init__.py", line 12, in <module>
from .activation import *
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/activation.py", line 6, in <module>
from tensorlayer.layers.core import Layer
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/core.py", line 39, in <module>
TF_GRAPHKEYS_VARIABLES = tf.GraphKeys.GLOBAL_VARIABLES
AttributeError: 'module' object has no attribute 'GraphKeys'
我正在使用以下版本:
tensorflow 2.0.0a0
tensorlayer 1.11.1
也许你们中有些人已经遇到了类似的问题,并且知道我该如何解决这个问题。
答案 0 :(得分:1)
我使用pip install tensorflow==1.13.2
答案 1 :(得分:0)
也许tl不匹配tf,您需要将您的张量层更新为2.0+。您可以使用此指令:
pip3 install https://github.com/tensorlayer/tensorlayer/archive/master.zip