You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Regression from #5242: gptqmodel_fp8 checkpoints written by GPT-QModel (#5181..#5242) are no longer refused by transformers - they load as plain Linear with only a 'skip quantization' warning and produce NaN (legacy fp8+inverse checkpoints still unguarded) #5272
Found on main @ c1807f8, RTX 4090, torch 2.15 + CUDA 13.2, transformers 5.22.
What is wrong
#5242 removed FP8_EXPORT_QUANT_METHOD = "gptqmodel_fp8" from REFUSED_HF_QUANT_METHODS (gptqmodel/_quant_methods.py). import gptqmodel therefore no longer registers a refusing quantizer for it. Checkpoints that GPT-QModel itself wrote with quant_method: "gptqmodel_fp8" still exist. Every FP8 save from #5181 up to #5242 produced one: non-block layouts since #5181, and all layouts since #5214. They are inverse-scale FP8 checkpoints.
Before #5242, AutoModelForCausalLM.from_pretrained on such a checkpoint failed with a clear, actionable error. On main, transformers logs "Unknown quantization type ... we will skip the quantization". It then loads the float8weight tensors into plain nn.Linear with no scales, and the model returns NaN logits. Nothing is raised.
GPTQModel.load of the same checkpoints is fine on main. All three legacy checkpoints below give a 20-window wikitext PPL of 20.947, identical to the old tree. So only the transformers-side guard regressed. docs/fp8-load-only.md:81 and docs/checkpoint-interop.md:517 say gptqmodel_fp8 is "not recognized". That is not what happens on either path.
Repro
FP8 checkpoint of Qwen2.5-0.5B-Instruct written with the default FP8Config() (row/inverse) at 13674151b (the parent of #5242). config.json has "quant_method": "gptqmodel_fp8", "weight_scale_semantics": "inverse".
importgptqmodel# installs the refusing HF quantizersfromtransformersimportAutoModelForCausalLMm=AutoModelForCausalLM.from_pretrained(CKPT, device_map="cuda:0")
Legacy checkpoints written by v7.11.2 and earlier publish plain quant_method: "fp8" with weight_scale_semantics: "inverse". These still get no refusal at all. That is the #5202 case: block layout loads as NaN through FineGrainedFP8, and row layout fails on a shape mismatch. Their config declares weight_scale_semantics: "inverse", which no production FP8 producer writes, so the guard can recognize them.
Suggested fix
Keep "gptqmodel_fp8" in REFUSED_HF_QUANT_METHODS / _REMEDIES as a legacy, load-only name, the same way the legacy Paro name is kept.
In the HF hook, also refuse a quant_method: "fp8" config that declares weight_scale_semantics: "inverse", with the same "use GPTQModel.load" remedy.
Fix the two doc lines that say the name is "not recognized".
Test that should have caught it
tests/test_fp8.py lost its gptqmodel_fp8 refusal assertion in #5242. Add a test with a legacy-config fixture (quant_method: gptqmodel_fp8 or fp8 + inverse) and assert that AutoModelForCausalLM.from_pretrained raises with gptqmodel imported.
Severity
Low-medium. The output is silently wrong (NaN) for GPT-QModel-written FP8 checkpoints loaded through transformers with gptqmodel installed. The gptqmodel_fp8 window was only main between #5181 and #5242. The fp8 + inverse case covers every released FP8 checkpoint up to v7.11.2.
Agent claim:agent-4e3a0639ecaf is working on this issue now.
Started 2026-11-18T16:25:37Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Scope: make gptqmodel_fp8 checkpoints written by #5181..#5242 still load after #5242 made FP8 load-only: accept the legacy layout or migrate it, with a round-trip test
Agent claim released:agent-4e3a0639ecaf finished this issue.
PR: #5287 — base main, head bdf6b2f82 (branch fix/5272-fp8-legacy-ckpt), 10 files, +423/−38.
Fix
The tensor layout never changed: #5242 removed the gptqmodel_fp8 refusal registration and the _normalize_quant_method alias, so a legacy checkpoint either failed as Unknown quantization method: gptqmodel_fp8 (alias-only configs) or — worse — was silently loaded by transformers as a plain Linear, dropping the scales. This restores a read-only compatibility path (no quantize/export comes back):
gptqmodel_fp8 is accepted again as an alias of fp8 on the GPT-QModel load path and normalized before kernel selection.
The HF refusing-quantizer registration recognizes the legacy name, so the HF path raises the actionable GPT-QModel error instead of silently loading dense weights.
fp8 + weight_scale_semantics="inverse" (the legacy GPT-QModel convention) is no longer mis-dispatched to FineGrainedFP8 (which produced a shape mismatch).
loads, logits sum -1194494.875 (identical to the pre-#5242 tree)
HF from_pretrained on gptqmodel_fp8
silently loaded as dense Linear, logits sum 1052054.125
raises the actionable ValueError
HF fp8 + inverse
RuntimeError shape mismatch from FineGrainedFP8
correct
New tests: 4 failed on pristine main, all green after; tests/test_fp8.py22 passed; tests/test_fp8*.py (12 files) 117 passed / 2 skipped; FP8 kernels 127 passed / 6 skipped; HF-refusal/checkpoint-compat + docs contract 130 passed / 5 skipped; ruff clean.
Not verified: no wikitext PPL run (evidence is fixed-prompt logits on the real 0.5B legacy checkpoint plus a dense Torch oracle on the tiny fixture); the real fixture is row/inverse only (block/inverse covered by the tiny fixture); no production fp8 + multiplier checkpoint available (a control test asserts FineGrainedFP8HfQuantizer is still selected); transformers below the repo floor not tested.
Activity
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-4e3a0639ecafis working on this issue now.Started 2026-11-18T16:25:37Z. The claim expires 4.0h after this comment is last edited (heartbeat). Other agents: do not start this issue while the claim is live.
Scope: make gptqmodel_fp8 checkpoints written by #5181..#5242 still load after #5242 made FP8 load-only: accept the legacy layout or migrate it, with a round-trip test
Qubitium commentedon Nov 18, 2026
Agent claim released:
agent-4e3a0639ecaffinished this issue.PR: #5287 — base
main, headbdf6b2f82(branchfix/5272-fp8-legacy-ckpt), 10 files, +423/−38.Fix
The tensor layout never changed: #5242 removed the
gptqmodel_fp8refusal registration and the_normalize_quant_methodalias, so a legacy checkpoint either failed asUnknown quantization method: gptqmodel_fp8(alias-only configs) or — worse — was silently loaded by transformers as a plainLinear, dropping the scales. This restores a read-only compatibility path (no quantize/export comes back):gptqmodel_fp8is accepted again as an alias offp8on the GPT-QModel load path and normalized before kernel selection.fp8+weight_scale_semantics="inverse"(the legacy GPT-QModel convention) is no longer mis-dispatched toFineGrainedFP8(which produced a shape mismatch).checkpoint-interop.md,fp8-load-only.md,hf-interop.md,quantization-guide.md,support-matrix.md.Evidence
The legacy fixture was written by the pre-#5242 writer at
13674151b(0.5B, row/inverse) and is kept in.scratch/legacy_qwen25_fp8_row.main0aa2d4b48GPTQModel.loadValueError: Unknown quantization method: gptqmodel_fp8-1194494.875(identical to the pre-#5242 tree)from_pretrainedongptqmodel_fp8Linear, logits sum1052054.125ValueErrorfp8+inverseRuntimeErrorshape mismatch fromFineGrainedFP8main, all green after;tests/test_fp8.py22 passed;tests/test_fp8*.py(12 files) 117 passed / 2 skipped; FP8 kernels 127 passed / 6 skipped; HF-refusal/checkpoint-compat + docs contract 130 passed / 5 skipped; ruff clean.Not verified: no wikitext PPL run (evidence is fixed-prompt logits on the real 0.5B legacy checkpoint plus a dense Torch oracle on the tiny fixture); the real fixture is row/inverse only (block/inverse covered by the tiny fixture); no production
fp8+ multiplier checkpoint available (a control test assertsFineGrainedFP8HfQuantizeris still selected); transformers below the repo floor not tested.fix(fp8): read legacy gptqmodel_fp8 checkpoints (#5272) (#5287)