DDIM Implementation: Jiaming Song, Chenlin Meng and Stefano Ermon, Stanford
Modified into Conditional DDIM by Hengtong.
The code has been tested on PyTorch 1.12.
Training is exactly the same as DDPM with the following:
python main.py --config {DATASET}.yml --exp {PROJECT_PATH} --doc {MODEL_NAME} --ni --cond
the new added --cond is the option for conditional ddim.
python main.py --config {DATASET}.yml --exp {PROJECT_PATH} --doc {MODEL_NAME} --sample --fid --timesteps {STEPS} --eta {ETA} --ni
where
ETAcontrols the scale of the variance (0 is DDIM, and 1 is one type of DDPM).STEPScontrols how many timesteps used in the process.MODEL_NAMEfinds the pre-trained checkpoint according to its inferred path.
Use --sequence option instead.
The above two cases contain some hard-coded lines specific to producing the image, so modify them according to your needs.
This implementation is based on / inspired by:
- https://github.com/ermongroup/ddim (the DDIM Pytorch repo),