data
DriftingOutput
extends
ModelOutputDriftingOutput(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
lossTensorSum over feature sets of the mean drifting loss — a scalar whose
value is the normalised drift energy .
samplesTensor(N_c * gen_per_label, C, H, W) — the generated batch, grouped
label-major.guidance_ scaleTensor(N_c,) — the guidance scale each label trained at.feature_ lossesdict of str to TensorThe per-feature-set loss terms, keyed as the encoder names them.
drift_ energydict of str to TensorThe 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 at temperature
, 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)