Technical AIadvancedVideo + quiz

Build a GPT from Scratch: Attention, Transformers and Text Generation in PyTorch

Build a small GPT yourself and understand how text generators work.

16 lessons · 1.1 hours
Watch the first lesson freeWelcome: a story-writing GPT for Pennyrigg Loop · 3 min

Sign in to watch one lesson from this course free.

What you will be able to do

Implement causal self-attention and a transformer block in PyTorchPrepare a licensed text corpus and train a small GPT on a laptop CPUGenerate text with temperature, top-k and top-p, and explain what each changesMeasure mixed precision and torch.compile, and run training on a free GPU

About this course

Build a small GPT yourself and understand how text generators work. You learn embeddings, why sequence models struggle with long-range memory, self-attention with its causal mask, and the transformer block; then prepare a licensed text corpus, train a small GPT on TinyStories, sample from it with temperature, top-k and top-p, speed training up with mixed precision and torch.compile, and run it on a free GPU. The lab trains and reports on your own GPT. Course 7 of the Zero to ML Engineer path.

Technical AI

Curriculum

4 modules · 16 lessons · 1.1h

Requirements

PyTorch modules and a training loop
AdamW, warm-up and cross-entropy
Python 3.14 and PyTorch 2.15 via uv

What you walk away with

A Yallo AI Academy certificate of completion, issued when every lesson is complete and the final assessment is passed at 70% or aboveA public verification page, so a stranger can check the certificate without asking you for a filePDF download, and a one-click share to your LinkedIn profile

Yallo AI Academy certifies completion of

Build a GPT from Scratch: Attention, Transformers and Text Generation in PyTorch