首页 > 解决方案 > 出现错误“AttributeError:模块'tensorflow'没有属性'contrib'”

问题描述

我正在尝试在 Windows 10 中安装 ai Duet,我已经安装了所有要求(TensorFlow、Magenta、Flask、Gunicorn 和 iPython),我正在做 python server.py 但不工作。

我已经在互联网上寻找解决方案,但它们不起作用,我在 events_rnn_graph.py 中遇到问题,因为 contrib 被多次使用。是为了大学作业。

这是错误:

C:\Users\Luis\Desktop\magenta\aiexperiments-ai-duet\server>python server.py
2020-05-27 01:47:20.875736: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-27 01:47:20.879432: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "server.py", line 17, in <module>
    from predict import generate_midi
  File "C:\Users\Luis\Desktop\magenta\aiexperiments-ai-duet\server\predict.py", line 20, in <module>
    from magenta.models.melody_rnn import melody_rnn_config_flags
  File "C:\Python38\lib\site-packages\magenta\models\melody_rnn\__init__.py", line 37, in <module>
    from magenta.models.shared import events_rnn_model
  File "C:\Python38\lib\site-packages\magenta\models\shared\events_rnn_model.py", line 28, in <module>
    from magenta.models.shared import events_rnn_graph
  File "C:\Python38\lib\site-packages\magenta\models\shared\events_rnn_graph.py", line 31, in <module>
    base_cell=tf.contrib.rnn.BasicLSTMCell):
AttributeError: module 'tensorflow' has no attribute 'contrib'

C:\Users\Luis\Desktop\magenta\aiexperiments-ai-duet\server>

我发现安装钢琴二重奏非常困难

标签: pythontensorflowflaskmagentagoogle-music

解决方案


tensorflow 2.0 似乎没有contrib属性。确保安装与指定的 repo 相同的版本(我认为是 0.12.1?根据这里


推荐阅读