View Source Bumblebee.Diffusion.DdimScheduler (Bumblebee v0.2.0)

Denoising diffusion implicit models (DDIMs).

This sampling method was proposed as a follow up to the original denoising diffusion probabilistic models (DDPMs) in order to heavily reduce the number of steps during inference. DDPMs model the diffusion process as a Markov chain; DDIMs generalize this considering non-Markovian diffusion processes that lead to the same objective. This enables a reverse process with many less samples, as compared to DDPMs, while using the same denoising model.

DDIMs were shown to be a simple variant of pseudo numerical methods for diffusion models (PNDMs), see Bumblebee.Diffusion.PndmScheduler and the corresponding paper for more details.



  • :num_train_steps - the number of diffusion steps used to train the model. Defaults to 1000

  • :beta_schedule - the beta schedule type, a mapping from a beta range to a sequence of betas for stepping the model. Either of :linear, :quadratic, or :squared_cosine . Defaults to :linear

  • :beta_start - the start value for the beta schedule. Defaults to 0.0001

  • :beta_end - the end value for the beta schedule. Defaults to 0.02

  • :prediction_type - prediction type of the denoising model. Either of:

  • :noise (default) - the model predicts the noise of the diffusion process

  • :angular_velocity - the model predicts velocity in angular parameterization. See Section 2.4 in Imagen Video: High Definition Video Generation with Diffusion Models, then Section 4 in Progressive Distillation for Fast Sampling of Diffusion Models and Appendix D

. Defaults to :noise

  • :alpha_clip_strategy - each step $t$ uses the values of $\bar{\alpha}_t$ and $\bar{\alpha}_{t-1}$, however for $t = 0$ there is no previous alpha. The strategy can be either :one ($\bar{\alpha}_{t-1} = 1$) or :alpha_zero ($\bar{\alpha}_{t-1} = \bar{\alpha}_0$) . Defaults to :one

  • :timesteps_offset - an offset added to the inference steps. You can use a combination of timesteps_offset: 1 and alpha_clip_strategy: :alpha_zero, so that the last step $t = 1$ uses $\bar{\alpha}_1$ and $\bar{\alpha}_0$, as done in stable diffusion . Defaults to 0

  • :clip_denoised_sample - whether to clip the predicted denoised sample ($x_0$ in Equation (12)) into $[-1, 1]$ for numerical stability. . Defaults to true

  • :rederive_noise - whether the noise (output of the denoising model) should be re-derived at each step based on the predicted denoised sample ($x_0$) and the current sample. This technique is used in OpenAI GLIDE . Defaults to false

  • :eta - a weight for the noise added in a denoising diffusion step. This scales the value of $\sigma_t$ in Equation (12) in the original paper, as per Equation (16) . Defaults to 0.0