Analytic-DPM icon indicating copy to clipboard operation
Analytic-DPM copied to clipboard

Code for the paper Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models (ICLR 2022 Outstanding Paper Award)

Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models

Code for the paper Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models

News (May 18, 2022): We provide an extended codebase (https://github.com/baofff/Extended-Analytic-DPM) for Analytic-DPM:

  • It reproduces all main results, and additionally applies Analytic-DPM to score-based SDE.
  • For easy reproducing, it provides pretrained DPMs converted to a format that can be directly used, as well as running commands and FID statistics.

News (Apr 22, 2022): Analytic-DPM received an Outstanding Paper Award at ICLR 2022!

Requirements

pytorch=1.9.0

Run experiments

You can change the phase variable in the code to determine the specific experiment you run.

For example, setting phase = "sample_analytic_ddpm" will run sampling using the Analytic-DDPM.

You can find all available phases in run_xxx.py.

CIFAR10

$ cd cifar_imagenet_codes
$ python run_cifar10.py

CelebA 64x64

$ cd celeba_lsun_codes
$ python run_celeba.py

Imagenet 64x64

$ cd cifar_imagenet_codes
$ python run_imagenet64.py

LSUN Bedroom

$ cd celeba_lsun_codes
$ python run_lsun_bedroom.py

Pretrained models and precalculated statistics

  • CIFAR10 model: [checkpoint] trained by ourselves

  • CelebA 64x64 model: [checkpoint] from https://github.com/ermongroup/ddim

  • Imagenet 64x64 model: [checkpoint] from https://github.com/openai/improved-diffusion

  • LSUN Bedroom model: [checkpoint] from https://github.com/pesser/pytorch_diffusion

  • Precalculated Gamma vectors: [link]

  • Precalculated FID statistics (calculated as described in Appendix F.2 in the paper): [link].

This implementation is based on / inspired by

  • https://github.com/pesser/pytorch_diffusion (provide codes of models for CelebA64x64 and LSUN Bedroom)

  • https://github.com/openai/improved-diffusion (provide codes of models for CIFAR10 and Imagenet64x64)

  • https://github.com/mseitzer/pytorch-fid (provide the official implementation of FID to PyTorch)