Class LoggingTrainingListener

java.lang.Object
ai.djl.training.listener.LoggingTrainingListener
All Implemented Interfaces:
TrainingListener

public class LoggingTrainingListener extends Object implements TrainingListener
TrainingListener that outputs the progress of training each batch and epoch into logs.
See Also:
  • Constructor Details

    • LoggingTrainingListener

      public LoggingTrainingListener()
      Constructs a LoggingTrainingListener instance.
    • LoggingTrainingListener

      public LoggingTrainingListener(int frequency)
      Constructs a LoggingTrainingListener instance with specified steps.

      Print out logs every frequency epoch.

      Parameters:
      frequency - the frequency of epoch to print out
  • Method Details

    • onEpoch

      public void onEpoch(Trainer trainer)
      Listens to the end of an epoch during training.
      Specified by:
      onEpoch in interface TrainingListener
      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 interface TrainingListener
      Parameters:
      trainer - the trainer the listener is attached to
      batchData - 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 interface TrainingListener
      Parameters:
      trainer - the trainer the listener is attached to
      batchData - the data from the batch
    • onTrainingBegin

      public void onTrainingBegin(Trainer trainer)
      Listens to the beginning of training.
      Specified by:
      onTrainingBegin in interface TrainingListener
      Parameters:
      trainer - the trainer the listener is attached to
    • onTrainingEnd

      public void onTrainingEnd(Trainer trainer)
      Listens to the end of training.
      Specified by:
      onTrainingEnd in interface TrainingListener
      Parameters:
      trainer - the trainer the listener is attached to