azula.noise¶
Noise schedules.
A noise schedule is a mapping from a time \(t \in [0, 1]\) to the signal scale \(\alpha_t \in \mathbb{R}_+\) and the noise scale \(\sigma_t \in \mathbb{R}_+\) in a perturbation kernel
from a “clean” random variable \(X\) to a “noisy” random variable \(X_t\). The only constraint is for the signal-to-noise (SNR) ratio \(\frac{\alpha_t}{\sigma_t}\) to be monotonically decreasing with respect to the time \(t\). Typically, the initial signal scale \(\alpha_0\) is set to 1 and the initial noise is small enough (\(0 < \sigma_0 \ll 1\)) that \(X_0\) is almost equivalent to \(X\).
Note that the relation between \(X_s\) and \(X_t\) (\(0 \leq s \leq t\)) is not enforced by the noise schedule. For example,
and
are both compatible with the perturbation kernel \(p(X_t \mid X)\).
Classes¶
Abstract noise schedule. |
|
Creates a variance exploding (VE) noise schedule. |
|
Creates a variance preserving (VP) noise schedule. |
|
Creates a cosine noise schedule. |
|
Creates a rectified noise schedule. |
|
Creates an exponential decay schedule. |
Descriptions¶
- class azula.noise.VESchedule(sigma_min=0.001, sigma_max=1000.0)¶[source]
Creates a variance exploding (VE) noise schedule.
\[\begin{split}\alpha_t & = 1 \\ \sigma_t & = \exp \big( (1 - t) \log \sigma_\min + t \log \sigma_\max \big)\end{split}\]References
Generative Modeling by Estimating Gradients of the Data Distribution (Song et al., 2019)Score-Based Generative Modeling through Stochastic Differential Equations (Song et al., 2021)
- class azula.noise.VPSchedule(alpha_min=0.001, sigma_min=0.001)¶[source]
Creates a variance preserving (VP) noise schedule.
\[\begin{split}\alpha_t & = \exp \big( t^2 \log \alpha_\min \big) \\ \sigma_t & = \sqrt{ 1 - \alpha_t^2 + \sigma_\min^2}\end{split}\]References
Denoising Diffusion Probabilistic Models (Ho et al. 2020)Score-Based Generative Modeling through Stochastic Differential Equations (Song et al., 2021)
- class azula.noise.CosineSchedule(alpha_min=0.001, sigma_min=0.001)¶[source]
Creates a cosine noise schedule.
\[\begin{split}\alpha_t & = \cos \big( t \arccos \alpha_\min \big) \\ \sigma_t & = \sqrt{ 1 - \alpha_t^2 + \sigma_\min^2}\end{split}\]
- class azula.noise.RectifiedSchedule(alpha_min=0.001, sigma_min=0.001)¶[source]
Creates a rectified noise schedule.
\[\begin{split}\alpha_t & = t \, \alpha_\min + (1 - t) \\ \sigma_t & = t + (1 - t) \, \sigma_\min\end{split}\]References
Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow (Liu et al. 2022)Flow Matching for Generative Modeling (Lipman et al. 2023)
- class azula.noise.DecaySchedule(alpha_min=0.001, sigma_min=0.001, gamma=0.1)¶[source]
Creates an exponential decay schedule.
\[\begin{split}\alpha_t & = \tau \, \alpha_\min + (1 - \tau) \\ \sigma_t & = \tau + (1 - \tau) \, \sigma_\min\end{split}\]where
\[\tau = \frac{1 - \gamma^t}{1 - \gamma}\]The smaller \(\gamma\), the more time is allocated to high signal-to-noise ratios. When \(\gamma\) is close to 1, the schedule becomes equivalent to the
RectifiedSchedule.