nvalchemi.training.LossWeightSchedule#
- class nvalchemi.training.LossWeightSchedule(*args, **kwargs)[source]#
Runtime-checkable protocol for loss-weight schedules.
Any object callable with signature
(step: int, epoch: int) -> float, exposing aper_epochattribute, and returning a rebuild recipe fromto_spec()satisfies this protocol. Such objects are accepted insideComposedLossFunction’sweightssequence or as the right-hand side ofschedule * leaf. Concrete Pydantic schedules live inschedules.- per_epoch#
If
True, the schedule should advance byepochinstead of bystep. This aligns loss-weight updates with training loops that update learning-rate schedules once per epoch.- Type:
bool
- Parameters:
step – Current global training step (0-indexed).
epoch – Current epoch number (0-indexed).
- Returns:
Scalar weight to apply to the associated loss term.
- Return type:
float