Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/warner-benjamin/commented-transformers

Highly commented implementations of Transformers in PyTorch
https://github.com/warner-benjamin/commented-transformers

bert gpt pytorch transformers

Last synced: 4 months ago
JSON representation

Highly commented implementations of Transformers in PyTorch

Awesome Lists containing this project

README

        

# Commented Transformers

Highly commented implementations of Transformers in PyTorch for *Creating a Transformer From Scratch* series:

1. [The Attention Mechanism](https://benjaminwarner.dev/2023/07/01/attention-mechanism.html)
2. [The Rest of the Transformer](https://benjaminwarner.dev/2023/07/28/rest-of-the-transformer.html)

The layers folder contains implementations for Bidirectional Attention, Causal Attention, and CausalCrossAttention.

The models folder contains single file implementations for GPT-2 and BERT. Both models are compatible with `torch.compile(..., fullgraph=True)`.