Package ai.djl.training.listener
Class LoggingTrainingListener
java.lang.Object
ai.djl.training.listener.LoggingTrainingListener
- All Implemented Interfaces:
TrainingListener
TrainingListener
that outputs the progress of training each batch and epoch into logs.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ai.djl.training.listener.TrainingListener
TrainingListener.BatchData, TrainingListener.Defaults
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aLoggingTrainingListener
instance.LoggingTrainingListener
(int frequency) Constructs aLoggingTrainingListener
instance with specified steps. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Listens to the end of an epoch during training.void
onTrainingBatch
(Trainer trainer, TrainingListener.BatchData batchData) Listens to the end of training one batch of data during training.void
onTrainingBegin
(Trainer trainer) Listens to the beginning of training.void
onTrainingEnd
(Trainer trainer) Listens to the end of training.void
onValidationBatch
(Trainer trainer, TrainingListener.BatchData batchData) Listens to the end of validating one batch of data during validation.
-
Constructor Details
-
LoggingTrainingListener
public LoggingTrainingListener()Constructs aLoggingTrainingListener
instance. -
LoggingTrainingListener
public LoggingTrainingListener(int frequency) Constructs aLoggingTrainingListener
instance with specified steps.Print out logs every
frequency
epoch.- Parameters:
frequency
- the frequency of epoch to print out
-
-
Method Details
-
onEpoch
Listens to the end of an epoch during training.- Specified by:
onEpoch
in interfaceTrainingListener
- Parameters:
trainer
- the trainer the listener is attached to
-
onTrainingBatch
Listens to the end of training one batch of data during training.- Specified by:
onTrainingBatch
in interfaceTrainingListener
- Parameters:
trainer
- the trainer the listener is attached tobatchData
- the data from the batch
-
onValidationBatch
Listens to the end of validating one batch of data during validation.- Specified by:
onValidationBatch
in interfaceTrainingListener
- Parameters:
trainer
- the trainer the listener is attached tobatchData
- the data from the batch
-
onTrainingBegin
Listens to the beginning of training.- Specified by:
onTrainingBegin
in interfaceTrainingListener
- Parameters:
trainer
- the trainer the listener is attached to
-
onTrainingEnd
Listens to the end of training.- Specified by:
onTrainingEnd
in interfaceTrainingListener
- Parameters:
trainer
- the trainer the listener is attached to
-