Repository navigation
fix(awq): search a partial output tile instead of rejecting the width - #4513
Merged
Merged
Conversation
AWQ clip search picked oc_batch_size=256/64 and asserted out_features was divisible by it, while the portable packer only requires divisibility by its own packing factor. A supported quantize() therefore aborted with a bare AssertionError after scale search and never reached packing: Qwen3 hidden_size=96, AWQ W4 GEMM g32, CPU BACKEND.TORCH -> AssertionError: 96 % 64 != 0 Iterate tiles of oc_batch_size and crop every scratch slice to the tile's row count, so the final tile may be partial. Clip search is row-independent, so the bounds are unchanged for widths that were already accepted. Assert that the returned bounds cover every output row before the caller mutates the weight.
This was referenced Nov 17, 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
Fixes #4474. AWQ clip search chose
oc_batch_size = 256 if out_features % 256 == 0 else 64and then assertedout_features % oc_batch_size == 0, while the portable AWQ packer only requires divisibility by its own packing factor (torch_awq.py, 8). A supportedquantize()therefore aborted with a bareAssertionErrorafter scale search and final scale folds, before packing/saving:What Changed
gptqmodel/looper/awq_processor.py(_compute_best_clip): clip search now owns only a tile size. The loop walksrange(0, out_features, oc_batch_size)and every scratch slice on the output-channel axis is cropped to the tile's row count, so the final tile may be partial.oc_batch_sizeis clamped toout_featuresso widths below the tile size run as a single tile.RuntimeErrorif the returned bounds do not cover every output row before the caller mutates the weight (replacing the old bareassert).tests/test_awq_clip_consistency.py: tile-independence tests forout_features96/100/130 (group_size-1 and 32), comparing the full search against the same search over each tile's rows, plus exact-oracle coverage for widths 1/7/63/65.Clip search is row-independent, so results for widths that were already accepted are bitwise unchanged — the new tile tests assert exactly that.
Tests
CPU-only (
GPTQ_BYPASS_SAFETY_CHECKS=1,CUDA_VISIBLE_DEVICES="",PYTHONPATH= worktree):The 10 new parametrizations fail on unmodified
main(AssertionError: 96 % 64 != 0/1 % 64 != 0) and pass with the fix.The issue's own repro now completes end to end:
Notes
_compute_best_clipstill returns the same[out_features, n_group, 1]bounds.