Skip to content

Deprecate save from the Logger Base API  #11676

@daniellepintz

Description

@daniellepintz

Proposed refactor

Deprecate save from LightningLoggerBase:
https://github.com/PyTorchLightning/pytorch-lightning/blob/a8ee5cacb7b31064c8b73372ca944d43f7caadc6/pytorch_lightning/loggers/base.py#L173-L175

Motivation

After #9145 save on the LightningLoggerBase does nothing, and only 2 loggers have implementations for it: CSVLogger and TensorboardLogger.

After #8991 we now consider flushing an internal implementation detail of the loggers, so it follows that save should also be an internal implementation detail of the loggers.

Currently the Trainer calls log_metrics and save together here:
https://github.com/PyTorchLightning/pytorch-lightning/blob/6bc0e1da6329c42ec3b7c6fbf91eb059b9124207/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py#L131-L132

Instead, the Trainer can just call log_metrics and the actual saving can be delegated completely to the logger, including buffering & flush frequency.

Pitch

in v1.6:

in v1.8:

  • For CSVLogger and TensorboardLogger their log_metrics and log_graph implementations should call save
  • Remove save from LightningLoggerBase

Additional Context

This was discussed in #9004

cc @justusschock @awaelchli @akihironitta @rohitgr7 @edward-io @Borda @ananthsub @kamil-kaczmarek @Raalsky @Blaizzy @tchaton

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions