【问题标题】:Is gpt-2 unusable with python?gpt-2 不能与 python 一起使用吗?
【发布时间】: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
  • 请在此处查看答案:stackoverflow.com/a/64547620/13105088

标签: python tensorflow gpt-2


【解决方案1】:

试试这个:

pip install tensorflow-gpu==1.15.0
pip install 'tensorflow-estimator<1.15.0rc0,>=1.14.0rc0' --force-reinstall

【讨论】:

    猜你喜欢
    • 2020-10-21
    • 2011-10-26
    • 2011-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 2015-11-22
    相关资源
    最近更新 更多