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

Implement _compute_intra_grad_corr_mean for gradient computation #1095

Merged
merged 13 commits into from
Dec 5, 2022

Conversation

cyugao
Copy link
Contributor

@cyugao cyugao commented Dec 2, 2022

What does this PR do?

Implement _compute_intra_grad_corr_mean and tests
This utility function can be helpful for analyzing learning behavior.

Before submitting

  • Did you have fun?
    • Make sure you had fun coding 🙃
  • Did you read the contributor guideline?
  • Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
    • N/A
  • Did you make sure to update the docs?
    • N/A
  • Did you write any new necessary tests?
    • N/A
  • Did you update the changelog? (if needed)
    • N/A

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.

cyugao and others added 6 commits October 4, 2022 14:24
Add ``is_scaled_loss`` flag to support both scaled / unscaled loss
Fix ``test_grad_accum`` and``test_set_num_gradients_to_accumulate``
- Revert the changes in `step` method
- Add a method `scale_grad_by_num_grads_to_accum`to handle gradient accumulation using unscaled loss more explicitly
- Add gradient tests
@cyugao cyugao requested a review from min-xu-ai December 2, 2022 22:49
@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 Dec 2, 2022
.circleci/config.yml Outdated Show resolved Hide resolved
@@ -449,6 +487,9 @@ def _final_callback(self) -> None:
return

# Since self._local_grad_sqr is FP32, sum shouldn't overflow.

# TODO: Hongbo says param.grad might be FP16 should do this before converting to FP32.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bit too sparse. Maybe you can expand this and provide more context?

requirements-dev.txt Outdated Show resolved Hide resolved
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.

Thanks for working on this! I left some comments. If you need help on the CI errors, let me know. The code is in general very clean.

@min-xu-ai min-xu-ai merged commit 99edeff into facebookresearch:main Dec 5, 2022
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