Skip to content

fix(dpa-adapt): count evaluated frames across systems - #6177

Open
Miller10101010 wants to merge 2 commits into
deepmodeling:masterfrom
Miller10101010:fix-adapt-evaluation-frame-total
Open

Miller10101010 wants to merge 2 commits into
deepmodeling:masterfrom
Miller10101010:fix-adapt-evaluation-frame-total

Conversation

@Miller10101010

@Miller10101010 Miller10101010 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Accumulate per-system frame counts in DPATrainer.evaluate(). The regression uses systems with 12 and 30 frames: the parent reported 30, and the updated parser reports 42. All 14 trainer tests passed on AISI.

Closes #5704

Summary by CodeRabbit

  • Bug Fixes
    • Frame counts from multiple matching test-output lines are now added together, keeping reported totals accurate.
    • Test-output parsing now recognizes common frame-count formats, including lines with log prefixes and mixed capitalization.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

_parse_test_output now sums matching frame counts for the first pattern that yields results. The patterns match full lines with optional log prefixes. The test checks that counts of 12 and 30 produce a total of 42.

Changes: Frame-count parsing

Layer / File(s) Summary
Sum frame counts across systems
dpa_adapt/trainer.py, source/tests/dpa_adapt/test_trainer.py
The patterns match full lines with optional log prefixes. The parser sums all matches for the first matching pattern. The test provides counts of 12 and 30 and checks for a total of 42.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: zhaiwenxi

Merge Risk: Minimal · up to aa65f

The change makes evaluation report the total frame count across systems instead of only the last system's count. A regression test covers the two-system case. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(dpa-adapt): count evaluated frames across systems" matches the main change. The PR changes DPATrainer's frame-count parsing so it sums matches across systems instead of keeping only the…
Linked Issues check Passed Issue #5704 asks that the frame total across systems sum all per-system matches, not only the last match. At the reviewed head, DPATrainer._parse_test_output in dpa_adapt/trainer.py computes `n_fram…
Out of Scope Changes check Passed The trainer change is limited to frame-count parsing for #5704: the sum over all matches, removal of the obsolete TODO, and the anchored _N_FRAMES_PATTERNS rewrite. The anchoring is a parsing change…
Full details: Title check

Explanation

The title "fix(dpa-adapt): count evaluated frames across systems" matches the main change. The PR changes DPATrainer's frame-count parsing so it sums matches across systems instead of keeping only the last match, which fits the objective of accumulating per-system frame counts in evaluate(). The title is specific and does not describe unrelated work.

Full details: Linked Issues check

Explanation

Issue #5704 asks that the frame total across systems sum all per-system matches, not only the last match. At the reviewed head, DPATrainer._parse_test_output in dpa_adapt/trainer.py computes n_frames = sum(map(int, matches)) for the first _N_FRAMES_PATTERNS entry with matches. The former int(matches[-1]) and its TODO comment are removed. The MAE and RMSE parsing is unchanged. The _N_FRAMES_PATTERNS list was rewritten into line-anchored, case-insensitive patterns, and this rewrite is checked against the diff. The test test_evaluate_parse in source/tests/dpa_adapt/test_trainer.py now provides per-system counts 12 and 30 and asserts n_frames == 42. This exercises the summed behavior. The issue has no non-coding requirements. Changes since the previous review were re-verified against the whole-PR diff from the merge base.

Full details: Out of Scope Changes check

Explanation

The trainer change is limited to frame-count parsing for #5704: the sum over all matches, removal of the obsolete TODO, and the anchored _N_FRAMES_PATTERNS rewrite. The anchoring is a parsing change beyond a simple sum. It is connected to the requested behavior because it restricts counting to frame-count log records. The test fixture adds a system-path line containing the text 'number of test data 500', which the anchored pattern does not match. The test change adjusts the fixture so that it exercises multiple per-system counts. No unrelated changes were identified in the whole-PR diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 00a44ff3-06c5-4486-be55-4c7049d9be16
Commits

Reviewing files that changed from the base of the PR and between dbef546 and aa65fab.

Files selected for processing: 2

  • dpa_adapt/trainer.py
  • source/tests/dpa_adapt/test_trainer.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.75%. Comparing base (0cbf64b) to head (aa65fab).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6177      +/-   ##
==========================================
- Coverage   78.98%   78.75%   -0.24%     
==========================================
  Files        1257     1257              
  Lines      152640   152640              
  Branches     5233     5227       -6     
==========================================
- Hits       120565   120212     -353     
- Misses      30141    30492     +351     
- Partials     1934     1936       +2     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutisLi OutisLi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summing the per-group counts is correct, but please restrict the match to actual count records before summing.

Comment thread dpa_adapt/trainer.py Resolved

@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.

LGTM. Verified against deepmd/loggers/loggers.py and deepmd/infer/model_test/base.py:

  • The anchored _N_FRAMES_PATTERNS match every DeePMD console/file/MPI/distributed log formatter and trailing whitespace from # number of test data : {frames_tested:d} , while rejecting false matches inside # testing system : ... paths (resolving the prior review feedback).
  • _parse_test_output now sums per-system frame counts across all matching records.
  • test_evaluate_parse includes both the misleading system-path line and multiple systems (12 + 30 = 42).
  • All CI checks pass.

Coding agent: Antigravity
Antigravity version: 1.5.23
Model: Gemini 4 Neon (High)
Reasoning effort: high

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

for the total across systems we'd need to sum all matches;

3 participants