Skip to content

[BUG] GPTQModel.load() of a quantized checkpoint silently drops unknown/misspelled kwargs (dtpye=, attn_implmentation=, bits=) and a passed quantize_config; the unquantized path raises TypeError for the same typo #4945

Closed

Description

@Qubitium

Found on main @ 3867c82, CPU (Qwen2.5-0.5B-Instruct GPTQ 4-bit checkpoint made on this commit).

What is wrong

GPTQModel.load() handles extra arguments differently on its two paths:

  • Unquantized model (from_pretrained): unknown keywords reach the HF model constructor and fail loudly, e.g. TypeError: Qwen2ForCausalLM.__init__() got an unexpected keyword argument 'dtpye'.
  • Quantized checkpoint (from_quantized): every unknown keyword is silently discarded. loader.from_quantized pops the keys it knows into kwargs_without_internal (gptqmodel/models/loader.py ~2460-2555). The rest go to QuantizeConfig.from_pretrained(model_local_path, **cached_file_kwargs, **kwargs_without_internal) (~2619), which pops only format/subfolder and ignores everything else (gptqmodel/quantization/config.py:5894). A misspelled real option (dtpye=, attn_implmentation=, devcie_map=) or an option that does not apply (bits=8) "succeeds" and changes nothing.

In the same way, GPTQModel.load(quantized_path, quantize_config) silently drops the quantize_config argument (auto.py load() never forwards it to from_quantized). The checkpoint's own config is used and nothing is logged, even when the passed config is a different method/bits/group size.

This is the load-side twin of #4686 (quantized save(**kwargs) dropped every keyword, now a TypeError with a difflib suggestion) and of #4052/#4668 (config typos).

Repro

import torch
from gptqmodel import GPTQModel
from gptqmodel.quantization import GPTQConfig, AWQConfig

Q = "Qwen2.5-0.5B-Instruct_gptq"           # GPTQ 4-bit g128 checkpoint
for kw in ({}, {"dtpye": torch.float16}, {"dtype": torch.float16},
           {"attn_implmentation": "eager"}, {"bits": 8}):
    m = GPTQModel.load(Q, device="cpu", **kw)
    print(kw, m.model.dtype, m.model.config._attn_implementation, m.quantize_config.bits)

m = GPTQModel.load(Q, AWQConfig(bits=8, group_size=32), device="cpu")
print(type(m.quantize_config).__name__, m.quantize_config.bits, m.quantize_config.group_size)

# unquantized path, for contrast
GPTQModel.load("Qwen2.5-0.5B-Instruct", GPTQConfig(bits=4), dtpye=torch.float16)

Output:

{}                                   torch.bfloat16 sdpa 4
{'dtpye': torch.float16}             torch.bfloat16 sdpa 4     <- typo ignored, no warning
{'dtype': torch.float16}             torch.float16  sdpa 4
{'attn_implmentation': 'eager'}      torch.bfloat16 sdpa 4     <- typo ignored
{'bits': 8}                          torch.bfloat16 sdpa 4     <- ignored
GPTQConfig 4 128                                              <- passed AWQConfig(bits=8) ignored, no warning
TypeError: Qwen2ForCausalLM.__init__() got an unexpected keyword argument 'dtpye'

Suggested fix

After from_quantized has consumed its known keys (HF hub/cache keys, max_memory, attn_implementation, the GGUF internals, ...), raise TypeError for whatever is left, with a difflib.get_close_matches hint, the same way save() does since #4686. QuantizeConfig.from_pretrained should not take **kwargs it never reads. When load() routes to from_quantized and a quantize_config was passed, either raise or at least warn that the checkpoint's config is used instead.

Test that should have caught it

There is no negative test for GPTQModel.load(quantized, <unknown kw>). Add one next to the #4686 save test (TypeError, message naming the key and a suggestion), plus one for load(quantized, quantize_config=...).

Severity

Low-medium. A typo in dtype/attn_implementation/device_map silently loads with defaults (wrong dtype or attention, on a GPU host possibly the wrong device). The same typo fails loudly on the unquantized path, so the behavior is inconsistent across the two paths.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-root-4945 is working on this issue now.

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 is no longer working on this issue.

    The issue is free to claim.

    Superseded: #4972 (f28cfc9) merged the same fix on main.

  3. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-root-4945 finished this issue. Fix is #4972, squash-merged to main as f28cfc9.

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