Shortcuts

csv_logs

Classes

CSVLogger

Log to local file system in yaml and CSV format.

ExperimentWriter

Experiment writer for CSVLogger.

CSV logger

CSV logger for basic experiment logging that does not require opening ports

class lightning.pytorch.loggers.csv_logs.CSVLogger(save_dir, name='lightning_logs', version=None, prefix='', flush_logs_every_n_steps=100)[소스]

기반 클래스: lightning.pytorch.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).

예제

>>> from lightning.pytorch import Trainer
>>> from lightning.pytorch.loggers import CSVLogger
>>> logger = CSVLogger("logs", name="my_exp_name")
>>> trainer = Trainer(logger=logger)
매개변수
  • save_dir (Union[str, Path]) – Save directory

  • 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).

log_hyperparams(params)[소스]

Record hyperparameters.

매개변수
  • params (Union[Dict[str, Any], Namespace]) – Namespace or Dict containing the hyperparameters

  • args – Optional positional arguments, depends on the specific logger being used

  • kwargs – Optional keyword arguments, depends on the specific logger being used

반환 형식

None

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()
반환 형식

_ExperimentWriter

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.

반환 형식

str

property root_dir: str

Parent directory for all checkpoint subdirectories.

If the experiment name parameter is an empty string, no experiment subdirectory is used and the checkpoint will be saved in “save_dir/version”

반환 형식

str

property save_dir: str

The current directory where logs are saved.

반환 형식

str

반환

The path to current directory where logs are saved.

class lightning.pytorch.loggers.csv_logs.ExperimentWriter(log_dir)[소스]

기반 클래스: lightning.fabric.loggers.csv_logs._ExperimentWriter

Experiment writer for CSVLogger.

Currently, supports to log hyperparameters and metrics in YAML and CSV format, respectively.

매개변수

log_dir (str) – Directory for the experiment logs

log_hparams(params)[소스]

Record hparams.

반환 형식

None

save()[소스]

Save recorded hparams and metrics into files.

반환 형식

None