-
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
Trigger creation of lazy logger experiment in Trainer setup #17818
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awaelchli
added
bug
Something isn't working
logger: wandb
Weights & Biases
and removed
pl
Generic label for PyTorch Lightning package
labels
Jun 12, 2023
awaelchli
requested review from
carmocca,
justusschock and
williamFalcon
as code owners
June 12, 2023 18:00
for more information, see https://pre-commit.ci
carmocca
reviewed
Jun 12, 2023
carmocca
approved these changes
Jun 12, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a high confidence approval, but an approval nonetheless
Borda
approved these changes
Jun 14, 2023
Borda
pushed a commit
that referenced
this pull request
Jul 7, 2023
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit d4867cb)
lantiga
pushed a commit
that referenced
this pull request
Jul 10, 2023
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit d4867cb)
7 tasks
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
logger: wandb
Weights & Biases
pl
Generic label for PyTorch Lightning package
ready
PRs ready to be merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #17298
Explanation:
Some loggers have a lazy experiment creation, because their experiments are non-picklable. Thus, one should only call
logger.experiment
once we've spawned/forked processes. The trainer respects this requirement, but until the first logging call, for some loggers like WandbLogger properties likelogger.version
andlogger.name
remain undefined until the first call oflogger.experiment
. This is a problem for e.g. model checkpointing, when the checkpoint callback is resolving the log dir to put checkpoints in:https://github.com/Lightning-AI/lightning/blob/d75bfe5c387925d6b2297cdedd49055f93d6b4ef/src/lightning/pytorch/callbacks/model_checkpoint.py#L599-L600
Thus, I'm now introducing a triggering mechanism that ensures experiment attributes will always be available no earlier than when the setup hook gets called. Alternatively, we could also introduce a
lazy_init()
method on the logger base interface that we call at the same place in the trainer.The fix is not specific to wandb, applies to neptune as well, but it was reported with wandb.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist
cc @Borda @awaelchli @morganmcg1 @borisdayma @scottire @parambharat