Skip to content
class

VPSDE

extendsSDE
VPSDE(beta_min: float = 0.1, beta_max: float = 20.0)

Variance Preserving — the continuous limit of DDPM.

Parameters

beta_minfloat= 0.1
The linear rate range. The paper's values, "to match the settings in Ho et al. (2020)".
beta_maxfloat= 0.1
The linear rate range. The paper's values, "to match the settings in Ho et al. (2020)".

Notes

Song et al. (2021), equation 32:

dx=−12(βˉmin⁡+t(βˉmax⁡−βˉmin⁡))x dt+βˉmin⁡+t(βˉmax⁡−βˉmin⁡)  dw,dx = -\tfrac{1}{2}\big(\bar\beta_{\min} + t(\bar\beta_{\max} - \bar\beta_{\min})\big) x\, dt + \sqrt{\bar\beta_{\min} + t(\bar\beta_{\max} - \bar\beta_{\min})}\; dw,

with the perturbation kernel of equation 33. Starting from unit variance the process keeps it, which is the difference from VE and the reason the prior is a standard normal rather than a wide one.

Examples

>>> from lucid.models.generative.score_sde._sde import VPSDE
>>> sde = VPSDE(beta_min=0.1, beta_max=20.0)
>>> sde.prior_variance
1.0
Variance preserving: the process is scaled so the terminal
distribution is the unit Gaussian, which is the same place DDPM
ends up and why the two are usually interchangeable.

Used by 1

Constructors

1
dunder

__init__

→None
__init__(beta_min: float = 0.1, beta_max: float = 20.0)

Initialise the SDE. See the class docstring for parameters.

Properties

2
prop

prior_variance

→float
prior_variance: float

One — the process is variance preserving.

prop

t_min

→float
t_min: float

The paper's sampling epsilon, chosen so the variance matches DDPM's.

Instance methods

5
fn

beta

→Tensor
beta(t: Tensor)

β(t)=βˉmin⁡+t(βˉmax⁡−βˉmin⁡)\beta(t) = \bar\beta_{\min} + t(\bar\beta_{\max} - \bar\beta_{\min}).

fn

drift

→Tensor
drift(x: Tensor, t: Tensor)

−12β(t)x-\tfrac{1}{2}\beta(t)x.

fn

prior_sampling

→Tensor
prior_sampling(shape: tuple[int, ...], device: str, dtype: lucid.dtype | None = None)

N(0,I)\mathcal{N}(0, I).