Skip to content

fix(pt-expt): preserve DOS width in exported models #5949

Description

@njzjz

Problem

PyTorch-Exportable DOS models do not preserve or report their configured output width after export.

A model configured with numb_dos: 2 can train and export to .pte, but the pt_expt model/evaluator reports get_numb_dos() == 0. DeepDOS(...).eval() then fails while reshaping the two predicted values into an output width of zero.

The current gaps are:

  • deepmd/pt_expt/model/dos_model.py::DOSModel does not expose the configured DOS width as the DP-model DOS class does.
  • deepmd/pt_expt/infer/deep_eval.py::get_numb_dos() returns 0 unconditionally.

Expected behavior

Exported PyTorch-Exportable DOS models should preserve numb_dos, and DeepDOS/dp test should recover that value and evaluate the exported model successfully.

Context

Discovered while reviewing #5929. Until this is fixed, the PyTorch-Exportable DOS training/export/testing workflow should not be advertised as supported.

Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh

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