-
Notifications
You must be signed in to change notification settings - Fork 587
fix(pt): Huber energy loss uses raw model energy #5168
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
fix(pt): Huber energy loss uses raw model energy #5168
Conversation
…hat includes atom_ener_coeff weighting, so coefficients are silently dropped when use_huber=True
📝 WalkthroughWalkthroughHuber branch in energy loss now calls custom_huber_loss with precomputed energy_pred and energy_label tensors instead of model_pred["energy"]/label["energy"]. Tests updated to add enable_atom_ener_coeff flag and related test data fields; minor array-shape/axis clarifications applied in dpmodel loss code. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 #5168 +/- ##
=======================================
Coverage 81.93% 81.94%
=======================================
Files 714 714
Lines 73397 73412 +15
Branches 3616 3616
=======================================
+ Hits 60140 60155 +15
+ Misses 12094 12092 -2
- Partials 1163 1165 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Huber energy in pd loss also needs to be fixed.
iProzd
left a 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.
xp.shape(atom_ener) should be atom_ener.shape in https://github.com/deepmodeling/deepmd-kit/blob/master/deepmd/dpmodel/loss/ener.py#L134 .
It seems that ut never reached here. @njzjz
You are correct. |
Huber energy loss uses raw model energy instead of
energy_predthat includesatom_ener_coeffweighting, so coefficients are silently dropped when use_huber=TrueSummary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.