Open zwx8981 opened 2 years ago
hey there i ran into the problem today, when I was trying to use code connecting to gpt-2 that worked fine a month ago, and i got here from looking up this problem and seeing your post in solveforums as the only thing that references the problem that i could find. It's crazy that this update to tensor flow that happened on february 2 makes everyone trying to connect to gpt-2 have to change their code, and there's literally no resources online anywhere i could find that could help fix it, not even from open source ai instructing you how to use gpt-2. This update that released the newest version of tensorflow literally messes with my pip install tensorflow==1.15 and makes my code trying to install an older version that worked fine a month ago no longer work.
not sure if this is the best way to do it, but this is the way i got it to work, so i'm not messing with it regardless of how unoptimized this is. I was using google colab for this:
!pip install tensorflow==2.6 # (then restart run time in google colab) from tensorflow.python.profiler import trace !pip install tensorflow==1.15 #(this basically tricks tensorflow to get traceback from tensorflow2.6, but keeps the tensorflow.contrib from 1.15) # (then restart run time in google colab) !pip install gpt2-client #(this messes with some files in tensorflow, but required tensorflow in order to install, so you need to do all the nonsense above to reinstall tensor flow again) # (then restart run time in google colab) !pip install tensorflow==2.6 # (then restart run time in google colab) from tensorflow.python.profiler import trace !pip install tensorflow==1.15 # (then restart run time in google colab)
hope this helps!
For people who are looking for a solution to this. After doing some digging, legacy_seq2seq
is an old tensorflow code that is only available on the v1.x. If you wanna run it in v2, you would need to migrate plenty of the code in this repo. For example, legacy_seq2seq
is on the tensorflow_addons which is named seq2seq. And the respective models available on the module should be used.
If you wanna downgrade according to the requirement.txt for tensorflow, you would need python <= 3.6 for it to work.
python main.py --lip_model_path models/lrs2_lip_model 2022-02-16 17:28:19.165150: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0 Traceback (most recent call last): File "main.py", line 13, in
from language_model.char_rnn_lm import CharRnnLmWrapperSingleton
File "/home/redpanda/codebase/deep_lip_reading-dependabot-pip-tensorflow-gpu-2.5.3/language_model/char_rnn_lm.py", line 27, in
from tensorflow.contrib import legacy_seq2seq
ModuleNotFoundError: No module named 'tensorflow.contrib'
It seems that this module has been removed from Tensorflow2.5.3.