#113 · Primary category: Foundation Models

gpt-2-Pytorch

gpt-2 gpt2 implementation natural-language-processing nlp pytorch story-telling text-generator

Simple Text-Generator with OpenAI gpt-2 Pytorch Implementation

Project last updated:07/08/19

GitHub Stars

1.0K

Forks

230

Contributors

2

License

MIT

Why we included this project

This compact PyTorch rewrite of GPT-2 keeps the model small enough to read end to end. Where OpenAI's reference implementation carries a lot of infrastructure, this one pares it down to the self-attention stack and the text-generation loop, so you can watch a token move from input through the layers to the sampled next word. That makes it a good study tool for researchers or students who already know PyTorch and want to see how a transformer actually produces text, rather than a service you'd deploy in production. It also shows how to load the pretrained GPT-2 weights into PyTorch, which helps if you want to experiment outside the TensorFlow ecosystem. Pair it with the GPT-2 paper and the larger Hugging Face codebase for context.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category