1. Blog/

Vision Transformers, one piece at a time: an interactive lesson

I prepared an interactive lesson on Vision Transformers for a hands-on lab. It follows one pizza ๐Ÿ• through the whole model: patches, the linear projection, the [CLS] token, positional embeddings, multi-head attention, LayerNorm and the MLP head. It ends with Masked Autoencoders, the topic of the lab.

Everything runs in the browser, with no installation.

  • ๐Ÿ“š The lesson: </res/vit-lesson/>
  • ๐ŸŽฎ Patch Quest, a pixel-art game where you are Imma, the image, walking through the ViT: </res/vit-lesson/game/>
  • ๐Ÿงฉ Build Multi-Head Attention, one line at a time (pick the right operation and the line writes itself): </res/vit-lesson/build-mha.html>
  • ๐Ÿงช The lab (Google Colab): https://tinyurl.com/mae-tutorial-unibz

ViT in a nutshell (60 s)

Untrained toy weights: the class scores in the film are illustrative.