Skip to content

fix(layers): avoid duplicate enable_proxy_error kwarg in make_quant_linear - #206

Open
Dhruv Bhadauriya (ThinkerDesigns) wants to merge 1 commit into
microsoft:mainfrom
ThinkerDesigns:fix/vptq-quant-error
Open

fix(layers): avoid duplicate enable_proxy_error kwarg in make_quant_linear#206
Dhruv Bhadauriya (ThinkerDesigns) wants to merge 1 commit into
microsoft:mainfrom
ThinkerDesigns:fix/vptq-quant-error

Conversation

@ThinkerDesigns

@ThinkerDesigns Dhruv Bhadauriya (ThinkerDesigns) commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #196

Root cause: make_quant_linear() unpacks **layer_conf (loaded from saved model config) while also passing enable_proxy_error=False as an explicit kwarg. When the saved config contains enable_proxy_error (from models quantized with the algorithm branch), Python raises TypeError: got multiple values for keyword argument 'enable_proxy_error'.

Fix: Filter out enable_proxy_error from the unpacked config before passing it, so only the explicit kwarg is used.

…inear

When loading models saved from the algorithm branch, layer_conf may
contain enable_proxy_error from the saved config. Passing it again as
an explicit kwarg caused TypeError: got multiple values for keyword
argument 'enable_proxy_error'.

Fixes microsoft#196.

🤖 Generated with Claude Code
Copilot AI lite review requested due to automatic review settings August 4, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the layer-replacement path used during AutoModelForCausalLM.from_pretrained() to prevent a Python TypeError when loading models whose saved quantization config already includes enable_proxy_error.

Changes:

  • Copy and filter layer_conf to remove enable_proxy_error before unpacking **conf into the quantized linear constructor.
  • Preserve the explicit enable_proxy_error=False kwarg to ensure only one value is provided (fixing the duplicate-kwarg crash).
Suppressed comments (1)

vptq/layers/model_base.py:52

  • This change adds compatibility logic for configs that contain enable_proxy_error, but there’s no regression test ensuring make_quant_linear() can handle a saved layer_conf that includes enable_proxy_error without raising TypeError. Adding a unit/regression test would prevent this from reappearing (e.g., construct a tiny module with a Linear, pass config_for_layers containing enable_proxy_error, and assert replacement succeeds).
            # Pop enable_proxy_error to avoid duplicate kwarg when saved config
            # (from algorithm branch) also contains it — see issue #196
            conf = dict(layer_conf)
            conf.pop("enable_proxy_error", None)
            new_module = target_layer(
                **conf,
                enable_proxy_error=False,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vptq/layers/model_base.py
Comment on lines +46 to +48
# Pop enable_proxy_error to avoid duplicate kwarg when saved config
# (from algorithm branch) also contains it — see issue #196
conf = dict(layer_conf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a version incompatibility issue

2 participants