gpt-2 icon indicating copy to clipboard operation
gpt-2 copied to clipboard

Modifying to work for tensorflow 2.0

Open DAMO238 opened this issue 5 years ago • 4 comments

Since I am running Arch, it is an absolute pain to deal with older versions of software. Therefore, I want to update this to tensorflow 2.0. The biggest problem is in the model.py script, since it relies on tensorflow.contrib which no longer exists (even in tensorflow.compat.v1). How can I easily modify this script to make this work with the latest and greatest tensorflow?

DAMO238 avatar Feb 20 '20 19:02 DAMO238

Having same issue with tensorflow.contrib. Running TF 2.1 on Debian (Raspbian) Buster. I hope this can be addressed soon.

DaveXanatos avatar Feb 20 '20 19:02 DaveXanatos

Hi All,

Plz take a look at lib in your implement in section TFGPT2Model: https://huggingface.co/transformers/v2.0.0/model_doc/gpt2.html

And consider upgrade TF: https://www.tensorflow.org/guide/upgrade

On Fri, Feb 21, 2020, 02:57 Dave Xanatos [email protected] wrote:

Having same issue with tensorflow.contrib. Running TF 2.1 on Debian (Raspbian) Buster. I hope this can be addressed soon.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openai/gpt-2/issues/231?email_source=notifications&email_token=AEYAMLZZALQG5HF3VYLOLMLRD3OB3A5CNFSM4KYVERL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMP3AUA#issuecomment-589279312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYAMLZ4OPDSPGIOKMDPNJLRD3OB3ANCNFSM4KYVERLQ .

IveJ avatar Feb 21 '20 07:02 IveJ

Has someone found any way to run this in TF 2.2?

shivangkhajuria avatar Jul 10 '20 05:07 shivangkhajuria

There is no need to worry about the whole tensorflow.contrib module. In this project only the HParams class is used from tensorflow.contrib.training (import in model.py).

What I have found (https://github.com/tensorflow/community/issues/148) is that the original class can be replaced with a nice fork. Saving hparam.py in src folder and replacing import with

from hparam import HParams

solves the original problem.

UPD: A pull request https://github.com/openai/gpt-2/pull/262 just appeared that will close this issue.

mikolasan avatar Aug 23 '20 05:08 mikolasan