You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(pt_expt): share learned descriptors across bridged energy heads - #6152
A DPA4C bulk head and a short-range ZBL head can now use the same shared_dict descriptor in pt_expt. The multi-task wrapper asks each head for its descriptor. A linear composition used to look for it on the parent atomic model, which has none.
Resolve the descriptor on the unique learned child. This works in either child order and keeps the analytical potential and fitting heads local to their respective tasks. Compositions with multiple learned children have no unambiguous descriptor. This addresses the DPA4C part of #6148. DPA4 still needs its own weight-sharing implementation.
The tests cover both task orders and two bridged heads. They check parameter identity, per-head energy and forces against independently parameterized models, and accumulated gradients against the sum of the two reference gradients. After the upstream change to the contact clamp, the Linux regression suites passed 37 tests (4 skipped). With the contact statistics fixed in evaluation mode, central differences at 0.4, 0.65 and 1.1 Å agreed with eager PyTorch on an RTX 4060 Laptop GPU to within 1.5e-7 for a Cartesian force component and 4.3e-10 for a directional weight derivative across both heads. Linux regression and finite-difference checks
Codex assisted with implementation, testing, and this write-up.
Summary by CodeRabbit
New Features
Linear bridged models can provide their learned descriptor when exactly one is available.
Multitask models support shared descriptors across none and zbl bridging combinations, with consistent energy, force, and gradient results.
Bug Fixes
Linear bridged models with multiple learned descriptors now report an error rather than selecting an ambiguous descriptor.
No actionable comments were generated in the recent review.
Walkthrough
LinearEnergyModel now returns the descriptor of its unique DPAtomicModel child and raises AttributeError when the child is not unique. Tests cover descriptor sharing across bridged heads, compare energies, forces, and shared-parameter gradients with independent references, and check descriptor selection across child orderings.
Changes: Linear Bridging Descriptor
Layer / File(s)
Summary
Select the unique learned descriptor deepmd/pt_expt/model/dp_linear_model.py
Adds get_descriptor(). It returns the descriptor of the sole DPAtomicModel child in atomic_model.models, or raises AttributeError when the child is not unique.
Validate descriptor sharing across bridged heads source/tests/pt_expt/model/test_dpa4c_zbl_bridging.py
Adds tests for three none/zbl bridging combinations. The tests compare head energies and forces with independent references and check shared-parameter gradients. They also test descriptor selection across child orderings and the non-unique case.
deepmodeling/deepmd-kit issue 6148: The changes address the unique-descriptor lookup failure for DPA4C bridging. The issue also notes that DPA4 descriptor sharing remains unimplemented.
Suggested reviewers:outisli, wanghan-iapcm
Merge Risk: Minimal · up to 21a92
This adds descriptor lookup for linear-composed energy models, so a DPA4C head and a ZBL head can share a descriptor. No concrete merge-blocking risk was identified in the supplied change.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: sharing learned descriptors across bridged energy heads in pt_expt. The raw summary shows a new get_descriptor() method that selects the unique learned descriptor chil…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title names the main change: sharing learned descriptors across bridged energy heads in pt_expt. The raw summary shows a new get_descriptor() method that selects the unique learned descriptor child of a linear model, and tests for shared descriptor identity across none/zbl bridging combinations. The title is specific and matches the changeset. It uses a conventional type(scope) prefix and is 68 characters long.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A DPA4C bulk head and a short-range ZBL head can now use the same
shared_dictdescriptor inpt_expt. The multi-task wrapper asks each head for its descriptor. A linear composition used to look for it on the parent atomic model, which has none.Resolve the descriptor on the unique learned child. This works in either child order and keeps the analytical potential and fitting heads local to their respective tasks. Compositions with multiple learned children have no unambiguous descriptor. This addresses the DPA4C part of #6148. DPA4 still needs its own weight-sharing implementation.
The tests cover both task orders and two bridged heads. They check parameter identity, per-head energy and forces against independently parameterized models, and accumulated gradients against the sum of the two reference gradients. After the upstream change to the contact clamp, the Linux regression suites passed 37 tests (4 skipped). With the contact statistics fixed in evaluation mode, central differences at 0.4, 0.65 and 1.1 Å agreed with eager PyTorch on an RTX 4060 Laptop GPU to within 1.5e-7 for a Cartesian force component and 4.3e-10 for a directional weight derivative across both heads. Linux regression and finite-difference checks
Codex assisted with implementation, testing, and this write-up.
Summary by CodeRabbit
noneandzblbridging combinations, with consistent energy, force, and gradient results.