diffusion_models.cli

The diffusion-models command line interface.

Hydra does the heavy lifting for training and inference, so everything after the sub-command is forwarded to it untouched:

diffusion-models train +config=small_attention_ema training.batch_size=64
diffusion-models train --help  # hydra's own help, listing the config groups
diffusion-models infer checkpoint=<path> +config=small_attention_ema

Module Contents

main()[source]

Tools for training and running diffusion models.

train(config_directories, overrides)[source]

Train a diffusion model.

OVERRIDES are hydra overrides and flags, e.g. +config=small_attention_ema, training.batch_size=64, resume_from=<checkpoint> or –multirun. Pass –help to list the available config groups.

infer(config_directories, overrides)[source]

Generate images with a trained checkpoint.

OVERRIDES are hydra overrides: checkpoint=<path> is required and the model config should match the training run, e.g. +config=small_attention_ema. Other options: number_of_images=25, save_gif=true, steps=50, use_ema=false, device=cpu. Pass –help to list the config groups.

fid(checkpoint, samples, batch_size, steps, device, ema, kid, seed)[source]

Compute FID (and KID) of a training CHECKPOINT.

Needs the evaluation and training dependency groups. Only compare scores that use the same number of samples.