dew.diffusion.presets
Named conventions, as the dataclasses a run’s run.json stores.
A preset is a frozen dataclass of the numbers that define a convention, and
calling it builds the Process. Both training and inference build from the
same preset, so a model is always sampled with the convention it was trained
with. A record that holds the preset’s fields rebuilds it exactly.
| Name | Summary |
|---|---|
Preset | Every member of the presets registry is a frozen dataclass of a convention’s numbers, callable to the Process it describes. |
EDM | Karras et al. |
Karras | The EDM preconditioning trained on sigmas drawn uniformly along the rho-spaced grid it samples on. |
Cosine | The cosine beta table with v-prediction. |
Flow | Rectified flow on the linear path, velocity prediction, logit-normal times, with SD3’s resolution shift. |
Sqrt | Diffusion-LM (Li et al. |
Preset
Section titled “Preset”class Preset(Protocol)Every member of the presets registry is a frozen dataclass of a
convention’s numbers, callable to the Process it describes.
class EDM( sigma_min: float = 0.002, sigma_max: float = 80.0, rho: float = 7.0, sigma_data: float = 0.5, P_mean: float = -0.4, P_std: float = 1.0, min_snr_gamma: float | None = None,)Karras et al. 2022: log-normal training sigmas, the EDM preconditioning and lambda weighting, sampled on the rho-spaced Karras grid.
Karras
Section titled “Karras”class Karras( sigma_min: float = 0.002, sigma_max: float = 80.0, rho: float = 7.0, sigma_data: float = 0.5, min_snr_gamma: float | None = None,)The EDM preconditioning trained on sigmas drawn uniformly along the rho-spaced grid it samples on.
Cosine
Section titled “Cosine”class Cosine( timesteps: int = 1000, beta_end: float = 1.0, p2_loss_weight_k: float = 1.0, p2_loss_weight_gamma: float = 1.0, min_snr_gamma: float | None = None,)The cosine beta table with v-prediction.
The table’s P2 weight at its defaults (k = 1, gamma = 1) is 1 / (1 + SNR),
which makes the v loss an unweighted x_0 loss. p2_loss_weight_gamma
changes that.
class Flow( shift: float = 1.0, logit_mean: float = 0.0, logit_std: float = 1.0, min_snr_gamma: float | None = None,)Rectified flow on the linear path, velocity prediction, logit-normal times, with SD3’s resolution shift.
class Sqrt(min_snr_gamma: float | None = None)Diffusion-LM (Li et al. 2022): the square-root schedule with the plain x_0 loss.