deepmodeling / deepmodeling/deepmd-kit
feat(tf2): support or reject dens, ener_spin, and population losses
- Dominant language
- Python
- Stars
- 2k
- Forks
- 649
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 15
Description
## Summary
The common loss schema exposes `dens`, `ener_spin`, and `population`, but TF2 loss dispatch currently supports only energy, DOS, tensor, and property paths.
## Scope
For each missing loss type:
- implement the TF2 loss using the shared mathematical definition and label/output conventions; or
- add backend-aware validation that rejects it before trainer construction.
Wire required data labels, masks, reductions, task/model compatibility checks, checkpoint behavior, and distributed reduction semantics.
## Acceptance criteria
- Every listed loss has an explicit TF2 support status.
- Supported losses produce values and gradients consistent with deterministic shared fixtures.
- Incompatible model/loss pairs and missing labels fail before the main training loop.
- Supported tasks save/resume correctly.
- Regression tests preserve existing TF2 loss behavior.
Refs #5757.
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
Contributor guide
Assessment
This issue has not been assessed yet.