-
Notifications
You must be signed in to change notification settings - Fork 516
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
breaking: seperate params in dpa2 #3768
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
: TheDescrptDPA2
class effectively integrates the newRepinitArgs
andRepformerArgs
classes. The methodinit_subclass_params
is 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_params
could be more descriptive about what was received versus what was expected.- The method
call
is 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_args
function 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 theRotDenoiseTest
class 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 theSmoothDenoiseTest
class and its methods to improve maintainability.source/tests/pt/model/test_trans.py (1)
Line range hint
14-14
: Consider adding detailed docstrings to theTransTest
class and its methods to improve maintainability.source/tests/pt/model/test_jit.py (1)
Line range hint
14-14
: Consider adding detailed docstrings to theJITTest
class and its methods to improve maintainability.source/tests/pt/model/test_rot.py (1)
Line range hint
14-14
: Consider adding detailed docstrings to theRotTest
class and its methods to improve maintainability.source/tests/pt/model/test_smooth.py (1)
Line range hint
14-14
: Consider adding detailed docstrings to theSmoothTest
class and its methods to improve maintainability.source/tests/pt/model/test_permutation.py (1)
Line range hint
14-14
: Consider adding detailed docstrings to thePermutationTest
class 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.
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 forrepinit
andrepformer
parameters to illustrate the expected usage ofRepinitArgs
andRepformerArgs
.deepmd/dpmodel/descriptor/dpa2.py (3)
380-434
: Initialization of descriptor blocks inDescrptDPA2
is correctly implemented.Consider adding more detailed inline documentation to explain how
DescrptBlockSeAtten
andDescrptBlockRepformers
interact with the rest of the descriptor components.
Line range hint
635-694
: Serialization and deserialization methods inDescrptDPA2
are comprehensive.Consider refactoring to improve maintainability by extracting repeated logic into helper functions.
Line range hint
688-745
: Thecall
method inDescrptDPA2
is 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
RepinitArgs
andRepformerArgs
classes for more flexible and structured argument handling.repinit
andrepformer
into nested objects for clarity.Refactor
Documentation
Tests