If you want much more detailed documentation, I wrote up in detail how to train & generate text with the original GPT-2 models using nshepperd's codebase: https://www.gwern.net/GPT-2
minimaxr also has a actively maintained codebase which I believe has powered some of the GPT-2 projects you might've seen recently like Talk to Transformer: https://github.com/minimaxir/gpt-2-simple