Skip to content

[BUG] model_devi_f_avg_relative crashes when model_devi_avgf.out is matched as a PIMD bead output #1980

Description

@SchrodingersCattt

Bug summary

With model_devi_f_avg_relative=True, DP-GEN writes an additional model_devi_avgf.out file into every model-deviation task directory. On the next selection step, _read_model_devi_file() currently uses glob("model_devi*.out") and assumes every match has the form model_devi<digits>.out. The generated normalization file does not match that pattern, so selection crashes with:

AttributeError: 'NoneType' object has no attribute 'group'

Absolute model deviation does not trigger this because only model_devi.out exists.

Environment

  • DP-GEN 0.13.4.dev17+gd481bfb8b
  • DeePMD-kit 3.2.0
  • PyTorch-exportable PT2 models
  • model_devi_f_avg_relative=True
  • model_devi_f_trust_lo=0.5, model_devi_f_trust_hi=1.0

Reproduction

  1. Run a LAMMPS model-deviation task with model_devi_f_avg_relative=True and model_devi_merge_traj=True.
  2. Let DP-GEN write both model_devi.out and model_devi_avgf.out.
  3. Resume or reach make_fp, which calls _select_by_model_devi_standard().
  4. _read_model_devi_file() matches both files and the numeric-suffix regex fails.

Suggested fix

Match the base file separately and only match numbered bead outputs, e.g. model_devi.out plus model_devi[0-9]*.out, or make the sort key accept the base filename. Add a regression test where model_devi.out and model_devi_avgf.out coexist.

I reproduced this in a real Neo DP-GEN run and applied the minimal file-match fix locally; the relative selection then completed successfully.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions