Repository navigation
fix(writer): record GPTQ block_name_to_quantize for HF interop - #6222
Merged
Merged
Conversation
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
GPT-QModel knew the decoder-block path from each definition's
module_tree, but the writer never put it inconfig.json. Optimum's HF GPTQ loader then guessed from a short hard-coded list; models whose decoder is elsewhere (SmolVLM2'smodel.text_model.layers, MPT'stransformer.blocks) failed with:This records
quantization_config.block_name_to_quantizefrom the definition's effective layer-container path. The value is only emitted when the path exists in the materialized model and is unambiguous (a definition may declare multiple layout variants). A loaded checkpoint's existing value wins, so re-saving does not rewrite it. No other emitted keys change.Tests
Added to the existing checkpoint-compat family (
tests/test_checkpoint_compat.py), using a one-layer CPU MPT (transformer.blocks, not in Optimum'sBLOCK_PATTERNS):test_gptq_save_records_definition_block_nametest_gptq_block_name_loads_through_plain_hf(plainAutoModelForCausalLM.from_pretrained)test_gptq_resave_preserves_existing_block_nameRed evidence
Before the writer change (regression test kept, only
gptqmodel/models/writer.pyreverted):cd /root/openai-audit/issue-6182/tests PYTHONPATH=/root/openai-audit/issue-6182:/root/openai-audit/issue-6182/tests CUDA_VISIBLE_DEVICES= \ /root/venv/bin/python -m pytest test_checkpoint_compat.py -q -rs -k block_name --tb=lineGreen evidence
After the fix:
Lint:
/root/venv/bin/ruff check gptqmodel/models/writer.py tests/test_checkpoint_compat.py # All checks passed!Skips / unverified
test_checkpoint_compat.py: 3 skipped becauselm_headquantization needs an accelerator.test_checkpoint_interop_4053.py: 6 skipped (Marlin/ExLlamaV2/GPTQ Triton need CUDA).test_auto_nf12_excluded_layers.py: 15 skipped (AUTO_NF12 eligibility needs CUDA/HIP).module_treeprefix that SmolVLM declares (model.text_model.layers).Fixes #6182