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 pytorch_lightning.loggers.csv_logs.CSVLogger(save_dir, name='default', version=None, prefix='', flush_logs_every_n_steps=100)[source]

Bases: pytorch_lightning.loggers.base.LightningLoggerBase

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
  • save_dir (str) – Save directory

  • name (Optional[str]) – Experiment name. Defaults to 'default'.

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

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
  • params (Union[Dict[str, Any], Namespace]) – Namespace containing the hyperparameters

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

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

Return type

None

log_metrics(metrics, step=None)[source]

Records metrics. This method logs metrics as as soon as it received them. If you want to aggregate metrics for one specific step, use the agg_and_log_metrics() method.

Parameters
  • metrics (Dict[str, float]) – Dictionary with metric names as keys and measured quantities as values

  • step (Optional[int]) – Step number at which the metrics should be recorded

Return type

None

save()[source]

Save log data.

Return type

None

property experiment: pytorch_lightning.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()
Return type

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.

Return type

str

property name: str

Gets the name of the experiment.

Return type

str

Returns

The name of the experiment.

property root_dir: str

Parent directory for all checkpoint subdirectories.

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

Return type

str

property save_dir: Optional[str]

The current directory where logs are saved.

Return type

Optional[str]

Returns

The path to current directory where logs are saved.

property version: int

Gets the version of the experiment.

Return type

int

Returns

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

class pytorch_lightning.loggers.csv_logs.ExperimentWriter(log_dir)[source]

Bases: object

Experiment writer for CSVLogger.

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

Parameters

log_dir (str) – Directory for the experiment logs

log_hparams(params)[source]

Record hparams.

Return type

None

log_metrics(metrics_dict, step=None)[source]

Record metrics.

Return type

None

save()[source]

Save recorded hparams and metrics into files.

Return type

None

Read the Docs v: latest
Versions
latest
stable
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.8
1.3.7
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.10
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.10.0
0.9.0
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.3
0.4.9
ipynb-update
docs-search
Downloads
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.