View Source Bumblebee.Diffusion.LcmScheduler (Bumblebee v0.6.0)

Latent Consistency Model (LCM) sampling.

This sampling method should be used in combination with LCM. LCM is a model distilled from a regular diffusion model to predict the final denoised sample in a single step. The sample quality can be improved by alternating a couple denoising and noise injection steps (multi-step sampling), as per Appendix B.

Configuration

  • :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 :quadratic

  • :beta_start - the start value for the beta schedule. Defaults to 8.5e-4

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

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

    . 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

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

  • :num_original_steps - the number of denoising steps used during Latent Consistency Distillation (LCD). The LCD procedure distills a base diffusion model, but instead of sampling all :num_train_steps it skips steps and uses another scheduler accordingly. See Section 4.3 . Defaults to 50

  • :boundary_condition_timestep_scale - the scaling factor used in the consistency function coefficients. In the original LCM implementation the authors use the formulation $$ c_{skip}(t) = \frac{\sigma_{data}^2}{(st)^2 + \sigma_{data}^2}, \quad c_{out}(t) = \frac{st}{\sqrt{(st)^2 + \sigma_{data}^2}} $$ where $\sigma_{data} = 0.5$ and $s$ is the scaling factor. Increasing the scaling factor will decrease approximation error, although the approximation error at the default of 10.0 is already pretty small . Defaults to 10.0

References