Skip to content

feat: add DPA-style NequIP and SevenNet energy-plus-property multitask - #173

Open
anyangml wants to merge 3 commits into
deepmodeling:masterfrom
anyangml:feat/gnn-dpa-style-nequip-sevennet-multitask
Open

anyangml wants to merge 3 commits into
deepmodeling:masterfrom
anyangml:feat/gnn-dpa-style-nequip-sevennet-multitask

Conversation

@anyangml

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the MACE DPA-style split for NequIP and SevenNet: shared descriptor, original energy head as a DeePMD fitting (nequip_ener / sevennet_ener), PropertyFittingNet on last-layer 0e, two datasets via model_dict / data_dict.
  • NequIP keeps output_hidden_to_scalar plus stored e0. SevenNet keeps the native readout and species-wise rescale, packing full last-layer features beside property 0e.
  • Training still skips a second vacuum-energy fit; finetune change-by-statistic is a residual out_bias. model.type: nequip / LAMMPS and the MACE path are unchanged.

Test plan

  • pytest tests/test_nequip_ener.py tests/test_sevennet_ener.py tests/test_examples.py tests/test_nequip_descriptor.py tests/test_sevennet_descriptor.py tests/test_mace_ener.py -m "not slow"
  • Confirm NequIP energy/force match native NequipModel on the serialized artifact
  • Confirm SevenNet energy matches the original head on the same descriptor graph
  • Confirm property 0e is unchanged and share_params level 0 aliases the backbone only
  • Confirm checkpoints restore after the native pickle/artifact is moved

Keep the original energy heads as DeePMD fittings so a shared GNN
backbone can train on energy/force data and property data together.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.12796% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.81%. Comparing base (adda02d) to head (be9cfbd).

Files with missing lines Patch % Lines
deepmd_gnn/nequip_ener.py 90.00% 16 Missing ⚠️
deepmd_gnn/sevennet_ener.py 93.23% 9 Missing ⚠️
deepmd_gnn/pt.py 93.75% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #173      +/-   ##
==========================================
+ Coverage   85.95%   86.81%   +0.85%     
==========================================
  Files          22       24       +2     
  Lines        2941     3352     +411     
==========================================
+ Hits         2528     2910     +382     
- Misses        413      442      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The main pytest job skips sevenn, so sevennet_ener was never uploaded.

Co-authored-by: Cursor <cursoragent@cursor.com>

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one numerical-correctness blocker in the new set-by-statistic handling for native GNN energy heads. The rest of the NequIP/SevenNet split, checkpoint self-containment, descriptor sharing, native-head parity tests, and current exact-head CI look consistent; the concrete issue is attached inline.

Agent: ChatGPT
Model: GPT-5.6 Sol
GitHub account: njzjz-bot
Reviewed head: bd1cc9c
Trigger: scheduled all-PR monitoring

Comment thread deepmd_gnn/pt.py Outdated
Type-resolved energy statistics cannot be averaged onto a one-parameter
Rescale.shift; write the per-type correction to DeePMD out_bias instead.

Co-authored-by: Cursor <cursoragent@cursor.com>

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the new head. The previous scalar-SevenNet-shift blocker is fixed: the native scalar Rescale.shift is now preserved, while the type-resolved set-by-statistic correction is stored in DeePMD out_bias. The new scalar-shift regression directly checks that the native scalar is unchanged and that the per-type correction remains distinct, so the earlier silent arithmetic-mean loss of the energy baseline is no longer present. I did not find a new high-confidence blocker in this delta.

I am not approving yet because exact-head validation is still incomplete: Test CUDA and pre-commit.ci are green, while Test Python/package, PyPI build/release, and Read the Docs are still pending/in progress. I also attempted to resolve the now-outdated blocking inline thread, but GitHub rejected that thread-state mutation with Resource not accessible by integration; the old thread may therefore remain visually unresolved even though the code issue is fixed.

Agent: ChatGPT
Model: GPT-5.6 Sol
GitHub account: njzjz-bot
Reviewed head: be9cfbd
Trigger: scheduled all-PR monitoring

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head validation is now complete. Test CUDA, Test Python package, PyPI build/release, pre-commit.ci, and Read the Docs all pass on be9cfbd8824773176876202ec14f057bd37b35fc. The previously reported SevenNet scalar-shift numerical-correctness blocker is fixed on this head and covered by the added regression; no new high-confidence blocker emerged in the completed validation.

Agent: ChatGPT | Model: GPT-5.6 Sol | GitHub: njzjz-bot | Reviewed head: be9cfbd | Trigger: scheduled all-PR monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants