// the find
lucidrains/denoising-diffusion-pytorch
Implementation of Denoising Diffusion Probabilistic Model in Pytorch
Phil Wang's (lucidrains) PyTorch implementation of DDPM, the 2020 NeurIPS paper that kicked off the modern diffusion model wave. It has grown well beyond the original paper, accumulating DDIM sampling, classifier-free guidance, Karras U-Net variants, 1D sequence diffusion, and a pile of noise schedule improvements. It's the reference implementation most people link to when explaining how diffusion models work.
The API surface is genuinely minimal — you can have a training loop running in under 20 lines. The Trainer class handles gradient accumulation, EMA, mixed precision, FID evaluation, and multi-GPU via Accelerate without you touching any of it. The paper coverage is unusually thorough: DDIM, CFG, DPM-Solver++, Min-SNR weighting, offset noise, and Karras et al.'s improved training dynamics are all present and each cites the relevant paper directly. The 1D variant is a legitimate addition for time-series and audio work, not just a copy-paste rename.
Everything lives in a handful of very large files — denoising_diffusion_pytorch.py is the kind of file where you lose 45 minutes tracing which sampling path is actually running. There are no tests whatsoever; the CI is just a PyPI publish workflow. The repo is image-generation-only at its core, so anyone trying to do latent diffusion, video, or anything beyond pixel-space images will need to swap out the U-Net themselves with no guidance on how. The last meaningful push was early 2026 and the field has moved considerably — flow matching and consistency models are now mainstream, and this repo doesn't touch either.