fix(pack): forward quant_result to make_quant in pack_model - #3034
Merged
Merged
Conversation
`make_quant` takes `quant_result` as its third required positional
parameter, but `pack_model` never passes it, so every call to
`pack_model` raises:
TypeError: make_quant() missing 1 required positional argument: 'quant_result'
The value is already in scope -- `pack_model` accepts `quant_result` as its
own second required parameter and uses it three lines above, again when
building `qModules`, and forwards it correctly to `pack_module` further
down. The two other `make_quant` call sites in the codebase
(`models/loader.py` and `models/writer.py`) both pass `quant_result=modules`.
This call site is the only one that omits it.
Qubitium
approved these changes
Aug 31, 2026
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.
Problem
make_quantdeclaresquant_resultas its third required positional parameter:https://github.com/ModelCloud/GPTQModel/blob/main/gptqmodel/utils/model.py#L398-L409
but the call inside
pack_modelnever passes it:So every call to
pack_modelfails immediately with:Why this is an omission rather than intended
The value is already in scope and is used correctly everywhere else in the very same function —
pack_modeltakesquant_resultas its own second required parameter, and:modules = {n: modules[n] for n in quant_result}(three lines above the broken call)if name in quant_resultwhen buildingqModulespack_module(..., quant_result=quant_result, ...)The two other
make_quantcall sites in the codebase both pass it:quant_result?gptqmodel/models/loader.py:1418quant_result=modulesgptqmodel/models/writer.py:1171quant_result=modulesgptqmodel/utils/model.py:1168(pack_model)Fix
One line — forward the parameter that is already in scope:
quant_linear_cls = make_quant( model, qcfg=qcfg, + quant_result=quant_result, backend=backend,Verification
I do not have a GPU box here, so rather than hand-copying a repro (which can silently diverge from the source) I replayed the actual argument binding straight out of the AST:
make_quant's parameter list and eachCallnode's positional/keyword shape are read from the real files, a signature-identical stub is generated, and the binding is replayed.The unpatched run reproduces the exact
TypeErrorfrom the report above, and the patched run binds cleanly.Note on the base commit
My fork could not be synced to
main(the GitHub API refusesmerge-upstreamfor this token because the sync would touch.github/workflows/code_quality.yml, which needs theworkflowOAuth scope). The branch is therefore based on my fork's own tip. I checked the drift explicitly: themake_quantcall block inpack_modelis byte-identical between that commit and currentmain, and the upstream changes topack_modelsince then (theqModulescomprehension and theGPTQMODEL_MAX_PACKERShandling) are all below the lines this patch touches. The resulting diff is exactly+1/-0againstmain. Happy to rebase if you'd prefer.🤖 Generated with Claude Code