Denoising Diffusion Probabilistic Models (DDPM) by Jonathan Ho, Ajay Jain and Pieter Abbeel proposes the diffusion based model of the same name, but in the context of the 🤗 Diffusers library, DDPM refers to the discrete denoising scheduler from the paper as well as the pipeline.
The abstract of the paper is the following:
We present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by training on a weighted variational bound designed according to a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics, and our models naturally admit a progressive lossy decompression scheme that can be interpreted as a generalization of autoregressive decoding. On the unconditional CIFAR10 dataset, we obtain an Inception score of 9.46 and a state-of-the-art FID score of 3.17. On 256x256 LSUN, we obtain sample quality similar to ProgressiveGAN.
The original paper can be found here.
class diffusers.DDPMScheduler< source >
( num_train_timesteps: int = 1000 beta_start: float = 0.0001 beta_end: float = 0.02 beta_schedule: str = 'linear' trained_betas: typing.Union[numpy.ndarray, typing.List[float], NoneType] = None variance_type: str = 'fixed_small' clip_sample: bool = True prediction_type: str = 'epsilon' clip_sample_range: typing.Optional[float] = 1.0 )
int) — number of diffusion steps used to train the model.
float) — the starting
betavalue of inference.
float) — the final
str) — the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
np.ndarray, optional) — option to pass an array of betas directly to the constructor to bypass
str) — options to clip the variance used when adding noise to the denoised sample. Choose from
True) — option to clip predicted sample between -1 and 1 for numerical stability.
epsilon, optional) — prediction type of the scheduler function, one of
epsilon(predicting the noise of the diffusion process),
sample(directly predicting the noisy sample
) orv_prediction` (see section 2.4 https://imagen.research.google/video/paper.pdf)
Denoising diffusion probabilistic models (DDPMs) explores the connections between denoising score matching and Langevin dynamics sampling.
~ConfigMixin takes care of storing all config attributes that are passed in the scheduler’s
function, such as
num_train_timesteps. They can be accessed via
SchedulerMixin provides general loading and saving functionality via the SchedulerMixin.save_pretrained() and
For more details, see the original paper: https://arxiv.org/abs/2006.11239
scale_model_input< source >
timestep: typing.Optional[int] = None
Ensures interchangeability with schedulers that need to scale the denoising model input depending on the current timestep.
set_timesteps< source >
( num_inference_steps: int device: typing.Union[str, torch.device] = None )
Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.
step< source >
generator = None
return_dict: bool = True
torch.FloatTensor) — direct output from learned diffusion model.
int) — current discrete timestep in the diffusion chain.
torch.FloatTensor) — current instance of sample being created by diffusion process. generator — random number generator.
bool) — option for returning tuple rather than DDPMSchedulerOutput class
return_dict is True, otherwise a
returning a tuple, the first element is the sample tensor.
Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion process from the learned model outputs (most often the predicted noise).