出现错误“ AttributeError:模块'tensorflow'没有属性'contrib'”

时间:2020-05-27 05:03:24

标签: python tensorflow flask magenta google-music

我正在尝试在Windows 10中安装AI Duet,我已经安装了所有要求(TensorFlow,Magenta,Flask,Gunicorn和iPython),我正在执行python server.py,但不起作用。

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

这是错误:

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>

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

1 个答案:

答案 0 :(得分:0)

tensorflow 2.0似乎没有contrib属性。确保您安装的版本与指定的版本相同(根据here,我认为是0.12.1吗?)