Skip to content

[BUG] Regression from #4379 fix: re-saving a checkpoint that contains a tensor with no matching module crashes (e.g. TheBloke/Llama-2-7B-GPTQ self_attn.rotary_emb.inv_freq) #4452

Description

@Qubitium

Severity: medium. Kind: regression from 2daaae4 (#4379). Confirmed at 489aed6 on an RTX 4090.

GPTQModel.load("TheBloke/Llama-2-7B-GPTQ", device="cuda:0").save("out")
# AttributeError: LlamaAttention has no attribute 'rotary_emb'   (from writer.get_model_with_quantize)

Cause: the dtype-preservation code (gptqmodel/utils/model.py:3319) runs model.get_submodule(module_name) for every checkpoint key. It has no guard for keys whose module no longer exists in the current transformers modeling code, such as the per-layer inv_freq buffers in older Llama checkpoints. Keys like that should be skipped (they are dropped on load anyway), not raise.

At def6e61: the same save succeeds.


Found during an AI-assisted review (Claude Code, round 13) of 489aed6; repros were run at that commit (A/B against def6e61 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions