#329·gpt-2

尝试构建 gpt-2 时报错

作者: ulsbai创建于 2023年11月24日更新于 2025年1月28日

Hi, I am trying to build gpt-2 on Ubuntu 22.04.2. I 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 <module> import model, sample, encoder File "/home/ubuntu/gpt-2/src/model.py", line 3, in <module> 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