【发布时间】:2020-12-21 18:55:01
【问题描述】:
我正在尝试在我的机器上运行 Gpt2,我正在遵循本指南:https://lambdalabs.com/blog/run-openais-new-gpt-2-text-generator-code-with-your-gpu/
我在 Conda 上创建了一个新环境,以确保它完全独立,并下载了正确版本的库。
我的环境是:
Windows 10
蟒蛇 3.6
tensorflow-gpu 1.12(安装pip)
CUDA v9、v10、v11
用于 v9 和 v11 的 cuDNN(我首先安装了 dht elatest,但后来我被告知 tensorflow 只对版本 9 感到满意,所以我安装了它)
每当我尝试使用 from tensorflow import * 或 import tensorflow as tf 导入 tensorflow 时
我明白了:
Traceback (most recent call last):
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\theo1\Anaconda3\envs\gpt2\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
这个错误根本没有帮助,我被困在那里。有什么想法吗?
谢谢。
编辑:
对于那些遇到同样问题的人,请点击 github 链接,使用 conda 安装所有内容。我也遇到了这个问题:Tensorflow has no Attribute "sort" in GPT 2 Git Release? 也通过更新 tensorflow 解决了。谢谢大家
【问题讨论】:
-
能否添加 Cuda 和 Cudnn 版本以及如何安装 TensorFlow?
-
@AniketBote 我添加了它。我有 cuda 9、10 和 11 以及版本 9 和 11 的 cuDNN 库
-
尝试使用
conda安装tensorflow,而不是pip。另外,请参考this,您的错误列在列表底部。 -
@HùngNguyễn 哦,天哪,谢谢你,它看起来和我的错误一模一样
标签: python tensorflow