-
Notifications
You must be signed in to change notification settings - Fork 584
refactor(pt): reuse dpmodel EnvMatStat #5139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
📝 WalkthroughWalkthroughDevice-placement consistency added across dpmodel utilities via array_api_compat; PyTorch env_mat_stat now re-exports dpmodel implementations; a public alias was added to PairExcludeMask. Internal numeric dtype/device handling in region.normalize_coord was adjusted. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (40)
🔇 Additional comments (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the PyTorch implementation to reuse the dpmodel EnvMatStat classes, eliminating code duplication. Additionally, it improves array API compatibility by adding device parameters to array creation functions.
- Replaced PT-specific
EnvMatStatandEnvMatStatSeimplementations with imports from dpmodel - Added
build_type_exclude_maskmethod alias in PT'sPairExcludeMaskto match dpmodel interface - Enhanced array API compatibility by adding device parameters to array creation functions in dpmodel utilities
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| deepmd/pt/utils/env_mat_stat.py | Removed duplicate implementation; now imports EnvMatStat classes from dpmodel |
| deepmd/pt/utils/exclude_mask.py | Added build_type_exclude_mask method alias to align with dpmodel interface |
| deepmd/dpmodel/utils/nlist.py | Added device parameters to array creation functions (eye, ones, arange, asarray) and replaced .size with array_api_compat.size() |
| deepmd/dpmodel/utils/env_mat_stat.py | Added device parameters to array creation functions (zeros, ones, arange) and replaced .size with array_api_compat.size() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5139 +/- ##
==========================================
- Coverage 81.93% 81.90% -0.03%
==========================================
Files 712 712
Lines 72864 72799 -65
Branches 3617 3616 -1
==========================================
- Hits 59700 59628 -72
- Misses 12001 12008 +7
Partials 1163 1163 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Refactor
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.