nvalchemi.training.distillation.TeacherScorer#
- class nvalchemi.training.distillation.TeacherScorer(*args, **kwargs)[source]#
Structural interface for objects that produce teacher signals for a batch.
An implementation declares the
signalsit emits and returns, for oneBatch,{batch field: (tensor, level)}with levels"node"or"system"asadd_key()takes them. Tensors must be detached and live on the batch’s device.It may also publish
label_fields, the sequence of batch fieldslabel()populates (never a bare string); consumers read it throughscorer_fields(). An implementation naming a built-in signal is read as writing every field that signal populates, so one that writes fewer, or one whose signals are its own, must declarelabel_fields. The protocol will not grow required members.Label precision is the scorer’s decision. A consumer calls
label()inside the ambient autocast region, meaning whatever autocast state is in force at the call site, and opens no region of its own. An implementation used in a mixed-precision workflow therefore sets its own autocast mode.InProcessTeacherScorerdisables autocast unless itsautocastsetting says otherwise.See also
InProcessTeacherScorerScorer that evaluates a teacher in this process.
nvalchemi.training.distillation.labeling.label_datasetOffline consumer.