Package ai.djl.training.listener
Class LoggingTrainingListener
- java.lang.Object
-
- ai.djl.training.listener.LoggingTrainingListener
-
- All Implemented Interfaces:
TrainingListener
public class LoggingTrainingListener extends java.lang.Object implements TrainingListener
TrainingListenerthat outputs the progress of training each batch and epoch into logs.- See Also:
- The guide on DJL logging
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ai.djl.training.listener.TrainingListener
TrainingListener.BatchData, TrainingListener.Defaults
-
-
Constructor Summary
Constructors Constructor Description LoggingTrainingListener()Constructs aLoggingTrainingListenerinstance.LoggingTrainingListener(int frequency)Constructs aLoggingTrainingListenerinstance with specified steps.
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
LoggingTrainingListener
public LoggingTrainingListener()
Constructs aLoggingTrainingListenerinstance.
-
LoggingTrainingListener
public LoggingTrainingListener(int frequency)
Constructs aLoggingTrainingListenerinstance with specified steps.Print out logs every
frequencyepoch.- Parameters:
frequency- the frequency of epoch to print out
-
-
Method Detail
-
onEpoch
public void onEpoch(Trainer trainer)
Listens to the end of an epoch during training.- Specified by:
onEpochin interfaceTrainingListener- Parameters:
trainer- the trainer the listener is attached to
-
onTrainingBatch
public void onTrainingBatch(Trainer trainer, TrainingListener.BatchData batchData)
Listens to the end of training one batch of data during training.- Specified by:
onTrainingBatchin interfaceTrainingListener- Parameters:
trainer- the trainer the listener is attached tobatchData- the data from the batch
-
onValidationBatch
public void onValidationBatch(Trainer trainer, TrainingListener.BatchData batchData)
Listens to the end of validating one batch of data during validation.- Specified by:
onValidationBatchin interfaceTrainingListener- Parameters:
trainer- the trainer the listener is attached tobatchData- the data from the batch
-
onTrainingBegin
public void onTrainingBegin(Trainer trainer)
Listens to the beginning of training.- Specified by:
onTrainingBeginin interfaceTrainingListener- Parameters:
trainer- the trainer the listener is attached to
-
onTrainingEnd
public void onTrainingEnd(Trainer trainer)
Listens to the end of training.- Specified by:
onTrainingEndin interfaceTrainingListener- Parameters:
trainer- the trainer the listener is attached to
-
-