CSVLogger¶
- class pytorch_lightning.loggers.CSVLogger(save_dir, name='lightning_logs', version=None, prefix='', flush_logs_every_n_steps=100)[source]¶
Bases:
pytorch_lightning.loggers.logger.Logger
,lightning_fabric.loggers.csv_logs.CSVLogger
Log to local file system in yaml and CSV format.
Logs are saved to
os.path.join(save_dir, name, version)
.Example
>>> from pytorch_lightning import Trainer >>> from pytorch_lightning.loggers import CSVLogger >>> logger = CSVLogger("logs", name="my_exp_name") >>> trainer = Trainer(logger=logger)
- Parameters:
name¶ (
str
) – Experiment name. Defaults to'lightning_logs'
.version¶ (
Union
[int
,str
,None
]) – Experiment version. If version is not specified the logger inspects the save directory for existing versions, then automatically assigns the next available version.prefix¶ (
str
) – A string to put at the beginning of metric keys.flush_logs_every_n_steps¶ (
int
) – How often to flush logs to disk (defaults to every 100 steps).
- property experiment: lightning_fabric.loggers.csv_logs._ExperimentWriter¶
Actual _ExperimentWriter object. To use _ExperimentWriter features in your
LightningModule
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 ofNone
or an int.