Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems trying to build gpt-2 #329

Open
ulsbai opened this issue Nov 24, 2023 · 1 comment
Open

Problems trying to build gpt-2 #329

ulsbai opened this issue Nov 24, 2023 · 1 comment

Comments

@ulsbai
Copy link

ulsbai commented Nov 24, 2023

Hi,

I am trying to build gpt-2 on Ubuntu 22.04.2.

I git cloned this repository. In DEVELOPERS.md, it says that you have to pip install tensorflow==1.12.0. When I try to install tensorflow==1.12.0, it makes an error:

ERROR: Could not find a version that satisfies the requirement tensorflow==1.12.0 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0, 2.12.1, 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0)
ERROR: No matching distribution found for tensorflow==1.12.0

I tried omitting the ==1.12.0 and it successfully installed a newer version of tensorflow, but if I use the new tensorflow, when I try to run the model, it makes an error:

env/bin/python src/interactive_conditional_samples.py --top_k 40
2023-11-24 17:24:15.771054: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2023-11-24 17:24:16.687450: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2023-11-24 17:24:16.687553: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2023-11-24 17:24:16.885832: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-11-24 17:24:17.264367: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2023-11-24 17:24:17.267425: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-11-24 17:24:19.771254: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "/home/ubuntu/gpt-2/src/interactive_conditional_samples.py", line 9, in
import model, sample, encoder
File "/home/ubuntu/gpt-2/src/model.py", line 3, in
from tensorflow.contrib.training import HParams
ModuleNotFoundError: No module named 'tensorflow.contrib'

In this stackoverflow article:
https://stackoverflow.com/questions/55082483/why-can-i-not-import-tensorflow-contrib-i-get-an-error-of-no-module-named-tenso
someone says that tensorflow.contrib no longer exists in tensorflow 2.0.x and its modules were moved. Perhaps there is a way to get the modules from wherever they were moved?

Any help on building gpt-2 would be appreciated!

@ulsbai
Copy link
Author

ulsbai commented Dec 6, 2023

Hi,

I discovered a solution to to the problem.

alexis779 forked gpt-2 and updated it to work with tensorflow 2. His repository is at the following link:
https://github.com/alexis779/gpt-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant