Commit ccaa551
authored
feat(pt): Add DPA4/SeZM descriptor & model 🎉🎉🎉 (#5448)
## Summary
This PR adds PyTorch support for DPA4, the DeePMD-kit implementation of
SeZM (Smooth Equivariant Zone-bridging Model). It introduces the
DPA4/SeZM model, descriptor, fitting network, training integration,
export path, documentation, examples, and tests.
## Main Changes
- Add the DPA4/SeZM PyTorch model stack:
- `model.type: "dpa4"` / `"sezm"`
- `descriptor.type: "dpa4"` / `"sezm"`
- `fitting_net.type: "dpa4_ener"` / `"sezm_ener"`
- Implement the SO(3)-equivariant descriptor with edge-local SO(2)
convolutions, angular schedules, smooth radial envelopes,
attention/focus streams, and environment-seeded initial features.
- Add zone-bridging support for short-range analytical repulsion,
including ZBL coupling and descriptor-side short-range clamping.
- Add DPA4 training support for:
- conservative energy/force training through `loss.type: "ener"`
- experimental direct-force denoising through `loss.type: "dens"`
- spin models in the PyTorch backend
- shared-fitting multitask case FiLM conditioning
- LoRA fine-tuning and merged checkpoint export
- Add the DPA4 `.pt2` freeze/export path using AOTInductor for
checkpoints that cannot be represented by the regular TorchScript freeze
path.
- Add CLI, argcheck, validation, data-system, and inference integration
needed to route DPA4 configs and exported models correctly.
- Add water examples for standard DPA4, ZBL bridging, spin, DeNS,
multitask/shared-fitting, LoRA fine-tuning, and LAMMPS inference.
- Add official model documentation at `doc/model/dpa4.md`.
## Tests
This PR adds coverage for:
- DPA4/SeZM model and descriptor construction
- DPA4 aliases in model, descriptor, and fitting configuration
- SO(3)/SO(2) equivariance behavior
- conservative energy/force paths
- `torch.compile` eager/compiled consistency
- DPA4 `.pt2` export and DeepPot inference
- spin model behavior
- ZBL zone bridging
- DeNS loss and direct-force mode
- LoRA adapter injection, freezing, merging, and compile compatibility
- optional Triton kernel dispatch and numerical consistency
- supporting utility changes in neighbor-list, LMDB data, and
distributed checks
Relevant test files include:
- `source/tests/pt/model/test_descriptor_sezm.py`
- `source/tests/pt/model/test_descriptor_sezm_s2_equivariance.py`
- `source/tests/pt/model/test_descriptor_sezm_triton.py`
- `source/tests/pt/model/test_sezm_model.py`
- `source/tests/pt/model/test_sezm_spin_model.py`
- `source/tests/pt/model/test_sezm_export.py`
- `source/tests/pt/test_training.py`
- `source/tests/pt/test_train_utils.py`
- `source/tests/common/dpmodel/test_dist_check.py`
- `source/tests/common/dpmodel/test_lmdb_data.py`
## Notes
DPA4 is currently implemented for the PyTorch backend. Model compression
is not supported, and DPA4 checkpoints use the `.pt2` export path
instead of the regular TorchScript freeze path.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added SeZM model family and DeNS denoising loss for training; new
optimized ".pt2" export path with embedded metadata.
* **Improvements**
* LoRA fine-tuning workflow (apply/merge/strip) for lightweight
adapters.
* On-demand minimum pairwise-distance computation during data reads.
* Better JAX neighbor-list handling and optional GPU/Triton-accelerated
descriptor kernels for faster inference/training.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/deepmodeling/deepmd-kit/pull/5448?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 0ce2351 commit ccaa551
95 files changed
Lines changed: 34184 additions & 223 deletions
File tree
- .github/workflows
- backend
- deepmd
- dpmodel/utils
- pt_expt/infer
- pt
- entrypoints
- infer
- loss
- model
- atomic_model
- descriptor
- sezm_nn
- triton
- model
- network
- task
- train
- utils
- utils
- doc/model
- examples/water/dpa4
- lmp
- source
- api_cc
- include
- src
- tests
- lmp
- tests
- common
- dpmodel
- pt
- model
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
597 | 600 | | |
598 | 601 | | |
599 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
600 | 626 | | |
601 | 627 | | |
602 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
| |||
0 commit comments