Skip to content

dew.diffusion.schedules.source_grids

The schedule objects a published diffusion checkpoint’s grid is walked on.

source.py reads one scheduler file into a policy, and these are the schedules that policy hands to Process. Each is an ordinary Dew schedule, so a solver reads its rates, its model time and its prior the way it reads any other.

The four are the training beta table indexed by t, a paired sigma/model-time table in variance-exploding or normalized-VP coordinates, the same table refined with the stage row a two-evaluation solver reads, and a rectified-flow table whose signal and noise sum to one.

NameSummary
FlowGridA rectified-flow grid: alpha is 1 - sigma, not a normalized VP pair.
SigmaGridA VE process with paired continuous sigma and model-time coordinates.
StageSigmaGridA source VE grid that carries the stage rows of a two-evaluation solver.
TabulatedVPThe training beta table as the sampling schedule, indexed by t.
VPGridThe same paired coordinates in normalized VP latent space.

class source

class FlowGrid(_UniformGrid)

A rectified-flow grid: alpha is 1 - sigma, not a normalized VP pair.

The source’s forward process is x_t = (1 - sigma) x_0 + sigma eps, so signal and noise sum to one rather than their squares. Model times are the sigmas times the training count, which is where the source’s timesteps come from. The prior at sigma 1 is the unit Gaussian.

def rates(t)

class source

class SigmaGrid(sigmas: np.ndarray, model_times: np.ndarray, prior: float)

A VE process with paired continuous sigma and model-time coordinates.

sigma_min and sigma_max are the prepared grid’s own positive extremes, which is the domain a source noise sampler is built over.

class source

class StageSigmaGrid(sigmas: np.ndarray, model_times: np.ndarray, prior: float)

A source VE grid that carries the stage rows of a two-evaluation solver.

Even coordinates are the grid points the outer walk visits. The odd one between each pair is the source’s own interpolated evaluation, at the sigma it places there and the model time it reads back for that sigma. t_of_sigma resolves a sigma to a stage coordinate, the only inversion these solvers ask of a schedule, since KDPM2’s midpoint and DPMSolverSDE’s proposal both land on a stage row.

def t_of_sigma(sigma)

class source

class TabulatedVP(betas: np.ndarray, *, final_alpha_cumprod: float, stride: int | None)

The training beta table as the sampling schedule, indexed by t.

stride is the fixed training transfer DDIM and PNDM step over, whatever their evaluation grid is. None leaves the grid’s own interval, which is what DDPM’s previous-timestep policy and the distilled schedules take. A t below zero is the source’s “no previous alpha” end.

def rates(t)
def model_time(t)
def step_interval(t, t_next)

Published DDIM/PNDM transfer stride, independent of evaluation spacing.

def half_interval(t, t_next)

Published PRK uses the integer transfer stride divided by two.

class source

class VPGrid(_UniformGrid)

The same paired coordinates in normalized VP latent space.

def rates(t)