Linear Schedule
discrete_diffusion.noise_schedules.linear
Linear noise schedule implementation.
Alpha(t) decreases linearly from near 1 to near 0 with epsilon trimming.
LinearNoiseSchedule
Bases: NoiseSchedule
Linear attenuation schedule matching MD4 defaults.
alpha(t) = (1 - 2eps) * (1 - t) + eps alpha'(t) = - (1 - 2eps)
Source code in src/discrete_diffusion/noise_schedules/linear.py
inv(alpha)
Return t such that alpha_t(t) = alpha (inverse function).
For linear schedule: alpha = (1 - 2eps) * (1 - t) + eps Solving for t: t = 1 - (alpha - eps) / (1 - 2eps)
Source code in src/discrete_diffusion/noise_schedules/linear.py
rate_scale_factor(t)
Return alpha_prime_t(t) / (1 - alpha_t(t)) for FlexMDM compatibility.
This is used in computing rate-based losses and sampling probabilities.
Source code in src/discrete_diffusion/noise_schedules/linear.py
sample(shape, device)
Sample times uniformly from [0, 1].
For linear schedule, uniform sampling in t space is appropriate.
sample_truncated(threshold, shape, device)
Sample times uniformly from [threshold, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
Tensor
|
Lower bound(s) for time sampling (can be batched) |
required |
shape
|
tuple
|
Shape of samples to generate |
required |
device
|
device
|
Device for tensor creation |
required |