lucidrains/denoising-diffusion-pytorch

Implementation of Denoising Diffusion Probabilistic Model in Pytorch

What it solves

This project provides a PyTorch implementation of Denoising Diffusion Probabilistic Models (DDPM), a generative modeling approach designed to rival GANs by learning to reverse a noise-addition process to generate high-quality data samples.

How it works

The system uses denoising score matching to estimate the gradient of the data distribution and employs Langevin sampling to generate samples from the true distribution. It features a U-Net architecture for the denoising process and supports both 2D image generation and 1D sequence generation.

Who it’s for

It is intended for researchers and developers working with generative AI, specifically those looking for a flexible PyTorch-based implementation of diffusion models for images or sequences.

Highlights

  • Dual Modality Support: Includes implementations for both 2D images (GaussianDiffusion) and 1D sequences (GaussianDiffusion1D).
  • Simplified Training: Provides a Trainer class to handle training loops, logging, and checkpointing from a folder of images.
  • Advanced Training Techniques: Supports mixed precision (AMP), exponential moving average (EMA) decay, and multi-GPU training via Hugging Face Accelerator.
  • Explorative Modeling: Includes an XMWrapper for multi-candidate loss calculation during training.
  • Efficiency: Integrates Flash Attention for faster and more memory-efficient processing.

Related

  • Dispatch
  • Project
  • Project
  • Project
  • Project