Skip to content

[BUG] Quantized model.save(**kwargs) silently drops every extra keyword (max_shard_sise typo, safe_serialization=False, push_to_hub=True all 'succeed'); embeddings save path also drops eora_path/split_by #4686

Closed

Description

@Qubitium

Found on main @ 12c1273, CPU.

What is wrong

BaseQModel.save(save_dir, ..., split_by=None, **kwargs) (gptqmodel/models/base.py:3330-3338) forwards **kwargs only on the non-quantized branch (self.save_pretrained(save_dir=save_dir, **kwargs), base.py:3378). For a quantized model, the normal case, every extra keyword is silently discarded (base.py:3361-3367). That covers typos of real parameters and HF-style options that callers reasonably expect to work. Nothing raises and nothing is logged.

The model-free weight-only replacement branch (save_quantized_embeddings, base.py:3353-3359) also silently drops two of save()'s own named parameters, eora_path and split_by.

Repro

m = GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", RTNConfig(bits=4, group_size=128), dtype=torch.bfloat16, device="cpu")
m.quantize(None)
m.save(d1, max_shard_sise="20MB")                          # typo
m.save(d2, push_to_hub=True, repo_id="nonexistent/xyz")    # nothing uploaded, no error
m.save(d3, safe_serialization=False)
m.save(d4, max_shard_size="20MB")                          # correct spelling, for reference

(Run on the model truncated to 2 layers.) Output:

{'max_shard_sise': '20MB'}                              OK files: ['model.safetensors']
{'push_to_hub': True, 'repo_id': 'nonexistent/xyz'}     OK files: ['model.safetensors']
{'safe_serialization': False}                           OK files: ['model.safetensors']
{'max_shard_size': '20MB'}                              OK files: ['model-00001-of-00002.safetensors', 'model-00002-of-00002.safetensors', 'model.safetensors.index.json']

push_to_hub=True returning successfully without uploading anything is the worst case. A CI job that "publishes" the checkpoint reports success.

This is the save-side counterpart of #4052 / #4057, which made QuantizeConfig(...) reject unknown kwargs with a close-match hint because silently dropped typos were treated as bugs.

Suggested fix

On the quantized branch, raise TypeError for any key left in kwargs, with a difflib close-match hint as in _validate_quantize_config_factory_kwargs. Alternatively, give save() an explicit signature and keep **kwargs only for the dense save_pretrained path. Forward eora_path/split_by to save_quantized_embeddings, or reject them there.

Severity

Low to medium: silent no-op options on the main save API, including a silent no-op push_to_hub.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Claimed. Will reject leftover **kwargs on the quantized save branch with a difflib close-match hint (same treatment as QuantizeConfig kwargs in #4057), and forward eora_path/split_by to save_quantized_embeddings instead of dropping them. Fix PR to follow.

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