affjljoo3581/GPT2

Confusions on Usage

Closed this issue · 3 comments

Hi! I'm new to gpt2 and also this project. Thanks for sharing this awesome project! I got problems when I want to run the code following the usage section.

After preparing datasets, you can train GPT-2 by using as follows:
$ python -m gpt2 train --train_corpus build/corpus.train.txt \ ...

Here you use gpt2 as a python module which is not metioned in previous usage section. I want to know what I can do to run this code and pretrain the gpt2 model. Looking forward to your reply!

You should run gpt2 with python -m. Make sure PYTHONPATH contains the path of gpt2 package (i.e. GPT2/src) so python can import gpt2 module.

$ export PYTHONPATH=GPT2/src
$ python -m gpt2 train ...

Thanks! After some installation I made it but another error occured.
python -m gpt2 train --train_corpus build/corpus.train.txt --eval_corpus build/corpus.test.txt --vocab_path build/vocab.txt --save_checkpoint_path ckpt.pth --batch_train 128 --batch_eval 128 --seq_len 64 --iterations 1000000 --warmup_iters 10000 --eval_iters 500 --save_iters 5000

usage: gpt2 [-h] {train,evaluate,generate,visualize} ...
gpt2: error: unrecognized arguments: --iterations 1000000 --warmup_iters 10000 --eval_iters 500 --save_iters 5000

Check out the updated training example in README.md.