true_poetry
true_poetry copied to clipboard
Indicated download isn't adequate to run true_poetry
After running
rsync --verbose rsync://78.46.86.149:873/biggan/2019-12-13-gwern-gpt-2-1.5b-poetry-model-500522.tar.xz ./
And extracting into directory "poetry", true_poetry.py throws an error that there is there is no config.json file.
Sorry! I've added all the extra files into a subfolder called "poetry." There might be a couple of extra ones in there, only needed for using the tensorflow model.
Hmm, true_poetry.py now throws the error:
Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory poetry or
from_tf
set to False
The pertinent rsync downloaded file is "model-500522.data-00000-of-00001". Seems there needs to be a conversion?
I just got the information about how to do the conversion.
The file you have there is for tensorflow. T0 convert it for pytorch, try the following:
%env OPENAI_GPT2_CHECKPOINT_PATH=/content/true_poetry/gwern
!transformers-cli convert --model_type gpt2 --tf_checkpoint model-500522 --config /content/true_poetry/gwern/config.json --pytorch_dump_output /
On Tue, May 12, 2020 at 3:46 PM exo-pla-net [email protected] wrote:
Hmm, true_poetry.py now throws the error:
Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory poetry or from_tf set to False
The pertinent rsync downloaded file is "model-500522.data-00000-of-00001". Seems there needs to be a conversion?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/summerstay/true_poetry/issues/2#issuecomment-627554781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3NRIRWFVGBMVSGO5FQ3O3RRGRTDANCNFSM4M6LINQA .
Thanks for the pointers -- I got it running!
For posterity, here are the steps I took:
Clone repo:
git clone https://github.com/summerstay/true_poetry
Install the requirements:
- Inside repo directory, create requirements.txt with contents:
torch
transformers
tensorflow
- Enter a python virtual environment. Then install:
pip install -r requirements.txt
Download the model:
- Navigate to "poetry" directory.
- Download (will take a while):
rsync --progress rsync://78.46.86.149:873/biggan/2019-12-13-gwern-gpt-2-1.5b-poetry-model-500522.tar.xz ./
Convert the model:
- In "poetry" directory, run:
sudo transformers-cli convert --model_type gpt2 --tf_checkpoint model-500522 --config config.json --pytorch_dump_output /
- It should spit out a "pytorch_model.bin" and a "config.json".
- It might spit them out in a strange place, like the base directory of "Macintosh HD". Move them to the "poetry" folder.
Run true_poetry!
python true_poetry.py
True poetry we together create,
and then we read the poems, we
discuss the poems, then
we talk. And we are in our own
poetic worlds again.
And I have to confess, it makes
my blood to see the way
you hold the world in such esteem.
Great! Thanks for the detailed writeup, I'm sure it will help others.
Hi,
I used the steps of exo-pla-net to get true_poetry running. At least, to a certain point. The rhymes and model loaded successful. After inserting text at the starting prompt I receive an error:
python true_poetry.py
rhymes loaded
model loaded
starting prompt: Some text
Traceback (most recent call last):
File "true_poetry.py", line 526, in <module>
(probs, past) = expand_node(prompt, None)
File "true_poetry.py", line 380, in expand_node
logits, past = model(**inputs, past=past)
File "/venv/gpt-2/truePoetryMaster/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument 'past'
Is it something I did wrong, can someone help me get it working? I did an extensive search online, but cannot get my head around it. I tried to look for a solution in the torch module, but until so far, I do not understand what is going wrong and get it to work. Thanks!
@exo-pla-net, thanks for the clear description!
It looks like you are using a newer version of huggingface transformers than this was written for. I found this comment:
"It is a known issue. Huggingface transformers 4.0 has a breaking change: past becomes past_key_values in GPT-2 models. You can use transformers 3.* to walk around or wait for our fix that is coming soon."
So try renaming "past" to past_key_values and see if that fixes it.
I have updated the program to work with the Huggingface 4.0.
Hi, I'm trying to convert my own pre-trained model but I don't have a config.json file in my model folder. How do I make one? Thank you.