The source code for our paper "Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models", Pengze Zhang*, Hubery Yin*, Chen Li, Xiaohua Xie, CVPR 2024 (Highlight).
Most diffusion models assume that the reverse process adheres to a Gaussian distribution. However, this approximation has not been rigorously validated, especially at singularities, where t=0 and t=1. Improperly dealing with such singularities leads to an average brightness issue in applications, and limits the generation of images with extreme brightness or darkness. We primarily focus on tackling singularities from both theoretical and practical perspectives. Initially, we establish the error bounds for the reverse process approximation, and showcase its Gaussian characteristics at singularity time steps. Based on this theoretical insight, we confirm the singularity at t=1 is conditionally removable while it at t=0 is an inherent property. Upon these significant conclusions, we propose a novel plug-and-play method SingDiffusion to address the initial singular time step sampling, which not only effectively resolves the average brightness issue for a wide range of diffusion models without extra training efforts, but also enhances their generation capability in achieving notable lower FID scores.
- Python 3.9.0
- CUDA 11.2
- NVIDIA A100 40GB PCIe
- Torch 2.0.1
- Torchvision 0.15.2
Please follow diffusers to install diffusers.
2) Install pre-trained SingDiffusion module into ./SingDiffusion
Sampling with SingDiffusion
python python test_sing_diffusion_img2img_average_brightness.py --out_dir XXX
Sampling without SingDiffusion
python python test_sing_diffusion_img2img_average_brightness.py --out_dir XXX --no_SingDiffusion
Download 30K COCO prompt into ./COCO_3W_prompt.json
Sampling with SingDiffusion
python python test_sing_diffusion_img2img_COCO.py --out_dir XXX
Sampling without SingDiffusion
python python test_sing_diffusion_img2img_COCO.py --out_dir XXX --no_SingDiffusion
@inproceedings{
zhang2024tackling,
title={Tackling the Singularities at the Endpoints of Time Intervals in Diffusion Models},
author={Pengze Zhang and Hubery Yin and Chen Li and Xiaohua Xie},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2024}
}
We build our project based on diffusers. We thank them for their wonderful work and code release.