-
Notifications
You must be signed in to change notification settings - Fork 535
Adds CombinedOptimizer
#1241
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
base: main
Are you sure you want to change the base?
Adds CombinedOptimizer
#1241
Conversation
Greptile OverviewGreptile SummaryAdds Critical Issue Found:
Recommendations:
Important Files ChangedFile Analysis
|
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.
3 files reviewed, 2 comments
coreyjadams
left a comment
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.
Overall, looks good. I appreciate extensive testing.
This adds a new package, physicsnemo.optim, which I think is overdue. As part of the refactor let's make sure to get it in the docs too :).
I left some comments but do have another question. What happens when users instantiate and use this and the parameter groups are not disjoint? Will it cause an error? Silent bugs? Should we include a check that each parameter group is completely disjoint?
80162f9 to
e4b7be2
Compare
This commit introduces a new documentation file for the PhysicsNeMo Optim module, detailing its purpose and functionality. The documentation includes an overview of the CombinedOptimizer class, which allows the integration of multiple PyTorch optimizers into a single interface, enhancing flexibility in training physics-informed machine learning models.
This update modifies the CombinedOptimizer class to ensure that parameter groups are disjoint. A ValueError is now raised if any parameter appears in multiple optimizers, preventing potential issues during optimization. Additionally, a new test case has been added to verify this behavior.
This commit introduces a new test case in `test_combined_optimizer.py` to verify that saving and restoring the optimizer state using `state_dict` preserves numerical accuracy. The test checks that the parameter updates remain consistent before and after loading the state, ensuring the integrity of the optimizer's internal state across training sessions.
This commit updates the tests for the `zero_grad` method in `test_combined_optimizer.py`. The test for `set_to_none=True` is renamed for clarity and now asserts that gradients are set to None. A new test for `set_to_none=False` is added to verify that gradients are set to zero, ensuring comprehensive coverage of the `zero_grad` functionality.
|
/blossom-ci |
|
/blossom-ci |
|
/blossom-ci |
megnvidia
left a comment
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.
looks good to me. Doc approval given.
PhysicsNeMo Pull Request
Adds a new
CombinedOptimizerutility, which is useful for the increasingly-popular "architecture-aware optimizers", such as Muon.This PR targets the v2.0 refactor branch, so this should only be merged after #1235 .
Description
Checklist
Dependencies
Review Process
All PRs are reviewed by the PhysicsNeMo team before merging.
Depending on which files are changed, GitHub may automatically assign a maintainer for review.
We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.
AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.