progress_bar_logger#

Logs metrics to the console and show a progress bar.

Classes

ProgressBarLogger

Log metrics to the console and optionally show a progress bar.

class composer.loggers.progress_bar_logger.ProgressBarLogger(progress_bar=True, log_to_console=None, console_log_level=LogLevel.EPOCH, stream=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>)[source]#

Bases: composer.loggers.logger_destination.LoggerDestination

Log metrics to the console and optionally show a progress bar.

Note

This logger is automatically instainatied by the trainer via the progress_bar, log_to_console, log_level, and console_stream options. This logger does not need to be created manually.

TQDM is used to display progress bars.

During training, the progress bar logs the batch and training loss. During validation, the progress bar logs the batch and validation accuracy.

Example progress bar output:

Epoch 1: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]
Epoch 1 (val): 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]
Parameters
  • progress_bar (bool, optional) โ€“ Whether to show a progress bar. (default: True)

  • log_to_console (bool, optional) โ€“

    Whether to print logging statements to the console. (default: None)

    The default behavior (when set to None) only prints logging statements when progress_bar is False.

  • console_log_level (LogLevel | str | (State, LogLevel) -> bool, optional) โ€“

    The maximum log level for which statements should be printed. (default: LogLevel.EPOCH)

    It can either be LogLevel, a string corresponding to a LogLevel, or a callable that takes the training State and the LogLevel and returns a boolean of whether this statement should be printed.

    This parameter has no effect if log_to_console is False or is unspecified when progress_bar is True.

  • stream (str | TextIO, optional) โ€“ The console stream to use. If a string, it can either be 'stdout' or 'stderr'. (default: sys.stderr)

log_to_console(log_str)[source]#

Logs to the console, avoiding interleaving with a progress bar.