Package ai.djl.training.listener
Interface TrainingListener
-
- All Known Implementing Classes:
DivergenceCheckTrainingListener,EpochTrainingListener,EvaluatorTrainingListener,LoggingTrainingListener,MemoryTrainingListener,SaveModelTrainingListener,TimeMeasureTrainingListener,TrainingListenerAdapter
public interface TrainingListenerTrainingListeneroffers an interface that performs some actions when certain events have occurred in theTrainer.The methods
onEpoch,onTrainingBatch,onValidationBatchare called during training. Adding an implementation of the listener to theTrainerwill perform any desired action at those junctures. These could be used for collection metrics, or logging, or any other purpose to enhance the training process.There are many listeners that contain different functionality, and it is often best to combine a number of listeners. We recommend starting with one of our sets of
TrainingListener.Defaults. Then, more listeners can be added afterwards.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTrainingListener.BatchDataA class to pass data from the batch into the training listeners.static interfaceTrainingListener.DefaultsContains defaultTrainingListenersets.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonEpoch(Trainer trainer)Listens to the end of an epoch during training.voidonTrainingBatch(Trainer trainer, TrainingListener.BatchData batchData)Listens to the end of training one batch of data during training.voidonTrainingBegin(Trainer trainer)Listens to the beginning of training.voidonTrainingEnd(Trainer trainer)Listens to the end of training.voidonValidationBatch(Trainer trainer, TrainingListener.BatchData batchData)Listens to the end of validating one batch of data during validation.
-
-
-
Method Detail
-
onEpoch
void onEpoch(Trainer trainer)
Listens to the end of an epoch during training.- Parameters:
trainer- the trainer the listener is attached to
-
onTrainingBatch
void onTrainingBatch(Trainer trainer, TrainingListener.BatchData batchData)
Listens to the end of training one batch of data during training.- Parameters:
trainer- the trainer the listener is attached tobatchData- the data from the batch
-
onValidationBatch
void onValidationBatch(Trainer trainer, TrainingListener.BatchData batchData)
Listens to the end of validating one batch of data during validation.- Parameters:
trainer- the trainer the listener is attached tobatchData- the data from the batch
-
onTrainingBegin
void onTrainingBegin(Trainer trainer)
Listens to the beginning of training.- Parameters:
trainer- the trainer the listener is attached to
-
onTrainingEnd
void onTrainingEnd(Trainer trainer)
Listens to the end of training.- Parameters:
trainer- the trainer the listener is attached to
-
-