callbacks
The callbacks config group determines the lightning callbacks to be used by mml, whenever lightning is invoked
(training, testing, predicting). Note that callbacks are mostly deactivated during tuning. Lightning provides comes
with some builtin callbacks
but special care has to taken since some callbacks are handled by mml itself internally. Callback creation is
handled within create_trainer(), there
StopAfterKeyboardInterruptwill be added automatically and prevents lightning from catching keyboard interrupts
MetricsTrackerCallbackwill also be added ifmetrics_callback=Trueand made accessible asmetrics_callback
MMLRichProgressBarorMMLTQDMProgressBarare used as progress bar modifications (depending onlogging.rendersettings)
MMLModelCheckpointis added multiple times as described increate_trainer()
All other callbacks are coordinated through the callbacks config. Noteworthy though the yaml config files are within the
callbacks folder the underlying config structure is cbs:{id:{**kwargs}}. This allows the following two features:
stacking callbacks:
callbacks=[early,swa]- here adding both early stopping and stochastic weight averaging to the callbacksmodify callback kwargs:
cbs.early.patience=5- here setting the patience parameter of early stopping
The following callbacks configuration files are currently available:
default
- cbs
- lrm
logs information on learning rate
early
- cbs
- early
enables early stopping (by default based on validation loss, but configurable)
many kwargs may be accessed e.g. via +cbs.early.min_delta=0.001, only some are documented here directly
- monitor
- default: val/loss
the monitor parameter controls the metric that is observed and required to improve to prevent stopping
may be set to any metric that is measured (see metrics), but the task name needs to be inserted (e.g. val/mml_fake_task/MulticlassAccuracy)
- mode
- default: min
either min or max
if adapting the monitor parameter it is important to also give the orientation of the metric
if “the bigger, the better” this mode should be max
- patience
- default: 10
controls the number of epochs awaiting improvement before training is stopped
note that trainer.min_epochs overrules stopping too early
if using lr_scheduler=plateau make sure EarlyStopping patience is larger than lr_scheduler.patience
none
- cbs
this configuration file will clear any callback (except the ones handled internally by mml)
mixup
- cbs
- mixup
custom mixup callback
MixUpCallbacksee docstring for kwargs
cutmix
- cbs
- cutmix
custom cutmix callback
CutMixCallbacksee docstring for kwargs
swa
- cbs
- swa
activates stochastic weight averaging
- swa_lrs
- default: 0.005
the SWA learning rate to use
stats
- cbs
- stats
collects statistics on the device