fix(deepmd): expose unlabeled mixed-system loading#1033
Conversation
Document the existing labeled switch on the MultiSystems file-loading APIs and forward it explicitly so coordinate-only DeepMD mixed datasets have a discoverable loading path. Add a deepmd/npy/mixed round-trip regression through MultiSystems.from_file. Existing mixed tests only exercised labeled inputs, while the later HDF5 unlabeled test covered the instance loader rather than the classmethod reported in deepmodeling#817. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughMultiSystems file loading now accepts a keyword-only ChangesUnlabeled MultiSystems loading
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant MultiSystems
participant FormatLoader
Caller->>MultiSystems: from_file(labeled=False)
MultiSystems->>MultiSystems: load_systems_from_file(labeled=False)
MultiSystems->>FormatLoader: from_fmt_obj(labeled=False)
FormatLoader-->>Caller: coordinate-only System
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1033 +/- ##
==========================================
- Coverage 87.01% 86.95% -0.06%
==========================================
Files 90 90
Lines 8330 9183 +853
==========================================
+ Hits 7248 7985 +737
- Misses 1082 1198 +116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wanghan-iapcm
left a comment
There was a problem hiding this comment.
The added labeled keyword-only signature + docstrings are correct, safe, and a reasonable way to expose the unlabeled path for the #817 feature request. But the capability already worked via **kwargs on master, so the new test isn't a genuine regression test and #817's default call is unchanged -- see inline.
Make the explicit labeled API regression-testable and add an actionable labeled=False hint when coordinate-only mixed data is loaded with the default. Coding-Agent: Codex Codex-Version: codex-cli 0.144.6 Model: gpt-5.6-sol Reasoning-Effort: xhigh
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Verified the fix at head: the new test fails on the pre-fix merge base b3c88c6 (KeyError: 'labeled') and passes here, so it genuinely guards the change. Approving. One follow-up note inline that is worth tightening but not a blocker.
| return self.from_fmt_obj( | ||
| load_format(fmt), file_name, labeled=labeled, **kwargs | ||
| ) | ||
| except DataError as exc: |
There was a problem hiding this comment.
Thanks, this addresses both of my earlier points -- the signature is explicit now, and the default call gives a real pointer instead of a bare energies not found in data.
One thing to tighten: this wrapper is gated on the format name but not on the cause. Any DataError raised while loading a mixed dataset now gets "pass labeled=False" appended -- including a genuinely labeled dataset that fails for an unrelated reason, e.g. a corrupt or truncated force.npy. In that case the message sends the user in exactly the wrong direction. Narrowing to the missing-label case (checking for the absent energy/force file, or matching the specific condition) would be safer, and no test currently covers that misleading path.
Two smaller notes:
- The hint only fires via
from_file/load_systems_from_file;MultiSystems().from_fmt_obj(...)still emits the bare message. - The concatenation is missing a separator, so it currently reads
energies not found in data For coordinate-only mixed datasets, pass labeled=False.
Fixes #817.
Document and forward
labeled=Falsethrough MultiSystems classmethod loading and add an NPY mixed no-label round-trip.Tests:
cd tests && python -m unittest test_deepmd_mixedWhy existing tests missed it: Existing mixed tests used labeled data; the unlabeled HDF5 test did not cover the reported NPY classmethod path.
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit
New Features
labeled=False.Tests