nvalchemi.training.ConstantWeight#
- pydantic model nvalchemi.training.ConstantWeight[source]#
Time-invariant loss weight that returns
valueat every update.ConstantWeightis the simplestLossWeightSchedule: it ignores both the global step and the epoch and always yieldsvalue. Reach for it when a component’s contribution is fixed but you still want to express the weight as a schedule object – for instance to keep a uniform type across aComposedLossFunction’sweightssequence, or to scale a leaf loss with theschedule * leafoperator. A barefloatweight behaves identically; the schedule form is mostly for symmetry and serialization.Examples
>>> from nvalchemi.training.losses import ConstantWeight >>> w = ConstantWeight(value=2.5) >>> w(step=0, epoch=0), w(step=1000, epoch=9) (2.5, 2.5)
Multiply a leaf loss to build a weighted component:
>>> weighted = ConstantWeight(value=10.0) * ForceMSELoss()
Notes
Instances are frozen (immutable) per the shared
_BaseWeightScheduleconfig, so a schedule can be safely reused across components.- field value: float [Required]#
Constant weight value.