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

Add logger state dumping and restoring #13069

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

ashleve
Copy link
Contributor

@ashleve ashleve commented May 13, 2022

What does this PR do?

Implements state dumping and resuming mechanism for loggers.
Implements state_dict and load_state_dict() for tensorboard.

Related to #5342

This PR is a reimplementation of #6361

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 list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

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:

  • 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?

Always 🙃

@ashleve ashleve force-pushed the feature/logger-state-dumping branch from ddf3a3c to 8fb6e96 Compare May 18, 2022 23:04
@ashleve
Copy link
Contributor Author

ashleve commented May 19, 2022

Currently resuming tensorboard resets the logged step number #12274

@ashleve ashleve changed the title Feature: logger state dumping and resuming Add logger state dumping and restoring May 19, 2022
@ashleve
Copy link
Contributor Author

ashleve commented May 19, 2022

Could anyone help with the tests?

I can't explain why the pickling is failing.

Also not sure how to fix the hooks related tests from tests/models/test_hooks.py.

@ashleve ashleve mentioned this pull request May 19, 2022
11 tasks
@carmocca carmocca added feature Is an improvement or enhancement logger Related to the Loggers checkpointing Related to checkpointing community This PR is from the community labels May 24, 2022
@carmocca carmocca added this to the 1.7 milestone May 24, 2022
Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Hi @ashleve!

I can't explain why the pickling is failing.

Several existing tests pass mocks as logger instances for simplicity. Since this PR adds support for serializing their state, the logger.state_dict() of a mock logger returns another mock wich cannot be serialized. The existing tests will need to be updated to not use mocks or you will have to do: mock_logger.state_dict.return_value = {}

Also not sure how to fix the hooks related tests from tests/models/test_hooks.py.

These tests check for the order of all hook calls, including their arguments. You probably need to update the "saved_ckpt" argument to include a logger key: https://github.com/PyTorchLightning/pytorch-lightning/blob/fbd887df9d487da4c57d884e01b3401af140b1bc/tests/models/test_hooks.py#L494-L503

I will assign Adrian as the main reviewer of the PR, but you can also ask me anything if you need support. Either here or in Slack.

Thank you for your work!

@ashleve ashleve requested a review from carmocca July 15, 2022 14:27
@carmocca carmocca modified the milestones: pl:1.7, pl:1.8 Jul 19, 2022
@Borda
Copy link
Member

Borda commented Sep 22, 2022

@carmocca, how is it going here? 🦦

@carmocca carmocca modified the milestones: v1.8, v1.9 Oct 13, 2022
@carmocca
Copy link
Contributor

carmocca commented Nov 8, 2022

@awaelchli It would be nice to finish it. Since you are familiar with the state key, do you want to take it? Otherwise I will. Not a high priority of course.

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Nov 14, 2022
@mergify mergify bot removed the has conflicts label Nov 14, 2022
Copy link

gitguardian bot commented Jan 16, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
- Generic High Entropy Secret 78fa3af tests/tests_app/utilities/test_login.py View secret
- Base64 Basic Authentication 78fa3af tests/tests_app/utilities/test_login.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@carmocca carmocca removed their assignment Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checkpointing Related to checkpointing community This PR is from the community feature Is an improvement or enhancement has conflicts logger Related to the Loggers pl Generic label for PyTorch Lightning package
Projects
No open projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants