deepmodeling / deepmodeling/deepmd-kit

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

Open
#5,959 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2k
Forks
649
Avg merge
6d 18h
Merged PRs (30d)
15

Description

## 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.