-
Notifications
You must be signed in to change notification settings - Fork 584
breaking: seperate params in dpa2 #3768
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
Conversation
WalkthroughWalkthroughThe updates encompass a significant restructuring in the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Additional comments not posted (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 4
Out of diff range and nitpick comments (2)
deepmd/dpmodel/descriptor/dpa2.py (1)
Line range hint
308-699: TheDescrptDPA2class effectively integrates the newRepinitArgsandRepformerArgsclasses. The methodinit_subclass_paramsis a robust way to handle different types of input for initialization parameters. However, there are a few areas that could be improved:
- The error message in
init_subclass_paramscould be more descriptive about what was received versus what was expected.- The method
callis quite complex and could benefit from further decomposition or at least more detailed inline comments to improve readability.- The serialization and deserialization methods are crucial and should be accompanied by comprehensive unit tests to ensure their correctness, especially given their complexity.
deepmd/utils/argcheck.py (1)
Line range hint
621-675: Refactor thedescrpt_dpa2_argsfunction to improve readability and maintainability.- # repinit args - doc_repinit = "The arguments used to initialize the repinit block." - # repformer args - doc_repformer = "The arguments used to initialize the repformer block." - # descriptor args - doc_concat_output_tebd = ( - "Whether to concat type embedding at the output of the descriptor." - ) - doc_precision = f"The precision of the embedding net parameters, supported options are {list_to_doc(ACTIVATION_FN_DICT.keys())} Default follows the interface precision." - doc_smooth = ( - "Whether to use smoothness in processes such as attention weights calculation." - ) - doc_exclude_types = "The excluded pairs of types which have no interaction with each other. For example, `[[0, 1]]` means no interaction between type 0 and type 1." - doc_env_protection = "Protection parameter to prevent division by zero errors during environment matrix calculations. For example, when using paddings, there may be zero distances of neighbors, which may make division by zero error during environment matrix calculations without protection." - doc_trainable = "If the parameters in the embedding net is trainable." - doc_seed = "Random seed for parameter initialization." - doc_add_tebd_to_repinit_out = "Add type embedding to the output representation from repinit before inputting it into repformer." + doc_repinit = "Initialize the repinit block with these arguments." + doc_repformer = "Initialize the repformer block with these arguments." + doc_concat_output_tebd = "Concatenate type embedding at the descriptor's output." + doc_precision = f"Define the precision of the embedding net parameters. Supported options are {list_to_doc(ACTIVATION_FN_DICT.keys())}. The default is the interface's precision." + doc_smooth = "Apply smoothness in processes like attention weights calculation." + doc_exclude_types = "Define pairs of types with no interaction, e.g., `[[0, 1]]` for no interaction between type 0 and type 1." + doc_env_protection = "Set a protection parameter to avoid division by zero errors during environment matrix calculations, useful when using paddings." + doc_trainable = "Specify if the embedding net's parameters are trainable." + doc_seed = "Set the random seed for parameter initialization." + doc_add_tebd_to_repinit_out = "Add type embedding to the repinit output before passing it to repformer."This refactoring simplifies the documentation strings and makes them more direct and easier to understand.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #3768 +/- ##
==========================================
+ Coverage 82.46% 82.49% +0.02%
==========================================
Files 515 515
Lines 48550 48633 +83
Branches 2979 2979
==========================================
+ Hits 40036 40118 +82
- Misses 7603 7604 +1
Partials 911 911 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 4
Out of diff range and nitpick comments (7)
source/tests/pt/model/test_rot_denoise.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theRotDenoiseTestclass and its methods to improve maintainability.source/tests/pt/model/test_smooth_denoise.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theSmoothDenoiseTestclass and its methods to improve maintainability.source/tests/pt/model/test_trans.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theTransTestclass and its methods to improve maintainability.source/tests/pt/model/test_jit.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theJITTestclass and its methods to improve maintainability.source/tests/pt/model/test_rot.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theRotTestclass and its methods to improve maintainability.source/tests/pt/model/test_smooth.py (1)
Line range hint
14-14: Consider adding detailed docstrings to theSmoothTestclass and its methods to improve maintainability.source/tests/pt/model/test_permutation.py (1)
Line range hint
14-14: Consider adding detailed docstrings to thePermutationTestclass and its methods to improve maintainability.
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.
Actionable comments posted: 1
Out of diff range and nitpick comments (1)
source/tests/pt/model/test_unused_params.py (1)
44-52: Add more comments to explain the use of the computation graph in identifying contributing parameters.
njzjz
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.
Good. Just a question not related to this PR.
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.
Actionable comments posted: 2
Out of diff range and nitpick comments (4)
deepmd/pt/model/descriptor/dpa2.py (1)
85-88: Consider adding examples in the documentation forrepinitandrepformerparameters to illustrate the expected usage ofRepinitArgsandRepformerArgs.deepmd/dpmodel/descriptor/dpa2.py (3)
380-434: Initialization of descriptor blocks inDescrptDPA2is correctly implemented.Consider adding more detailed inline documentation to explain how
DescrptBlockSeAttenandDescrptBlockRepformersinteract with the rest of the descriptor components.
Line range hint
635-694: Serialization and deserialization methods inDescrptDPA2are comprehensive.Consider refactoring to improve maintainability by extracting repeated logic into helper functions.
Line range hint
688-745: Thecallmethod inDescrptDPA2is well-implemented and integrates smoothly with descriptor blocks.Consider refactoring to improve readability by splitting the method into smaller, more focused methods.
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced descriptor configuration with the introduction of `RepinitArgs` and `RepformerArgs` classes for more flexible and structured argument handling. - Improved JSON configuration structure for descriptors, aligning properties under `repinit` and `repformer` into nested objects for clarity. - **Refactor** - Updated the initialization process in the model to utilize the new argument classes, ensuring more robust setup. - Refactored argument checking functions to support the new class-based configuration. - **Documentation** - Streamlined and clarified documentation related to descriptor arguments to better align with the new configuration approach. - **Tests** - Extended testing suite to include new argument classes, enhancing test coverage and consistency checks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
RepinitArgsandRepformerArgsclasses for more flexible and structured argument handling.repinitandrepformerinto nested objects for clarity.Refactor
Documentation
Tests