【发布时间】:2020-10-03 08:11:18
【问题描述】:
我正在关注this 教程,在使用 train.py 时遇到了一个问题。问题说
Exception has occurred: ModuleNotFoundError
No module named 'tensorflow.contrib'
File "F:\PythonFiles\Post Generator\gpt-2\src\model.py", line 3, in <module>
from tensorflow.contrib.training import HParams
我在互联网上进行了很多搜索,结果发现 tensorflow.contrib 已被弃用。那么有没有其他方法可以做到这一点,或者 gpt-2 不能与 python 一起使用?
我也试过
pip install tensorflow==1.15
ERROR: Could not find a version that satisfies the requirement tensorflow==1.15 (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0)
ERROR: No matching distribution found for tensorflow==1.15
【问题讨论】:
-
tensorflow.contrib在 Tensorflow 2.x 中已弃用。所以,我认为pip install tensorflow==1.15应该可以解决这个问题。我不知道它是如何向您返回错误的。请告诉我pip install tensorflow==的结果好吗? -
你需要更新你的 pip 版本...使用
pip install -U pip
标签: python tensorflow gpt-2