CSVLogger — lightning 2.5.1.post0 documentation (original) (raw)

class lightning.fabric.loggers.CSVLogger(root_dir, name='lightning_logs', version=None, prefix='', flush_logs_every_n_steps=100)[source]

Bases: Logger

Log to the local file system in CSV format.

Logs are saved to os.path.join(root_dir, name, version).

Parameters:

Example:

from lightning.fabric.loggers import CSVLogger

logger = CSVLogger("path/to/logs/root", name="my_model") logger.log_metrics({"loss": 0.235, "acc": 0.75}) logger.finalize("success")

finalize(status)[source]

Do any processing that is necessary to finalize an experiment.

Parameters:

status (str) – Status that the experiment finished with (e.g. success, failed, aborted)

Return type:

None

log_hyperparams(params)[source]

Record hyperparameters.

Parameters:

Return type:

None

log_metrics(metrics, step=None)[source]

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

Parameters:

Return type:

None

save()[source]

Save log data.

Return type:

None

property experiment_: _ExperimentWriter_

Actual ExperimentWriter object. To use ExperimentWriter features anywhere in your code, do the following.

Example:

self.logger.experiment.some_experiment_writer_function()

property log_dir_: str_

The log directory for this run.

By default, it is named 'version_${self.version}' but it can be overridden by passing a string value for the constructor’s version parameter instead of None or an int.

property name_: str_

Gets the name of the experiment.

Returns:

The name of the experiment.

property root_dir_: str_

Gets the save directory where the versioned CSV experiments are saved.

property version_: Union[int, str]_

Gets the version of the experiment.

Returns:

The version of the experiment if it is specified, else the next version.