diff --git a/README.md b/README.md index 4a66317..e27662c 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,19 @@ Thou hast no right, no right, but to be sold. Whoa there, GPT, entering some dark place over there. I didn't really tune the hyperparameters in the config too much, feel free to try! +## sampling / inference + +Use the script `sample.py` to sample either from pre-trained GPT-2 models released by OpenAI, or from a model you trained yourself. For example, here is a way to sample from the largest available `gpt2-xl` model: + +``` +$ python sample.py \ + --init_from=gpt2-xl \ + --start="What is the answer to life, the universe, and everything?" \ + --num_samples=5 --max_new_tokens=100 +``` + +If you'd like to sample from a model you trained, use the `--out_dir` to point the code appropriately. You can also prompt the model with some text from a file, e.g. `$ python sample.py --start=FILE:prompt.txt`. + ## efficiency notes For simple model benchmarking and profiling, `bench.py` might be useful. It's identical to what happens in the meat of the training loop of `train.py`, but omits much of the other complexities.