-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate save
from the Logger Base API
#11676
Comments
Removing |
Hmm, sorry I'm not quite following why we would have to wait until |
@awaelchli @carmocca We didn't have time to finish discussing this one the other day but I just added more to the Motivation section. Please take a look when you get the chance. |
Looks good. One note though
Instead, I think the subclasses should keep the |
@carmocca sounds good! Updated the pitch |
Proposed refactor
Deprecate
save
fromLightningLoggerBase
:https://github.com/PyTorchLightning/pytorch-lightning/blob/a8ee5cacb7b31064c8b73372ca944d43f7caadc6/pytorch_lightning/loggers/base.py#L173-L175
Motivation
After #9145
save
on theLightningLoggerBase
does nothing, and only 2 loggers have implementations for it:CSVLogger
andTensorboardLogger
.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
andsave
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:
save
fromLightningLoggerBase
save
calls, only call ifsave
is overridden in the Logger:https://github.com/PyTorchLightning/pytorch-lightning/blob/6bc0e1da6329c42ec3b7c6fbf91eb059b9124207/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py#L132
https://github.com/PyTorchLightning/pytorch-lightning/blob/6bc0e1da6329c42ec3b7c6fbf91eb059b9124207/pytorch_lightning/trainer/trainer.py#L1241
https://github.com/PyTorchLightning/pytorch-lightning/blob/6bc0e1da6329c42ec3b7c6fbf91eb059b9124207/pytorch_lightning/loops/epoch/training_epoch_loop.py#L508
(Note: the final
save
call above will be removed in v1.7 following the removal offlush_logs_every_n_steps
)in v1.8:
CSVLogger
andTensorboardLogger
theirlog_metrics
andlog_graph
implementations should callsave
save
fromLightningLoggerBase
Additional Context
This was discussed in #9004
cc @justusschock @awaelchli @akihironitta @rohitgr7 @edward-io @Borda @ananthsub @kamil-kaczmarek @Raalsky @Blaizzy @tchaton
The text was updated successfully, but these errors were encountered: