Repository navigation
Conversation
AWQ only quantizes the decoder tree, so a definition's vision tower stays dense. HF/vLLM/SGLang learn that solely from modules_to_not_convert; without it Transformers builds AWQ layers for the dense vision MLPs and fails on kernel shape constraints. Resolve the definition's get_base_modules() inventory at save time and add every container that still owns a dense nn.Linear and no quantized layer to modules_to_not_convert. This is definition-owned (Qwen2-VL/2.5-VL visual, Gemma 3 vision_tower/projector, etc.) rather than a name list. The existing #6190 resolver turns the added container into the concrete dense module names for vLLM/SGLang. Test: Qwen2.5-VL composite AWQ quantize+save publishes the tower, the saved tensors keep dense vision weights, transformers' should_convert_module skips them, and a load+resave round trip preserves the exclusion. Qwen2-VL AWQ export and the text-model control are covered too.
Collaborator
Author
This was referenced Nov 29, 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.
Summary
AWQ only quantizes the decoder tree, so a model definition's vision tower stays dense. HF Transformers, vLLM and SGLang learn that solely from
modules_to_not_convert; GPT-QModel's AWQ writer published only-:/declared exclusions, so a Qwen2.5-VL AWQ checkpoint had no key andfrom_pretrainedbuilt AWQ layers for the dense vision MLPs.This change makes the writer add the definition's own dense base-module containers to
modules_to_not_convertbeforeconfig.json/quantize_config.jsonare written. The names come from the model definition'sget_base_modules()inventory (the same declaration used for base-module offload), filtered to containers that still own a densenn.Linearand contain no quantized layer. It is not a hardcoded per-model list: Qwen2-VL/2.5-VL publishmodel.visual, Gemma 3 publishesmodel.vision_tower/model.multi_modal_projector, etc.Fixes #6192.
Overlap with #6190
#6190 (already on
main) rewrote the-:translation. This PR does not touch_dynamic_exclusion_patterns,excluded_module_patternsor the-:translation logic. It only seeds the existingmodules_to_not_convertcompatibility field from the definition inventory; #6190'sresolve_excluded_modules()then turns the added container into the concrete dense module names for vLLM/SGLang. On the rebased tree the saved key is e.g.:Reproduction (HEAD b95b4c6, CPU)
Tiny Qwen2.5-VL composite, AWQ W4G16, quantize + save:
transformers.integrations.awq.replace_with_awq_linearon the saved config then tries to build an AWQ layer for the dense vision MLP and fails:Red test
Green evidence (rebased on 2d3261d)
The test asserts:
config.jsonandquantize_config.jsoncarry the same tower exclusion;should_convert_moduleisFalseformodel.visual.*andTruefor the decoder projection (the exact predicatereplace_with_awq_linearuses);model.visual.*.weightdense and only the decoder storesqweight;GPTQModel.load+ re-save preserves the exclusion and keepsmodel.visualdense.Manual post-fix consumer check with the saved config:
Test runs
CPU-only (
CUDA_VISIBLE_DEVICES=""):Skips are CUDA-only tests (Marlin/ExLlamaV2/lm_head quantization) under the CPU-only run. Lint:
Not verified
Qwen/Qwen2.5-VL-3B-InstructAWQ run and actualtransformers/ SGLangfrom_pretrainedwere not run (CPU-only, no GPU); the loader predicate and thereplace_with_awq_linearreplacement pass were exercised on tiny CPU models instead.test_checkpoint_compat.py::test_untied_lm_head_quantizes_and_reloadsfails in kernel selection because the device map spans compute capabilities 8.9 and 12.0. That test is GPTQ, not AWQ, and is unrelated to this change; it skips in the CPU-only run.