Skip to content

Tutorials

Each tutorial is a Jupyter notebook in the repository’s tutorials/ folder. The pages here show each notebook with the outputs of its last complete run. The first code cell of every notebook installs Dew from GitHub, and the top of the notebook names the hardware it needs; the Colab link opens it ready to run.

Notebooks 01 to 04 cover image diffusion and build on each other: 04 samples from the checkpoint 02 trains. The others stand alone. The Quickstart introduces the objects every notebook uses and runs on a CPU in seconds.

01GPUBasics of Diffusion based generative models from ScratchPlease bear with me at times and read through the entire notebook thoroughly.02GPUTrain a diffusion model with DewThis is part 2 of the series, and so I would strongly recommend going through Notebook 01 first.03GPUText to image with classifier-free guidanceThis is part 3 of the series, and it builds directly on notebook 02, so I would recommend going through that one first.04GPUSamplers and schedulesA trained diffusion model only tells us, for a noisy image, what it thinks the clean image is.05GPUTrain a language modelSo far we have only generated images. But the same Trainer trains language models too, and in this notebook we shall train a small decoder-only transformer on FineWeb-Edu, a large collection of…06GPULearn image representations with I-JEPAWe train an encoder whose only product is a vector for each image, and the goal is that similar images get similar vectors.07CPUScale one training run across many devicesWhen I trained text-to-image models from scratch with FlaxDiff, Dew's predecessor, it was on 128 TPU v4 chips.08GPULoad a pretrained decoder and keep training itIn notebook 05 we trained a language model from random weights. But most of the time, you would start from a model someone else already trained, on far more data than we have.09GPUSFT for LLMsSupervised fine-tuning (SFT) trains a language model on examples of the replies we want.10GPUReinforcement learning with verifiable rewardsSupervised fine-tuning is easy to explain: show the model the right answer and make that answer more likely. But for a lot of the problems we care about, nobody has written the right answer down.11GPULLMs in an agent harness for long-horizon tasksAn agent is a language model that works over many turns. It writes something, a tool runs it, the tool's answer comes back as text, and the model writes again.12GPUWorld models: acting and imagining in one loopAn environment in Dew is two pure functions over a pytree: reset(key) starts an episode and step(state, action) advances it, each answering a TimeStep.14GPUA racing drone that flies from its cameraA first-person racing drone sees the world through one wide camera and flies by commanding a collective thrust and three body rates.