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 tt uses the values of αˉ_t\bar{\alpha}\_t and αˉ_t1\bar{\alpha}\_{t-1}, however for t=0t = 0 there is no previous alpha. The strategy can be either :one (αˉ_t1=1\bar{\alpha}\_{t-1} = 1) or :alpha_zero (αˉ_t1=αˉ_0\bar{\alpha}\_{t-1} = \bar{\alpha}\_0) . Defaults to :one

  • :clip_denoised_sample - whether to clip the predicted denoised sample (x0x_0 in Equation (12)) into [1,1][-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 cskip(t)=σdata2(st)2+σdata2,cout(t)=st(st)2+σdata2 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 σdata=0.5\sigma_{data} = 0.5 and ss 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