autocast.processors.diffusion#
- class LolaElucidatedDenoiser(backbone, schedule, c_noise_scale=10.0)[source]#
Bases:
DenoiserLoLA EDM-style denoiser preconditioning.
This mirrors
ElucidatedDenoiserin LoLA’slola/diffusion.py. The main difference from Azula’s localKarrasDenoiseris the modulation input scale: LoLA feeds10 * log(sigma / alpha)to the time embedding.
- class DiffusionProcessor(backbone, schedule, denoiser_type='karras', learning_rate=0.0001, n_steps_output=4, n_channels_out=1, sampler_steps=50, sampler='euler', sampler_order=2)[source]#
Bases:
ProcessorDiffusion Processor.
- Parameters:
- forward(x, global_cond=None)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- loss(batch)[source]#
Training step with diffusion loss.
Sample random time steps and compute loss between denoised output and the clean data.
- Parameters:
batch (EncodedBatch)
- Return type:
- sample(x_t, cond, global_cond=None, num_steps=100, sampler=None, eta=0.0, return_trajectory=False, silent=True, **sampler_kwargs)[source]#
Generate samples via reverse diffusion using Azula’s samplers.
- Parameters:
x_t (Tensor) – Starting noise (B, T, C, W, H)
cond (Tensor) – Conditioning input (B, T_cond, C_cond, W, H)
global_cond (Tensor | None) – Optional non-spatial conditioning/modulation tensor.
num_steps (int) – Number of denoising steps
sampler (str | None) – Type of sampler to use. Defaults to the configured self.sampler when unset. - ‘euler’: Euler ODE solver (fast, deterministic) - ‘heun’: Heun’s method (more accurate, deterministic) - ‘ddim’: DDIM sampler (eta controls stochasticity) - ‘ddpm’: DDPM sampler (stochastic) - ‘ab’: Adams-Bashforth ODE solver with z-prediction - ‘vab’: Adams-Bashforth ODE solver with v-prediction
eta (float) – Stochasticity parameter for DDIM (0=deterministic, 1=stochastic)
return_trajectory (bool) – If True, return all intermediate steps
silent (bool) – If True, hide progress bar
**sampler_kwargs – Additional kwargs passed to sampler
- Returns:
Generated samples (B, T, C, W, H) Or if return_trajectory=True: List of tensors
- Return type: