Skip to content

Fine-tune descriptor mismatch warning should ignore seed #6038

Open

Description

@OutisLi

Summary

warn_configuration_mismatch_during_finetune reports descriptor.seed as a configuration mismatch. seed only selects the RNG used when a module is first constructed. It is not a loaded parameter, and a difference does not change which pretrained weights are reused.

What happens

_IGNORED_DESCRIPTOR_KEYS in deepmd/utils/finetune.py is {"trainable"}. A fine-tune whose input sets descriptor.seed to null while the checkpoint was trained with seed: 42 therefore logs:

DEEPMD WARNING Descriptor configuration mismatch detected between input.json and pretrained model (branch 'Default'). Only descriptor parameters that are compatible with the pretrained model can be reused; incompatible parameters may be reinitialized, skipped, or rejected by backend-specific loading:
  seed: input=None, pretrained=42

The weight copy in collect_single_finetune_params (deepmd/pt/train/training.py) does not consult this diff. Matching tensors are still taken from the pretrained state dict. The warning text implies that the descriptor may be reinitialized or rejected, which does not happen for seed.

descriptor.seed: null is the documented way to draw a fresh seed for any parameter that is actually created during the run. That choice should not be reported as an incompatible descriptor change.

Expected behavior

Add seed to _IGNORED_DESCRIPTOR_KEYS, next to trainable, so initialization RNG settings are not treated as architecture mismatches.

Activity

  1. OutisLi commented on Sep 22, 2026

    @OutisLi
    CollaboratorAuthor

    descriptor.use_amp belongs in the same ignore set.

    It is an execution policy, not part of the learned function. The DPA4C serializer already leaves it out of the checkpoint for that reason (deepmd/dpmodel/descriptor/dpa4c.py, serialize): training reads it from the input, and inference reads DP_AMP_INFER. The pt / pt_expt modules store it as a Python bool (self.use_amp = bool(use_amp)), so load_state_dict does not restore it and the input value is what actually enables autocast.

    Fine-tuning an AMP checkpoint with descriptor.use_amp: false therefore still loads the pretrained weights, but logs:

    DEEPMD WARNING Descriptor configuration mismatch detected between input.json and pretrained model (branch 'Default'). Only descriptor parameters that are compatible with the pretrained model can be reused; incompatible parameters may be reinitialized, skipped, or rejected by backend-specific loading:
      use_amp: input=False, pretrained=True
    

    That warning is wrong in the same way as seed: nothing is reinitialized or rejected. Please ignore use_amp in _IGNORED_DESCRIPTOR_KEYS as well.

  2. njzjz-bot commented on Sep 22, 2026

    @njzjz-bot
    Contributor

    Confirmed on current master: deepmd/utils/finetune.py still has _IGNORED_DESCRIPTOR_KEYS = {"trainable"}, so both seed and the use_amp case you added are currently reported as descriptor incompatibilities even though they do not control which pretrained tensor values are loadable.

    I agree these should be treated as non-structural descriptor settings for this warning path. A small regression test in source/tests/common/test_finetune_utils.py would be useful as part of the fix: make two otherwise-identical descriptors differ only in seed (including None vs an integer) and use_amp, and assert warn_configuration_mismatch_during_finetune() emits no warning; keep an adjacent structural difference such as repflow.nlayers to ensure real incompatibilities are still reported.

    No linked fix PR is visible yet, so leaving this open for implementation.

    Agent: ChatGPT
    Model: GPT-5.6 Sol

  3. added a commit that references this issue on Oct 19, 2026
    0eab67c
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