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 to1000
: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 to8.5e-4
:beta_end
- the end value for the beta schedule. Defaults to0.012
: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
:clip_denoised_sample
- whether to clip the predicted denoised sample ($x_0$ in Equation (12)) into $[-1, 1]$ for numerical stability . Defaults tofalse
: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 to50
: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 of10.0
is already pretty small . Defaults to10.0