Package ai.djl.training.listener
Class TimeMeasureTrainingListener
- java.lang.Object
-
- ai.djl.training.listener.TrainingListenerAdapter
-
- ai.djl.training.listener.TimeMeasureTrainingListener
-
- All Implemented Interfaces:
TrainingListener
public class TimeMeasureTrainingListener extends TrainingListenerAdapter
TrainingListener
that outputs the training time metrics after training is done.The training time data is placed in the file "$outputDir/training.log" and the validation data is placed in "$outputDir/validate.log".
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ai.djl.training.listener.TrainingListener
TrainingListener.BatchData, TrainingListener.Defaults
-
-
Constructor Summary
Constructors Constructor Description TimeMeasureTrainingListener(java.lang.String outputDir)
Constructs aTimeMeasureTrainingListener
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onEpoch(Trainer trainer)
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
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.-
Methods inherited from class ai.djl.training.listener.TrainingListenerAdapter
onTrainingBegin
-
-
-
-
Constructor Detail
-
TimeMeasureTrainingListener
public TimeMeasureTrainingListener(java.lang.String outputDir)
Constructs aTimeMeasureTrainingListener
.- Parameters:
outputDir
- the directory to output the tracked timing data in
-
-
Method Detail
-
onEpoch
public void onEpoch(Trainer trainer)
Listens to the end of an epoch during training.- Specified by:
onEpoch
in interfaceTrainingListener
- Overrides:
onEpoch
in classTrainingListenerAdapter
- 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:
onTrainingBatch
in interfaceTrainingListener
- Overrides:
onTrainingBatch
in classTrainingListenerAdapter
- 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:
onValidationBatch
in interfaceTrainingListener
- Overrides:
onValidationBatch
in classTrainingListenerAdapter
- Parameters:
trainer
- the trainer the listener is attached tobatchData
- the data from the batch
-
onTrainingEnd
public void onTrainingEnd(Trainer trainer)
Listens to the end of training.- Specified by:
onTrainingEnd
in interfaceTrainingListener
- Overrides:
onTrainingEnd
in classTrainingListenerAdapter
- Parameters:
trainer
- the trainer the listener is attached to
-
-