feat(pt_expt): DPA4 inference (.pt2 freeze, DeepEval, C++, LAMMPS)#5540
feat(pt_expt): DPA4 inference (.pt2 freeze, DeepEval, C++, LAMMPS)#5540wanghan-iapcm wants to merge 10 commits into
Conversation
…kpoint interop + DeepEval parity test
for more information, see https://pre-commit.ci
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdds DPA4/SeZM model support to the ChangesDPA4/SeZM pt_expt backend support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5540 +/- ##
==========================================
+ Coverage 82.21% 82.23% +0.01%
==========================================
Files 892 893 +1
Lines 101506 101912 +406
Branches 4242 4270 +28
==========================================
+ Hits 83456 83807 +351
- Misses 16749 16801 +52
- Partials 1301 1304 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR-3 (final) of the DPA4/SeZM porting series — pt_expt inference: freeze to
.pt2, PythonDeepEval, pt→pt_expt checkpoint interop, C++ single-rank, and LAMMPS single-rank. Follows PR-1 (#5515, dpmodel core) and PR-2 (#5522, pt_expt training/export).What's included
.pt2(deepmd/pt_expt/model/ener_model.py,deepmd/dpmodel/.../ener_model.py,deepmd/dpmodel/descriptor/dpa4.py): registerEnergyModelundersezm_ener/dpa4_enermodel-type aliases soBaseModel.deserializeresolves a standard DPA4 energy model (whose fitting type issezm_ener). Fixed atorch.exportspecialization whereint()on symbolic shapes bakednf*nloc(embedding/so2/attention).deepmd/dpmodel/descriptor/dpa4.py): theatype_ext[:, :nloc]slice emitted a spuriousNe(nall, nloc)shape guard that crashed the compiled artifact whennall==nloc(no ghosts); replaced withxp_take_first_n(index_select). NoPBC now matches PBC.deepmd/pt_expt/model/model.py):BaseModel.deserializeunwraps pt's bespokeSeZMModelserialization (type:"SeZM", nestedsezm_atomicatomic model with the pt-only dens head), validates versions, rejects unsupported features (bridging/lora/dens/active_mode) withNotImplementedError, and delegates to the standard path.use_ampdescriptor,enable_tf32model): warn-once instead of silent drop.Tests
source/tests/pt_expt/model/test_dpa4_export.py: dual-artifact.pt2, metadata, AOTI load, artifact-vs-eager parity (1e-10). (CI-skipped — AOTI is slow; run locally.)source/tests/pt_expt/infer/test_dpa4_deep_eval.py: pt.ptvs pt_expt.pt2energy/force/global-virial/atom-energy at fp64 1e-10, PBC and NoPBC; doubles as the checkpoint-interop proof. Per-atom virial compared by sum (pt's edge-scatter from feat(dpa4): use edge force and atomic virial #5518 redistributes it; global virial matches). (CI-skipped — AOTI.)source/tests/pt_expt/model/test_dpa4_interop.py(CI-runnable, no AOTI): happy-path pt-checkpoint→pt_expt round-trip + every guard branch + version validation +@variablesfiltering.source/tests/infer/gen_dpa4.py(+ wired intosource/install/test_cc_local.sh).source/api_cc/tests/test_deeppot_dpa4_ptexpt.cc: 20 tests (double+float), dpa3-matched tolerances. Validated locally.source/lmp/tests/test_lammps_dpa4_pt2.py: parity +atom_modify map yes+ the fix(pt_expt): fail-fast on .pt2 GNN inference without LAMMPS atom-map #5450 no-atom-map fail-fast. Validated on a GPU box (7 passed).PR-1 parity suites stay green; the small dpmodel edits are parity-revalidated.
Known limitations
.pth(torch.jit) DPA4 — the pt backend has nosezm_enermodel registration, so.pthfreeze of a standard DPA4 energy model isn't available; not needed for the pt_expt inference path.use_amp/enable_tf32remain functionally ignored (now warned) — by design for this series.NotImplementedError): spin, ZBL bridging, LoRA, dens/direct-force/denoising heads, SO3 grid projection, GridMLP, SO(2) attention extensions.Summary by CodeRabbit
Release Notes
New Features
sezm_eneranddpa4_ener.Improvements
use_amporenable_tf32settings are ineffective.Tests