Logger
An abstract logger interface for logging metrics and other information.
minnt.Logger
log_audio
Log the given audio with the given label at the given epoch.
Parameters:
-
label(str) –The label of the logged audio.
-
audio(AnyArray) –The audio to log, represented as an array with any of the following shapes:
(L,)of(L, 1)for mono audio,(L, 2)for stereo audio.
If the sample values are floating-point numbers, they are expected to be in the
[-1, 1]range; otherwise, they are assumed to be in the[-32_768, 32_767]range. -
sample_rate(int) –The sample rate of the audio.
-
epoch(int) –The epoch number at which the audio is logged.
log_config
log_epoch
log_epoch(
logs: dict[str, float],
epoch: int,
epochs: int | None = None,
elapsed: float | None = None,
) -> Self
Log metrics collected during a given epoch.
Parameters:
-
logs(dict[str, float]) –A dictionary of logged metrics for the epoch.
-
epoch(int) –The epoch number at which the logs were collected.
-
epochs(int | None, default:None) –The total number of epochs, if known.
-
elapsed(float | None, default:None) –The time elapsed during the epoch, in seconds, if known.
log_figure
log_figure(
label: str,
figure: Any,
epoch: int,
tight_layout: bool = True,
close: bool = True,
) -> Self
Log the given matplotlib Figure with the given label at the given epoch.
Parameters:
-
label(str) –The label of the logged image.
-
figure(Any) –A matplotlib Figure.
-
epoch(int) –The epoch number at which the image is logged.
-
tight_layout(bool, default:True) –Whether to apply tight layout to the figure before logging it.
-
close(bool, default:True) –Whether to close the figure after logging it.
log_graph
log_graph(graph: Module, data: TensorOrTensors, epoch: int) -> Self
Log the given computation graph by tracing it with the given data.
Alternatively, loggers may choose to log the graph using TorchScript or other mechanisms.
Parameters:
-
graph(Module) –The computation graph to log, represented as a PyTorch module.
-
data(TensorOrTensors) –The input data to use for tracing the computation graph.
-
epoch(int) –The epoch number at which the computation graph is logged.
log_image
Log the given image with the given label at the given epoch.
Parameters:
-
label(str) –The label of the logged image.
-
image(AnyArray) –The image to log, represented as an array, which can have any of the following shapes:
(H, W)or(H, W, 1)for grayscale images,(H, W, 2)for grayscale images with alpha channel,(H, W, 3)for RGB images,(H, W, 4)for RGBA images.
If the pixel values are floating-point numbers, they are expected to be in the
[0, 1]range; otherwise, they are assumed to be in the[0, 255]range. -
epoch(int) –The epoch number at which the image is logged.