logger — PyTorch Lightning 2.5.1.post0 documentation (original) (raw)

Functions

merge_dicts Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function.

Classes

DummyLogger Dummy logger for internal use.
Logger Base class for experiment loggers.

Abstract base class used to build new loggers.

class lightning.pytorch.loggers.logger.DummyLogger[source]

Bases: Logger

Dummy logger for internal use.

It is useful if we want to disable user’s logger for a feature, but still ensure that user code can run

log_hyperparams(*args, **kwargs)[source]

Record hyperparameters.

Parameters:

Return type:

None

log_metrics(*args, **kwargs)[source]

Records metrics. This method logs metrics as soon as it received them.

Parameters:

Return type:

None

property experiment_: _DummyExperiment_

Return the experiment object associated with this logger.

property name_: str_

Return the experiment name.

property version_: str_

Return the experiment version.

class lightning.pytorch.loggers.logger.Logger[source]

Bases: Logger, ABC

Base class for experiment loggers.

after_save_checkpoint(checkpoint_callback)[source]

Called after model checkpoint callback saves a new checkpoint.

Parameters:

checkpoint_callback (ModelCheckpoint) – the model checkpoint callback instance

Return type:

None

property save_dir_: Optional[str]_

Return the root directory where experiment logs get saved, or None if the logger does not save data locally.

lightning.pytorch.loggers.logger.merge_dicts(dicts, agg_key_funcs=None, default_func=)[source]

Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function.

Parameters:

Return type:

dict

Returns:

Dictionary with merged values.

Examples

import pprint d1 = {'a': 1.7, 'b': 2.0, 'c': 1, 'd': {'d1': 1, 'd3': 3}} d2 = {'a': 1.1, 'b': 2.2, 'v': 1, 'd': {'d1': 2, 'd2': 3}} d3 = {'a': 1.1, 'v': 2.3, 'd': {'d3': 3, 'd4': {'d5': 1}}} dflt_func = min agg_funcs = {'a': statistics.mean, 'v': max, 'd': {'d1': sum}} pprint.pprint(merge_dicts([d1, d2, d3], agg_funcs, dflt_func)) {'a': 1.3, 'b': 2.0, 'c': 1, 'd': {'d1': 3, 'd2': 3, 'd3': 3, 'd4': {'d5': 1}}, 'v': 2.3}