我正在尝试使用GPT-2进行文本生成。即使运行了Tensorflow 2.0的代码升级脚本code upgrade script,我仍然遇到兼容性错误。
我所采取的步骤:
似乎没有将gpt-2直接翻译为Tensorflow 2.0的方法。有人知道如何在Tensorflow 2.0中让gpt-2工作吗?
我的GPU是NVIDIA 20xx。
谢谢。
我所采取的步骤:
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'```
model.py
中,参数被实例化如下:def default_hparams():
return HParams(
n_vocab=0,
n_ctx=1024,
n_embd=768,
n_head=12,
n_layer=12,
)
似乎没有将gpt-2直接翻译为Tensorflow 2.0的方法。有人知道如何在Tensorflow 2.0中让gpt-2工作吗?
我的GPU是NVIDIA 20xx。
谢谢。
AttributeError: 'HParams' object has no attribute 'encoder_type'
的错误。 - undefined