Repository navigation
fix(awq): resolve regex -: exclusions to concrete modules on save - #6226
Merged
Merged
Conversation
AWQ wrote regex `-:` dynamic exclusions verbatim into `modules_to_not_convert`. vLLM/SGLang compare that list as plain substrings, so the excluded modules were still built as AWQ layers (vLLM crashes, SGLang silently loads them uninitialized). Resolve each exclusion against the saved model and publish the concrete dense module names; keep `dynamic` authoritative for GPT-QModel reloads. Without a model, omit the key rather than write an unmatched regex, which also preserves vLLM's dense-layer autodetection.
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 #6190
Problem
AWQ checkpoints wrote regex
-:dynamic exclusions verbatim intomodules_to_not_convert. vLLM (is_layer_skipped(..., match_mode="substring")) and SGLang (is_layer_skipped_awq) compare that list as plain substrings, so.*\.5\.self_attn\..*never matched. vLLM crashed at engine init; SGLang silently ran the excluded layers as uninitialized AWQ layers. The presence of the key also disabled vLLM's dense-layer autodetection.Fix
AWQConfig.resolve_excluded_modules(model)walks the saved model and records every quantizable module whosedynamicrule resolves toexcluded, i.e. the modules that actually stayed dense.prepare_quantize_config_for_savehook and before writingquantize_config.json; the existingconfig.jsonpatch block copies the same resolved list there.dynamickeeps the original regex rules for GPT-QModel reloads. Positive rules and non-AWQ methods are untouched.excluded_module_patterns()no longer emits regex text. If any-:rule cannot be resolved, the whole key is omitted (a partial list would still disable vLLM autodetection).Reproduction
At pre-fix HEAD, a tiny 2-layer Llama AWQ run with
dynamic={"-:.*\\.1\\.self_attn\\..*": {}}savedmodules_to_not_convert: [".*\\\\.1\\\\.self_attn\\\\..*"]in bothquantize_config.jsonandconfig.json.After the fix it saves:
Red evidence (pre-fix source, new tests)
Command:
4 failed, 1 passed:modules_to_not_convertpresent with the raw regex.assert {'.*\\\\.1\\\\.self_attn\\\\..*'} == {'model.layers...v_proj'}..*mlp.down_proj$exported alongside the literal.Green evidence (rebased on
b95b4c6)66 passed, 9 skippedSkips: 3
lm_headtests need an accelerator; 6test_checkpoint_interop_4053Marlin/ExLlamaV2/triton tests need CUDA.All checks passed!Unverified
Actual vLLM/SGLang engine load was not run (CPU-only environment; the installed namespace packages do not expose their runtimes). The tests mirror their substring skip check and assert the concrete names.
Tree
c1c51a4onfix/6190-issue, based onorigin/mainb95b4c6; only the six listed files changed.