Denoising Diffusion PyTorch

Denoising Diffusion PyTorch

โ˜… 4.2 ๐Ÿ”– 4000 saves ๐Ÿ’ฐ Free GitHub

Denoising Diffusion PyTorch is a clean, readable PyTorch implementation of Denoising Diffusion Probabilistic Models (DDPM), the technique that kicked off the modern wave of diffusion-based image generation. Maintained by Phil Wang (lucidrains), it has gathered over 10,000 stars on GitHub and remains one of the most forked and studied diffusion codebases in the open-source community, with the repository still actively updated in 2026.

Overview

The library implements the full DDPM pipeline described in the original paper by Ho et al.: a forward process that gradually adds Gaussian noise to an image, and a learned reverse process that removes it step by step to synthesize new samples. It uses denoising score matching to estimate the gradient of the data distribution, followed by Langevin-style sampling to draw images from the learned distribution. The code is intentionally compact and hackable, which is why it shows up in so many research projects, course assignments, and follow-up papers. It supports both unconditional generation and classifier-free guidance setups, and the training loop can be pointed at your own image dataset with minimal ceremony. Because the implementation follows the math closely instead of hiding it behind abstractions, it doubles as executable documentation for how diffusion models really work.

Key Features

  • Complete DDPM training and sampling implementation in modern PyTorch
  • Denoising score matching with Langevin dynamics sampling
  • U-Net denoiser with attention and configurable depth, channels, and timesteps
  • Support for continuous-time and improved diffusion variants explored by the community
  • Training helpers with EMA, mixed precision, and checkpointing
  • Small, readable codebase designed to be read, forked, and extended
  • MIT licensed, so it can be used freely in research and commercial work

๐Ÿ’ณ Pricing

Free. Denoising Diffusion PyTorch is fully open source under the MIT license โ€” install it from PyPI or clone the GitHub repository and there is nothing to pay, no hosted tier, and no usage limits.

Who Is It For

Researchers, students, and ML engineers who want to understand diffusion models from the inside, prototype new generative-model ideas, or need a dependable DDPM baseline for experiments rather than a black-box image-generation service.

๐Ÿš€ Visit Denoising Diffusion PyTorch Official Site

๐Ÿšฉ Report an issue