WeightingInterface#
Module for the Weighting Interface.
- class WeightingInterface[source]#
Bases:
objectAbstract interface for all weighting schemas.
- abstract aggregate(losses)[source]#
Aggregate a collection of loss terms into a single scalar.
This method applies the current weighting scheme to the provided losses and returns the aggregated result. Implementations may internally update the weights (e.g., based on training state) before performing the aggregation.
- Parameters:
losses (dict) – The mapping from loss names to loss tensors.
- Returns:
The aggregated loss value.
- Return type:
- abstract update_weights(losses)[source]#
Update the weights based on the current losses.
This method defines how the weighting strategy adapts over time. It is responsible for computing and storing updated weights that will be used during aggregation.
- abstract last_saved_weights()[source]#
Get the most recently computed weights.
- Returns:
The mapping from loss names to their corresponding weights.
- Return type:
- abstract property solver#
Solver associated with this weighting strategy.
Provides access to the solver instance that uses this weighting scheme, enabling strategies that depend on training state or model information.
- Returns:
The solver instance.
- Return type:
BaseSolver