test(dpa4): enable array-api-strict consistency tests#5751
Conversation
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR fixes 2D ChangesScalarRMSNorm Fix
Array-API-Strict DPA4 Support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant TestDPA4Ener
participant array_api_strict
participant SeZMEnergyFittingNet
participant to_numpy_array
TestDPA4Ener->>array_api_strict: asarray(inputs and atype)
TestDPA4Ener->>SeZMEnergyFittingNet: evaluate strict arrays
SeZMEnergyFittingNet-->>TestDPA4Ener: energy output
TestDPA4Ener->>to_numpy_array: convert energy
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
source/tests/array_api_strict/fitting/dpa4_ener.py (1)
21-46: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop the redundant
register_dpmodel_mappingcalls
@array_api_strict_modulealready registers theGLUFittingNetDPandSeZMNetworkCollectionDPconverters here, so the explicit calls at lines 38-46 just overwrite the same entries and can be removed for consistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@source/tests/array_api_strict/fitting/dpa4_ener.py` around lines 21 - 46, Remove the redundant explicit register_dpmodel_mapping calls in the array_api_strict dpa4_ener module, since the `@array_api_strict_module` decorator already registers the GLUFittingNetDP and SeZMNetworkCollectionDP converters. Keep the wrapper classes like GLUFittingNet and SeZMNetworkCollection, but delete the duplicate mapping registrations so the module relies on the decorator-based registration consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@source/tests/array_api_strict/fitting/dpa4_ener.py`:
- Around line 21-46: Remove the redundant explicit register_dpmodel_mapping
calls in the array_api_strict dpa4_ener module, since the
`@array_api_strict_module` decorator already registers the GLUFittingNetDP and
SeZMNetworkCollectionDP converters. Keep the wrapper classes like GLUFittingNet
and SeZMNetworkCollection, but delete the duplicate mapping registrations so the
module relies on the decorator-based registration consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 04436c20-ae4a-4583-8b28-59bda92631dd
📒 Files selected for processing (8)
deepmd/dpmodel/descriptor/dpa4_nn/norm.pysource/tests/array_api_strict/common.pysource/tests/array_api_strict/descriptor/__init__.pysource/tests/array_api_strict/descriptor/dpa4.pysource/tests/array_api_strict/fitting/__init__.pysource/tests/array_api_strict/fitting/dpa4_ener.pysource/tests/consistent/descriptor/test_dpa4.pysource/tests/consistent/fitting/test_dpa4_ener.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5751 +/- ##
==========================================
- Coverage 79.61% 79.53% -0.09%
==========================================
Files 1014 1015 +1
Lines 115360 115780 +420
Branches 4274 4276 +2
==========================================
+ Hits 91843 92084 +241
- Misses 21976 22153 +177
- Partials 1541 1543 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Addressed the CodeRabbit review in a5b9a6d: removed the redundant register_dpmodel_mapping calls in source/tests/array_api_strict/fitting/dpa4_ener.py and kept the decorator-based registration. |
Restore the established eager conditional-import pattern for the PyTorch backends while retaining the array-api-strict coverage. Coding-Agent: Codex Codex-Version: codex-cli 0.144.1 Model: gpt-5.6-sol Reasoning-Effort: xhigh
1ea384c to
55a1c15
Compare
Summary
Validation
ruff format .ruff check .pytest source/tests/consistent/descriptor/test_dpa4.py source/tests/consistent/fitting/test_dpa4_ener.py -q -k array_api_strict-> 32 passed, 224 deselectedpytest source/tests/consistent/descriptor/test_dpa4.py source/tests/consistent/fitting/test_dpa4_ener.py -q -k dp_self_consistent-> 16 passed, 240 deselectedSummary by CodeRabbit