Skip to content

mnjm/diffusion

Repository files navigation

Diffusion

A minimal, hackable repro of Denoising Diffusion Probabilistic Model with parts of Improved DDPM (cosine beta schedule) and Classifier Free Guidance. Model is roughly same UNet used in the paper with Self Attention. Also support classifier free guidance for conditional generation, cosine and linear beta schedules, EMA etc. Experimented with include CIFAR-10, MNIST and Landscapes datasets. Training script uses Hydra for config and (optional) WandB logging. Still work in progress, but good enough to mess around with generative diffusion models.

Generated samples

CIFAR10 with CFG (32x32)

CIFAR10 with CFG

MNIST with CFG (28x28)

MNIST with CFG

Landscapes (32x32)

Generated Landscapes

CIFAR10 (32x32)

Generated CIFAR10

Usage

Install dependencies

pip install -r requirements.txt

CIFAR10 with linear and without CFG

python train.py

Landscapes with linear and without CFG

python train.py +run=landscapes

MNIST with cosine and CFG

python train.py +run=mnist_cfg
  • uses lite version of the model since mnist is 24x24x1

MNIST with cosine and CFG

python train.py +run=cifar10_cfg

Sampling

python sample.py <model checkpoint.pt> -n <number of samples> <--save>

About

Repro of Denoising Diffusion Probabilistic Model

Resources

Stars

Watchers

Forks