class composer.Logger(state, destinations=None)[source]#

An interface to record training data.

The Trainer, instances of Callback, and instances of Algorithm invoke the logger to record data such as the epoch, training loss, and custom metrics as provided by individual callbacks and algorithms. This class does not store any data itself; instead, it routes all data to the destinations. Each destination (e.g. the FileLogger, InMemoryLogger) is responsible for storing the data itself (e.g. writing it to a file or storing it in memory).

  • state (State) โ€“ The training state.

  • destinations (LoggerDestination | Sequence[LoggerDestination], optional) โ€“ The logger destinations, to where logging data will be sent. (default: None)


A sequence of LoggerDestination to where logging calls will be sent.



file_artifact(log_level, artifact_name, file_path, *, overwrite=False)[source]#

Log file_path as an artifact named artifact_name.

Both file_path and artifact_name can be specified as format strings. See format_name_with_dist() for more information.

See also

Artifact Logging for notes for file artifact logging.

  • log_level (str | int | LogLevel) โ€“ The log level, which can be a name, value, or instance of LogLevel.

  • artifact_name (str) โ€“ A format string for the name of the artifact.

  • file_path (str | Path) โ€“ A format string for the file path.

  • overwrite (bool, optional) โ€“ Whether to overwrite an existing artifact with the same artifact_name. (default: False)


Determines if the logger has a destination which supports logging file artifacts.

Needed for checking if a model can be exported via this logger.


bool โ€“ Whether any of the destinations has supports file artifacts.