Skip to content
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

Fix TensorBoardLogger creating redundant experiment when finalizing #14762

Merged
merged 5 commits into from
Sep 18, 2022

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Sep 17, 2022

What does this PR do?

Unblocks #12292, as I found a bug while helping out there.

The newly added test in test_tensorboard.py illustrates the issue: When nothing is logged, no experiment exists, but the call to finalize() would create a new experiment, then close it immediately again, leaving useless summary files behind.
This PR changes this to only flush/close or create directories when an experiment actually exists. This is consistent with all other loggers.

Does your PR introduce any breaking changes? If yes, please list them.

I don't think so. This was a peculiar edge case I can't believe anyone would need to rely on for a serious use case.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

I made sure I had fun coding 🙃

cc @Borda @awaelchli @edward-io @rohitgr7 @akihironitta

@awaelchli awaelchli self-assigned this Sep 17, 2022
@awaelchli awaelchli added bug Something isn't working logger: tensorboard labels Sep 17, 2022
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Sep 17, 2022
@awaelchli awaelchli added this to the pl:1.7.x milestone Sep 17, 2022
Copy link
Contributor

@krshrimali krshrimali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @awaelchli ! 2 minor nits (needed before merging I guess) and a small question (this question shouldn't block merging this PR), otherwise LGTM. 🚀

src/pytorch_lightning/CHANGELOG.md Outdated Show resolved Hide resolved
tests/tests_pytorch/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
@mergify mergify bot added the ready PRs ready to be merged label Sep 18, 2022
@awaelchli awaelchli merged commit 4f9c779 into master Sep 18, 2022
@awaelchli awaelchli deleted the bugfix/fix-tb-finalize branch September 18, 2022 20:27
kaushikb11 pushed a commit that referenced this pull request Sep 21, 2022
carmocca pushed a commit that referenced this pull request Sep 21, 2022
carmocca pushed a commit that referenced this pull request Sep 21, 2022
lexierule pushed a commit that referenced this pull request Sep 22, 2022
rohitgr7 pushed a commit that referenced this pull request Sep 24, 2022
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: tensorboard pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants