Menu

1 / 3

Building GPT-2 (124M) in PyTorch: weight parity, a speed ladder and about 150 GPU-minutes of my own training

DEV Community: pytorch·Muhammed Enes Duran·9 days ago
#DAGZaQFL
#devtopytorch#devto#dev#model#week
Long article (2888 words) — no AI summary yet.
Reading 0:00
15s threshold

"I implemented GPT-2" can mean three very different things. You can load OpenAI's weights into your own code and show it computes the same function. You can make the training loop fast. Or you can start from random weights and train a model that actually learns something. All three happened in my repository neuron-to-gpt , my weekly submissions for a 12-week AI program that went from a single neuron to GPT-2. Keeping their numbers apart turned out to be harder than producing them.

The GPT-2 weeks follow the outline of Andrej Karpathy's "Let's reproduce GPT-2 (124M)" lecture, so the model itself will look familiar.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.