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)
Clone this repo
git clone git@github.com:chao-ji/ddpm_tf2.git-
Download official checkpoint files Download TF1 checkpoint files from this link
-
Convert to TF2-compatible formats Run
python convert_to_tf2_ckpt.pyto convert them to TF2-compatible formats
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
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
Run
python train.py --config_path config.yaml --ckpt_path dir_to_checkpoint
for training your own DDPM model.
See more samples

