Xylambda/torchfitter

ENH: priority system for callbacks

Opened this issue · 0 comments

Right now, callbacks are executed in the same order they are passed to the Trainer. This can cause problems if, for instance, a logger callbacks is passed before the loss was modified by another callback, displaying an incorrect loss value.

The idea would be to establish a priority system for the callbacks. At the beginning of the training, the Trainer would sort the list of callbacks by their priorities.

class CallbackPriority:
    REGULARIZATION = 1
    SCHEDULING = 2
    PROGRESS = 3