Skip to content

pt_expt change-bias does not preserve the lower-input ABI of .pt2 models #5959

Description

@OutisLi

Problem

dp --pt-expt change-bias accepts a frozen .pt2 input and writes another .pt2, but the round trip discards the input artifact's lower-input metadata.

In deepmd/pt_expt/entrypoints/main.py, the .pte/.pt2 output path calls deserialize_to_file without passing lower_kind or do_atomic_virial. deserialize_to_file therefore uses its default lower_kind=nlist instead of preserving the input archive's metadata.json lower_input_kind.

Consequences

  • A NeighborGraph .pt2 is silently re-exported with the dense nlist ABI.
  • The graph artifact's graph semantics, mandatory atomic virial, and with-comm artifact/multi-rank capability are lost.
  • A native-spin .pt2 fails outright because deserialize_to_file rejects a native-spin model when lower_kind is not graph.
  • A .pt2 produced by the PT DPA4/SeZM edge_vec route is likewise not round-tripped with its original ABI.

This makes the advertised .pt2 change-bias workflow either behavior-changing or unusable depending on the model.

Expected behavior

change-bias should preserve the input .pt2 lower-input contract and the corresponding export properties, or explicitly reject .pt2 variants that cannot be reproduced safely. A regression test should compare input/output metadata and cover at least a NeighborGraph model and native spin.

Discovered while reviewing #5929.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions