Skip to main content

TrainingProgressLogger

Trait TrainingProgressLogger 

pub trait TrainingProgressLogger: Send {
    // Required methods
    fn start(
        &mut self,
        total_epochs: usize,
        starting_epoch: usize,
        total_items: Option<usize>,
        label: Option<&str>,
    );
    fn update_epoch(&mut self, epoch: usize);
    fn start_split(&mut self, split: &str, total_items: usize);
    fn update_split(&mut self, items_processed: usize);
    fn end_split(&mut self);
    fn end(&mut self);
    fn log_event_training(&mut self, event: String);
}
Expand description

Trait for logging training progress at each step and end of epoch.

§Call sequence

Implementors can expect the following sequence of calls for a complete training run:

start(total_epochs, total_items)
  for each epoch:
    start_split("train", total_items_train)
      update_split(items_processed)  // called once per batch
      ...
    end_split()
    start_split("valid", total_items_valid)
      update_split(items_processed)  // called once per batch
      ...
    end_split()
    update_epoch(epoch)
end()

end() is called whether training completes normally or is interrupted early.

Implementors are responsible for tracking total_items and epoch state in order to reconstruct the full progress picture when update_split is called.

Required Methods§

fn start( &mut self, total_epochs: usize, starting_epoch: usize, total_items: Option<usize>, label: Option<&str>, )

Called once at the start of training, providing the total number of epochs and the starting epoch.

The total number of items of the training can optionally be provided if it is known.

fn update_epoch(&mut self, epoch: usize)

Called at the end of each full epoch (after both train and valid splits complete).

fn start_split(&mut self, split: &str, total_items: usize)

Called at the start of a training split, providing the split name and total number of items.

fn update_split(&mut self, items_processed: usize)

Log the progress of the current training step.

fn end_split(&mut self)

Called at the end of a training split.

fn end(&mut self)

Called at the end of training, whether it completed successfully or was interrupted.

fn log_event_training(&mut self, event: String)

Log a custom named event that falls outside the standard training lifecycle callbacks.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§