6.0 KiB
title |
---|
Logger |
The ClearML Logger class is used to report experiments' results such as metrics, graphs, and debug samples. It is provided through the ClearML Task object.
A Logger object is used to do the following:
- Manual reporting, complementing ClearML's automatic reporting
- Logging configuration
- Set upload destination for debug sample storage
- Control ClearML's automatic logging
- Set default NaN and Inf values
Types of Logged Results
ClearML supports four types of reports:
- Text - Mostly captured automatically from stdout and stderr but can be logged manually.
- Scalars - Time series data. X-axis is always a sequential number, usually iterations but can be epochs or others.
- Plots - General graphs and diagrams, such as histograms, confusion matrices, line plots, and custom plotly charts.
- Debug Samples - Images, audio, and videos. Can be reported per iteration.
Automatic Reporting
ClearML automatically captures metrics reported to leading visualization libraries, such as TensorBoard and Matplotlib, with no additional code necessary.
In addition, ClearML captures and logs everything written to standard output, from debug messages to errors to library warning messages.
GPU, CPU, Memory, and Network information is also automatically captured.
Supported Packages
Automatic Reporting Examples
Check out some of ClearML's automatic reporting examples for supported packages:
- TensorBoard
- TensorBoard PR Curve - logging TensorBoard outputs and TensorFlow flags
- TensorBoard Toy - logging TensorBoard histograms, scalars, images, text, and TensorFlow flags
- Tensorboard with PyTorch - logging TensorBoard scalars, debug samples, and text integrated into code that uses PyTorch
- TensorBoardX
- TensorBoardX with PyTorch - logging TensorBoardX scalars, debug samples, and text in code using PyTorch
- MegEngine MNIST - logging scalars using TensorBoardX's
SummaryWriter
- Matplotlib
- Matplotlib - logging scatter diagrams plotted with Matplotlib
- Matplotlib with PyTorch - logging debug images shown by Matplotlib
Manual Reporting
ClearML also supports manually reporting multiple types of metrics and plots, such as line plots, histograms, and even plotly charts.
The object used for reporting metrics is called logger and is obtained by calling Task.get_logger()
.
Media Reporting
ClearML also supports reporting media (such as audio, video and images) for every iteration. This section is mostly used for debugging. It's recommended to use artifacts for storing script outputs that would be used later on.
Only the last X results of each title / series are saved to prevent overloading the server.
See details in Logger.report_media
.
Explicit Reporting Examples
Check out ClearML's explicit reporting examples for various types of results:
- Text
- Scalars
- Plots
- 2d plots
- Histograms
- Confusion matrices
- Scatter plots
- 3d plots
- Surface plots
- Scatter plots
- Tables
- Pandas DataFrames
- CSV file
- Matplotlib figures
- Plotly figures
- 2d plots
- Debug Samples
- Explicit reporting in Jupyter Notebook example
Logger Configuration
The Logger class provides methods to control aspects of ClearML's logging.
Upload Destination
Set the default storage URI for uploading debug samples using the Logger.set_default_upload_destination
method.
The debug samples are uploaded separately. A link to each sample is reported.
:::note DESTINATION STORAGE CREDENTIALS Credentials for the destination storage are specified in the ClearML configuration file. :::
Automatic Logging Settings
The Logger class provides methods for fine-tuning ClearML's automatic logging behavior with Matplotlib and Tensorboard.
For example, use the Logger.matplotlib_force_report_non_interactive
class method to control how matplotlib objects are logged. See the Logger.tensorboard_auto_group_scalars
class method.
Set Default NaN and Inf Values
When you report metrics that include NaN or Inf values, ClearML logs them as 0
by default. You can specify
different default values for NaN and Inf using the Logger.set_reporting_nan_value
and the Logger.set_reporting_inf_value
class methods respectively.