The Annotated Transformer
transformerspytorchteachingattention
Abstraction: Line-by-line runnable PyTorch implementation of Attention Is All You Need
Key points:
- Harvard NLP's 2022 rewrite of the 2018 post: the paper text reordered and interleaved with working code.
- Builds encoder-decoder, multi-head attention, positional encoding, label smoothing and the warmup learning-rate schedule.
- Ends with training on a German-English translation task, so every component is shown running, not just described.
- Companion to the older 2018 URL already in the base; this is the maintained version.
Connections: Transformers · Attention Mechanism · Self Attention · Harvard NLP