Skip to content

[BUG] #4972 (fix of #4945) rejects the Hub options it forwards: GPTQModel.load(quantized, token=...) now raises 'unexpected token (did you mean token?)' #5007

Closed

Description

@Qubitium

Found on main @ c2b0bf6, RTX 4090.

What is wrong

#4972 (fix of #4945) made ModelLoader.from_quantized raise TypeError for every keyword left in kwargs_without_internal after the known pops (gptqmodel/models/loader.py, the leftover = set(kwargs_without_internal) check in from_quantized). But the Hub staging options of huggingface_hub.snapshot_download are never popped: they are forwarded un-popped to get_model_local_path(model_id_or_path, **kwargs_without_internal) (which calls snapshot_download for a remote id) and are only added to the accepted set used for the error message (_accepted_quantized_load_kwargs -> inspect.signature(snapshot_download)). So token=, max_workers=, local_dir=, endpoint=, headers=, etag_timeout=, allow_patterns=, ignore_patterns=, repo_type= ... are first passed to snapshot_download and then rejected, with a self-contradicting message: "unexpected keyword token (did you mean token?) ... A quantized load accepts ..., max_workers, ..., token, ...".

GPTQModel.load("<org>/<private-gptq-repo>", token=...) worked before #4972 (the token reached snapshot_download) and now always raises. The commit message of #4972 itself says the accepted set includes "the Hub staging options", so this is unintended.

Repro

from gptqmodel import GPTQModel
CK = "Llama-3.2-1B-Instruct-GPTQ-4bits-gp128"   # any quantized checkpoint
for kw in [dict(token=None), dict(max_workers=4), dict(revision=None)]:
    try:
        GPTQModel.load(CK, device="cuda:0", **kw); print("OK ", list(kw))
    except Exception as e:
        print("ERR", list(kw), type(e).__name__, str(e)[:200])

main @ c2b0bf6:

ERR ['token'] TypeError LlamaQModel.from_quantized: unexpected keyword argument(s) for a quantized checkpoint: `token` (did you mean `token`?). A quantized load accepts `_commit_hash`, ... `max_workers`, ... `token`, ...
ERR ['max_workers'] TypeError ... `max_workers` (did you mean `max_workers`?). A quantized load accepts ... `max_workers` ...
OK  ['revision']

3867c82 (before #4972): all three OK.

Suggested fix

Pop the snapshot_download options that the loader forwards (or compute leftover as set(kwargs_without_internal) - accepted, where accepted includes the snapshot_download parameters), so the check and the message agree. token should also be forwarded consistently (config detection in GPTQModel.load currently uses only CONFIG_SELECTION_KWARGS, which lacks token).

Test that should have caught it

tests/test_load_strict_kwargs_4945.py::test_quantized_load_accepts_its_documented_keywords covers only the explicit/popped keywords; add token=None and max_workers= (any snapshot_download option) to it.

Severity

Medium: loading a private/gated quantized repo with an explicit token= (the standard HF pattern) now always fails; any snapshot_download tuning keyword fails too.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

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

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent release: agent-root-5007 finished this issue. Fix: #5016, squash-merged as eedb59498.

    The leftover-keyword check now compares against the same accepted set its error message prints, so the snapshot_download staging options the loader forwards (token, max_workers, local_dir, endpoint, headers, etag_timeout, allow_patterns, ignore_patterns, repo_type) are accepted instead of rejected with the self-contradicting "unexpected keyword token (did you mean token?)". A real typo of a Hub option still raises (tokn= -> "did you mean token?"). token also joined CONFIG_SELECTION_KWARGS, so model-type detection reads the config with the caller's credential.

    Red on unmodified main (5 failed / 8 passed: four Hub-option cases plus the config-selection test) -> 13 passed; neighbouring loader suites 73 passed; tests/test_local_model_paths.py 29 passed; ruff clean.

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