I am trying to use gpt-2 for text generation. I get compatibility errors, even after running the Tensorflow 2.0 code upgrade script.
Steps I've followed:
Clone repo
From here on out, follow the directions in DEVELOPERS.md
Run upgrade script on files in /src
In terminal run:
sudo docker build --tag gpt-2 -f Dockerfile.gpu .
After building is done, run:
sudo docker run --runtime=nvidia -it gpt-2 bash
Enter
python3 src/generate_unconditional_samples.py | tee /tmp/samples
Get this traceback:
Traceback (most recent call last): File "src/generate_unconditional_samples.py", line 9, in <module> import model, sample, encoder File "/gpt-2/src/model.py", line 4, in <module> from tensorboard.plugins.hparams.api import HParam ImportError: No module named 'tensorboard.plugins.hparams' root@f8bdde043f91:/gpt-2# python3 src/generate_unconditional_samples.py | tee /tmp/samples Traceback (most recent call last): File "src/generate_unconditional_samples.py", line 9, in <module> import model, sample, encoder File "/gpt-2/src/model.py", line 4, in <module> from tensorboard.plugins.hparams.api import HParam ImportError: No module named 'tensorboard.plugins.hparams'```
It appears that HParams has been deprecated and the new version in Tensorflow 2.0 is called HParam. However, the parameters are different. In model.py
, the params are instantiated as follows:
def default_hparams():
return HParams(
n_vocab=0,
n_ctx=1024,
n_embd=768,
n_head=12,
n_layer=12,
)
There doesn't appear to be any 1:1 translation into Tensorflow 2.0. Does anyone know how to make gpt-2 work with Tensorflow 2.0?
My GPU is an NVIDIA 20xx.
Thank you.