Architect8999's picture
feat: integrate Galaxy bugbounty checklist, clientside resources, paper2code
256c9c2 verified
|
Raw
History Blame Contribute Delete
2.85 kB

Denoising Diffusion Probabilistic Models (DDPM)

Implementation of Denoising Diffusion Probabilistic Models (Ho, Jain, Abbeel, 2020).

What this implements

The DDPM training and sampling procedure β€” a class of generative models that learn to reverse a gradual noising process. The core contribution is the training objective (simplified variational bound) and the reverse sampling algorithm, NOT the U-Net architecture (which is adapted from prior work). This implementation covers the forward diffusion process, the simplified training objective (L_simple), the noise schedule, and the reverse sampling algorithm from Algorithm 1 and Algorithm 2.

Quick start

pip install -r requirements.txt
from src.model import UNet, UNetConfig
from src.loss import DDPMLoss
from src.utils import linear_noise_schedule

config = UNetConfig()
model = UNet(config)
noise_schedule = linear_noise_schedule(timesteps=1000)

# Example: predict noise from noisy image at timestep t
import torch
x_t = torch.randn(2, 3, 32, 32)    # noisy image
t = torch.randint(0, 1000, (2,))    # timesteps
predicted_noise = model(x_t, t)
print(predicted_noise.shape)  # (2, 3, 32, 32)

File structure

ddpm/
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ REPRODUCTION_NOTES.md     # Ambiguity audit β€” what's specified vs. assumed
β”œβ”€β”€ requirements.txt          # Dependencies
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ model.py              # U-Net noise prediction network (Β§3.3, Appendix B)
β”‚   β”œβ”€β”€ loss.py               # DDPM simplified loss L_simple (Β§3.4, Eq. 14)
β”‚   β”œβ”€β”€ data.py               # Dataset skeleton for image data
β”‚   β”œβ”€β”€ train.py              # Training loop β€” Algorithm 1
β”‚   β”œβ”€β”€ evaluate.py           # FID score computation
β”‚   └── utils.py              # Noise schedule, forward process, sampling (Algorithm 2)
β”œβ”€β”€ configs/
β”‚   └── base.yaml             # All hyperparameters from Β§4 and Appendix B
└── notebooks/
    └── walkthrough.ipynb     # Paper sections β†’ code β†’ sanity checks

Important: Read REPRODUCTION_NOTES.md

This implementation flags every choice that the paper does not specify. Before using this code for research, read REPRODUCTION_NOTES.md to understand which implementation details are from the paper and which are our choices.

Citation

@article{ho2020denoising,
  title={Denoising diffusion probabilistic models},
  author={Ho, Jonathan and Jain, Ajay and Abbeel, Pieter},
  journal={Advances in neural information processing systems},
  volume={33},
  pages={6840--6851},
  year={2020}
}

Generated by paper2code β€” citation-anchored paper implementation.