Skip to content
data

DriftingOutput

extendsModelOutput
DriftingOutput(loss: Tensor, samples: Tensor, guidance_scale: Tensor, feature_losses: dict[str, Tensor], drift_energy: dict[str, Tensor] = dict())

What a drifting training step reports.

Attributes

lossTensor
Sum over feature sets of the mean drifting loss — a scalar whose value is the normalised drift energy ∥V~∥2\lVert\tilde V\rVert^2.
samplesTensor
(N_c * gen_per_label, C, H, W) — the generated batch, grouped label-major.
guidance_scaleTensor
(N_c,) — the guidance scale α\alpha each label trained at.
feature_lossesdict of str to Tensor
The per-feature-set loss terms, keyed as the encoder names them.
drift_energydict of str to Tensor
The release's logged diagnostics, one scalar per feature set and quantity, keyed "<feature set>/<quantity>": scale is the mean target distance the features are normalised by, and loss_<tau> is the raw drift energy ∥Vτ∥2\lVert V_\tau\rVert^2 at temperature tau\\tau, before normalisation. Detached, in the model's dtype like loss (computed in float32 at least). loss is scale-normalised and so nearly constant (one per temperature, summed); these energies are what falls toward zero as the generator approaches the fixed point, so they are the signal to watch for convergence. Float32 or wider, whatever the batch's dtype.

Examples

>>> import lucid
>>> from lucid.models.generative.drifting import DriftingOutput
>>> out = DriftingOutput(loss=lucid.zeros(()), samples=lucid.zeros(4, 4, 8, 8),
...                      guidance_scale=lucid.ones(1), feature_losses={})
>>> out.samples.shape
(4, 4, 8, 8)

Used by 1