0

I am trying to run Gpt2 on my machine, i am following this guide : https://lambdalabs.com/blog/run-openais-new-gpt-2-text-generator-code-with-your-gpu/

I created a new environment on Conda to make sure it would be isolated and all, and downloaded the correct versions of the libs.

My environment is :

Windows 10 Python 3.6 tensorflow-gpu 1.12 (installed with pip) CUDA v9, v10, v11 cuDNN for v9 and for v11 (i first installe dht elatest, but then i was told tensorflow was only happy with version 9 so i installed it)

Whenever i try to import tensorflow, either with from tensorflow import * or import tensorflow as tf

I get :

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.

This error isn't helping at all, and i'm stuck there. Any ideas ?

Thank you.

EDIT :

For those running in the same problem, follow the github link, install everything with conda. I also ran into this problem : Tensorflow has no Attribute "sort" in GPT 2 Git Release? that was solved as well by udating tensorflow. Thanks everyone

Orsu
  • 405
  • 6
  • 19

1 Answers1

1

Please try to install tensorflow with conda with below command.

conda install -c conda-forge tensorflow   //tensorflow package

or for specific version

conda install -c conda-forge tensorflow=1.13.1
  • correct. installing with conda was the correct way (?). Bu ti must add that @HùngNguyễn 's link was also very helpful – Orsu Sep 03 '20 at 08:33