Skip to content

Latest commit

 

History

History
77 lines (46 loc) · 2.03 KB

README.md

File metadata and controls

77 lines (46 loc) · 2.03 KB

TensorFlow2 Implementation of Denoising Diffusion Probabilistic Model

This is a TensorFlow2 implementation (tested on version 2.13.0) of Denoising Diffusion Probabilistic Model (paper and official TF1 implementation).

Features:

  • Can sample images using original checkpoint files (after converting to TF2 format)
  • Full training and sampling workflow
  • Can generate samples with both DDPM and DDIM (with interpolation on latent variables)

Quick Start

Clone this repo

git clone [email protected]:chao-ji/ddpm_tf2.git

Sampling

Prepare Checkpoint files

  1. Download official checkpoint files Download TF1 checkpoint files from this link

  2. Convert to TF2-compatible formats Run python convert_to_tf2_ckpt.py to convert them to TF2-compatible formats

Sample with DDPM

Run

python sample.py --config_path config.yaml --model_path model_path

e.g. python sample.py --config_path cifar10.yaml --model_path cifar10-1 to generate samples.

set --store_prog to True to save intermediate results

Sample with DDIM

Set --use_ddim to True to sample with DDIM

You can get pretty decent results with default parameters (eta being 0 and ddim_steps being 50). Or you can try larger eta values up to 1.0, and ddim_steps up to 1000 (This is when DDIM fall backs to DDPM).

Set --interpolate to True to generate images using latents that are evenly interpolated between two independent latent noises

Training

Run

python train.py --config_path config.yaml --ckpt_path dir_to_checkpoint

for training your own DDPM model.

Samples of generated images


Samples of CIFAR10 images


Samples of CelebAHQ images

See more samples