You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Han Wang
committed
fix(dpmodel,pt_expt): normalize use_spin forms and forward allow_missing_label in the native-spin builders
Review: PR deepmodeling#5884 (OutisLi, P1 x2). The DPA4 native-spin builders did a
direct boolean conversion of spin.use_spin, breaking the public schema's
index and symbol forms (['Ni'] became [True] and failed the length check;
[0, 1] became [False, True]), and dropped spin.allow_missing_label (so
datasets without spin.npy were rejected despite the documented zero
default).
- New pure helper deepmd.utils.spin.normalize_spin_use_spin(use_spin,
type_map) -> list[bool]: single owner of the three-form contract pt
implements in its frozen tree (bool passthrough / index scatter /
symbol lookup with ValueError on unknown symbols); direct unit tests
cover all forms incl. the empty list and input purity.
- Both builder twins (dpmodel model.py get_dpa4_native_spin_model and
pt_expt get_model._get_dpa4_native_spin_model) normalize via the
helper and forward allow_missing_label into Spin(...).
- get_additional_data_requirement drops its getattr has_spin/spin
dances for direct calls (has_spin is base-declared; spin models carry
.spin).
- Tests: config-form parametrization (symbols/indices/booleans/unknown
symbol) on both builders; the pt_expt data-requirement regression pins
must=False + default=0.0 with allow_missing_label=True and must=True
without.
0 commit comments