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

[SDP][Minor] Removing an assert which does not seem always accurate #625

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

blefaudeux
Copy link
Contributor

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
  • Did you read the contributor guideline?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes https://fb.workplace.com/groups/pytorchLightning/permalink/1432835657052968/
I'm not super clear on why this happens, but the general thinking is that this was a hard guard on not loosing any gradient, and actually the user may want to do to whatever (like, but may not be all of it: no_sync()fw/bw, then .eval()).
Keep the warning so that it's somewhat visible

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 22, 2021
return is_bn and not isinstance(
module, tuple(default_auto_wrap_policy.EXCLUDE_WRAP_MODULES)
) # type: ignore
return is_bn and not isinstance(module, tuple(default_auto_wrap_policy.EXCLUDE_WRAP_MODULES)) # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unrelated, but master linting was broken because of that

Copy link
Contributor

@min-xu-ai min-xu-ai left a comment

Choose a reason for hiding this comment

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

warning makes sense.

@@ -288,6 +288,14 @@ def test_train_eval_change():
dist.destroy_process_group()


def test_train_eval_change():
world_size = 4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

making the test case truly distributed, but still not seeing the issue which was reported in a somewhat similar situation. My guess is that there are some changes on the lightning side which make it a little more than just .train()/.eval(), but crashing on users is probably not a good idea in that case. Worst case is a lost step() worth of gradients

@blefaudeux blefaudeux merged commit 85962b9 into master Apr 22, 2021
@blefaudeux blefaudeux deleted the sdp_lost_grads branch April 22, 2021 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants