EventHandler(self, /, *args, **kwargs)

EventHandler(name, callback, handler, priority)


Alias for field number 1


Alias for field number 2


Alias for field number 0


Alias for field number 3


CallbackHandler(self, callbacks:Iterable[],, verbose:bool=False) -> None

A CallbackHandler owns zero or more Callbacks, each of which is associated with some "event". It then exposes a fire_event method, which calls each callback associated with that event ordered by their priorities.

The callbacks take no parameters; instead they read from and write to this handler's state, which should be a Trainer.


  • callbacks : Iterable[Callback] The callbacks to be handled.
  • state : TrainerBase The trainer from which the callbacks will read state and to which the callbacks will write state.
  • verbose : bool, optional (default = False) If true, will log every event -> callback. Please only use this for debugging purposes.


CallbackHandler.callbacks(self) -> List[]

Returns the callbacks associated with this handler. Each callback may be registered under multiple events, but we make sure to only return it once. If typ is specified, only returns callbacks of that type.


CallbackHandler.fire_event(self, event:str) -> None

Runs every callback registered for the provided event, ordered by their priorities.