fix(layers): avoid duplicate enable_proxy_error kwarg in make_quant_linear - #206
Open
Dhruv Bhadauriya (ThinkerDesigns) wants to merge 1 commit into
Open
Conversation
…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 started reviewing on behalf of
Dhruv Bhadauriya (ThinkerDesigns)
August 4, 2026 08:46
View session
There was a problem hiding this comment.
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_confto removeenable_proxy_errorbefore unpacking**confinto the quantized linear constructor. - Preserve the explicit
enable_proxy_error=Falsekwarg 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 ensuringmake_quant_linear()can handle a savedlayer_confthat includesenable_proxy_errorwithout raisingTypeError. Adding a unit/regression test would prevent this from reappearing (e.g., construct a tiny module with aLinear, passconfig_for_layerscontainingenable_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 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.