fix(dpmodel): materialize fitting buffers on active backend#5841
fix(dpmodel): materialize fitting buffers on active backend#5841njzjz-bot wants to merge 1 commit into
Conversation
Convert portable fitting constants locally into the runtime namespace, dtype, and device before default-fparam handling, parameter normalization, case embedding, atomic bias gathering, and polar scale/shift postprocessing. Add direct dpmodel regressions with Torch runtime inputs while all nine persistent buffers remain NumPy, verifying backend identity and numerical parity without eager wrapper conversion. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
|
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 (4)
📝 WalkthroughWalkthroughGeneralFitting and PolarFitting now materialize stored buffers on the active backend, dtype, and device before runtime operations. New Torch-conditional tests verify GeneralFitting and PolarFitting outputs against NumPy results. ChangesBackend buffer materialization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5841 +/- ##
==========================================
- Coverage 78.58% 78.32% -0.26%
==========================================
Files 1050 1050
Lines 120637 120648 +11
Branches 4356 4361 +5
==========================================
- Hits 94801 94500 -301
- Misses 24278 24587 +309
- Partials 1558 1561 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Possible reviewers based on changed lines, exact file history, and exact-file review history:
No review request was made automatically. Coding agent: Codex |
Fixes #5642
Summary
PolarFitting.scaleandconstant_matrix, which had the identical failure mode during polar postprocessingThe complete affected set is nine arrays:
default_fparam_tensor,fparam_avg,fparam_inv_std,aparam_avg,aparam_inv_std,case_embd,bias_atom_e, polarscale, and polarconstant_matrix.Why existing tests missed this
Cross-backend fitting tests already exercise default fparam, parameter statistics, biases, and polar outputs, but they instantiate backend wrappers that eagerly convert every NumPy attribute. Those objects are homogeneous before forward execution and therefore never expose the generic dpmodel boundary.
Direct dpmodel fitting tests use NumPy descriptors, atom types, parameters, and buffers, so the selected namespace is also NumPy and all operations are valid. Dedicated PyTorch, Paddle, and TensorFlow implementations maintain their own backend-native state and do not exercise this shared dpmodel implementation. No previous test combined a raw dpmodel fitting object, backend-native runtime inputs, and still-NumPy portable buffers.
Validation
ruff format .ruff check .Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Summary by CodeRabbit
Bug Fixes
Tests