composer.core.logging.logger#
Base classes, functions, and variables for logger.
- composer.core.logging.logger.TLogDataValue#
Data value(s) to be logged. Can be any of the following types:
str
;float
;int
;torch.Tensor
;Sequence[TLogDataValue]
;Mapping[str, TLogDataValue]
.
- composer.core.logging.logger.TLogData#
Name-value pair for data to be logged. Type
Mapping[str, TLogDataValue]
. Example:{"accuracy", 21.3}
.
Functions
Recursively formats a given log data value into a string. |
Classes
LogLevel denotes when in the training loop log messages are generated. |
|
Logger routes metrics to the |
Attributes
- class composer.core.logging.logger.LogLevel(value)[source]#
Bases:
enum.IntEnum
LogLevel denotes when in the training loop log messages are generated.
Logging destinations use the LogLevel to determine whether to record a given metric or state change.
- FIT#
Logged once per training run.
- EPOCH#
Logged once per epoch.
- BATCH#
Logged once per batch.
- class composer.core.logging.logger.Logger(state, backends=())[source]#
Logger routes metrics to the
LoggerCallback
. Logger is what users call from within algorithms/callbacks. A logger routes the calls/data to any different number of destinationLoggerCallback
s (e.g.,FileLogger
,InMemoryLogger
, etc.). Data to be logged should be of the typeTLogData
(i.e., a{<name>: <value>}
mapping).- Parameters
backends (Sequence[LoggerCallback]) โ A sequence of
LoggerCallback
s to which logging calls will be sent.
- backends#
A sequence of
LoggerCallback
s to which logging calls will be sent.- Type
Sequence[LoggerCallback]
- metric(log_level, data)[source]#
Log a metric to the
backends
.- Parameters
data (Union[TLogData, Callable[[], TLogData]]) โ Can be either logging data or a callable that returns data to be logged. Callables will be invoked only when
will_log()
returns True for at least oneLoggerCallback
. Useful when it is expensive to generate the data to be logged.