Callback Base Classes#
Callback Base Interface#
Defines the minimal callback protocol used for training, evaluation, and telemetry integration. Provides a unified interface for hook registration and event dispatch during iterative processes (e.g., epochs, steps).
Includes:
Callback: protocol defining the event hook signatures.CallbackList: container that manages multiple callbacks and dispatches events sequentially.
- class qmlhc.callbacks.base.Callback(*args, **kwargs)[source]#
Bases:
ProtocolMinimal interface for runtime hooks used during training or evaluation.
A callback provides optional implementations for any of the event methods below. They can be combined to track progress, modify state, or log telemetry data across steps or epochs.
- on_error(error, context)[source]#
Called when an exception occurs within the training or evaluation loop.
- class qmlhc.callbacks.base.CallbackList(callbacks=None)[source]#
Bases:
objectManages multiple callbacks and dispatches their events sequentially.
- Parameters:
callbacks (list[Callback] or None, optional) – Initial list of callbacks. Defaults to an empty list.
Notes
Callbacks are executed in the order they were added.
Each event propagates to all registered callbacks.
- on_epoch_begin(epoch, context)[source]#
Trigger
on_epoch_beginfor all registered callbacks.- Return type:
- on_epoch_end(epoch, context)[source]#
Trigger
on_epoch_endfor all registered callbacks.- Return type: