clinicadl.callbacks.CallbacksHandler¶
- class clinicadl.callbacks.CallbacksHandler(callbacks: Sequence[Callback])[source]¶
To handle all the
Callbackspassed to aTrainer.Note that some callbacks are instantiated by default:
LoggerCallback,MonitorCallback,ModelCheckpointCallbackandTrainingCheckpointCallback. To override them, just pass a new instance.- Parameters:
callbacks (Sequence[Callback]) –
A sequence of
Callbacks.Important
Order matters! The order of the callbacks may determine the order in which callbacks will be called. Note, however, that some callbacks have an immutable rank in this order. For example, no matter where you place
LoggerCallback, it will be called first to initialize logging and last to shutdown logging.
- property all_callbacks: list[Callback]¶
The callbacks currently in the
CallbacksHandler, including private callbacks (mandatory callbacks that are always used byClinicaDL).
- call_event(event: str | Event, **kwargs) None[source]¶
Call a specific event method on all callbacks (see
Callbackto get the list of the events).- Parameters:
event (str | Event) – Name of the event to call (e.g.
"on_train_start").kwargs (Any) – Keyword arguments that will be passed to the methods associated to this event.