【问题标题】:Getting error "AttributeError: module 'tensorflow' has no attribute 'contrib'"收到错误“AttributeError:模块'tensorflow'没有属性'contrib'”
【发布时间】:2020-05-27 05:03:24
【问题描述】:

我正在尝试在 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>

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

【问题讨论】:

  • 你用的是什么版本的tensorflow?
  • 这里有很多of potential duplicates
  • 我使用的是最后一个 tensorflow 版本

标签: python tensorflow flask magenta google-music


【解决方案1】:

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

【讨论】:

  • 我已经尝试过了,但是给了我这个错误,而且 0.12.1 也不起作用 C:\Users\Luis\Desktop\magenta\aiexperiments-ai-duet>pip install tensorflow==1.15 错误:找不到满足要求 tensorflow==1.15 的版本(来自版本:2.2.0rc1、2.2.0rc2、2.2.0rc3、2.2.0rc4、2.2.0) 错误:没有找到 tensorflow==1.15 的匹配分布跨度>
  • 您使用的是哪个 python 版本?据此(stackoverflow.com/questions/54386222/…),0.12.1 仅适用于 python3.5;
猜你喜欢
  • 2021-06-23
  • 2022-11-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-17
  • 2020-03-17
  • 2019-09-16
  • 1970-01-01
相关资源
最近更新 更多