Skip to content

dew.diffusion.schedules.source

Published diffusion scheduler files, resolved once and sampled on their native grids.

Class defaults and solver controls live in source_policy; source_grids builds the numerical tables without re-reading the config. SourceSchedule keeps the public training and sampling contract and owns its grid cache.

NameSummary
SourceGridA published pipeline’s sampling grid, prepared the way that pipeline prepares it: the scheduler file config (SourceSchedule.from_config) sampled at the latent token count tokens a resolution-dependent flow shift reads, its flow sigmas starting at origin (SourceSchedule.sampling).
SourceScheduleReproduces a published scheduler file with Dew’s native solver and time grids.

dataclass source

class SourceGrid(
config: Mapping[str, object],
tokens: int | None = None,
origin: Origin = 'scheduler',
)

A published pipeline’s sampling grid, prepared the way that pipeline prepares it: the scheduler file config (SourceSchedule.from_config) sampled at the latent token count tokens a resolution-dependent flow shift reads, its flow sigmas starting at origin (SourceSchedule.sampling). Called with a step count, it returns the process and the explicit descending grid that many steps sample on. Its fields are its record, so a run trained from the pipeline saves the grid its samples are drawn on.

schedule: SourceSchedule

The scheduler config names, read once, which keeps the grids it built.

dataclass source

class SourceSchedule(
config: Mapping[str, object],
betas: np.ndarray,
prediction: PredictionTransform,
policy: SourcePolicy,
solver: Solver,
_grids: dict[tuple[int, int | None, Origin], tuple[Process, jax.Array]] = dict(),
)

Reproduces a published scheduler file with Dew’s native solver and time grids.

from_config reads the file’s class and controls once and resolves them into a prediction transform, a native solver and the policy that builds grids. It raises ValueError for an unsupported class or for an active control this module does not reconstruct.

train_steps: int

The training step count the class declares, which is the beta table’s length wherever the class tabulates one.

def from_config(config: Mapping[str, object]) -> SourceSchedule
def training_process(tokens: int | None = None) -> Process

Return the process Dew fine-tunes the checkpoint on, at tokens latent tokens.

A scheduler file states how its checkpoint samples, so the training process uses the convention its sampler reads. That is the VP beta table, EDM’s log-normal sigma draw, or the flow path at the shift its sampler uses. A file with dynamic shifting needs tokens. The terminal stretch applies to sampling only.

def sampling(
steps: int,
*,
tokens: int | None = None,
origin: Origin = 'scheduler',
) -> tuple[Process, jax.Array]

Return the process and the explicit descending grid for sampling in steps steps.

tokens is the latent token count that a resolution-dependent flow shift reads, and origin is where a flow file’s sigmas start. The calling pipeline supplies both through the task’s grid callable. Raises ValueError when steps is not a positive integer, or when it is larger than the training table of a tabulated or lambda class.