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] #4706 (fix of #4664) incomplete: default FP8Config checkpoints still write quant_method 'fp8', so plain transformers routes them to FineGrainedFP8: ~15 min of 3.9G-element CPU dequant, then a shape error (no refusal, no save-time warning) #5128
Found on main @ 7b8f127, CPU (transformers 5.22). Checkpoint: Qwen2.5-0.5B-Instruct quantized on this box with the default FP8Config().
What is wrong
#4706 (fix of #4664) made GPT-QModel-only layouts fail closed in plain transformers, but only for bitsandbytes. The FP8 half of #4664, reported in the follow-up comment on that issue, is still open:
FP8Config() (default weight_scale_method="row", weight_scale_semantics="inverse") writes quant_method: "fp8" with a per-row weight_scale_inv. Transformers registers its own fp8 quantizer (FineGrainedFP8, which expects 128x128 block scales), so REFUSED_HF_QUANT_METHODS (gptqmodel/_quant_methods.py:27-42) cannot register a refusing quantizer for it (setdefault keeps the transformers one, docs/hf-interop.md:277-279).
hf_compat_warnings (models/writer.py:319+) emits nothing for FP8, so the checkpoint carries no label either. GGUF had the same name collision, and it was solved by publishing gptqmodel_gguf instead (writer.py, the METHOD.GGUF branch).
docs/support-matrix.md:16 marks FP8 as not loadable by Transformers, and docs/hf-interop.md's failure contract promises that a GPT-QModel-only layout "raises when gptqmodel is imported". What actually happens with import gptqmodel and AutoModelForCausalLM.from_pretrained(ckpt, device_map="cpu", dtype=torch.bfloat16):
[transformers] Using FP8 quantized models requires a GPU or XPU, we will default to dequantizing the model to bf16
Loading weights: ... 223/290 [12:20<03:51, 3.30s/it]
model.layers.{0...23}.mlp.down_proj.weight | CONVERSION |
File ".../transformers/integrations/finegrained_fp8.py", line 1172, in _dequantize_one
return (q * s).to(output_dtype).reshape(original_shape)
RuntimeError: shape '[896, 4864]' is invalid for input of size 3904897024
RuntimeError: We encountered some issues during automatic conversion of the weights. For details look at the `CONVERSION` entries of the above report!
Before failing, transformers broadcasts the [896] row scale against the [896, 4864] codes into a 3.9-billion-element temporary (896*4864*896) for every projection. Over ~15 minutes the 290 weight conversions run at 2-6 s each, and the final error never mentions GPT-QModel or FP8 scale layout. The same happens without import gptqmodel. For comparison, GPTQModel.load of the same checkpoint gives nll 2.896 (TorchFP8Linear). The issue body of #4664 recorded the same behaviour at 12c1273, so nothing has changed for FP8.
Suggested fix
Do what was done for GGUF: write non-block FP8 checkpoints under a GPT-QModel-specific quant_method (for example gptqmodel_fp8), add that name to REFUSED_HF_QUANT_METHODS, and teach the GPT-QModel loader to read both names. Keep quant_method: "fp8" only for weight_scale_method="block" layouts that FineGrainedFP8 can actually read. At minimum, add an FP8 entry to hf_compat_warnings so the saved checkpoint is labelled.
Test that should have caught it
tests/test_checkpoint_interop_4053.py::test_hf_from_pretrained_refuses_every_gptqmodel_only_method and tests/test_checkpoint_compat.py::test_hf_compat_warning_for_every_gptqmodel_only_method iterate only REFUSED_HF_QUANT_METHODS, so FP8 is never exercised.
Severity
Medium for interop. A default-config FP8 checkpoint is not loadable by plain transformers, and the attempt costs about 15 minutes of CPU and huge temporaries before failing with a misleading error.
Agent claim:agent-root-5128-fp8-quant-method is working on this issue now.
Started 2026-11-18T05:49:19Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: fix: publish non-block FP8 checkpoints under a GPT-QModel-owned quant_method, refuse it in plain transformers, and warn at save time
Agent claim:agent-4e3a0639ecaf is working on this issue now.
Started 2026-11-18T08:20:30Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: stop default FP8Config checkpoints writing quant_method fp8 (plain transformers then routes them to FineGrainedFP8 and burns 15 min on a wrong CPU dequant); publish a GPT-QModel-owned method and refuse/warn at save time
The rename in #5181 is the right stopgap, but it labels the problem rather than fixing it. FP8Config's default row/tensor layout is a GPT-QModel-only "faux FP8": E4M3 weights with a 1-D per-row (or scalar) inverse scale, weight-only, dequantized to bf16 in TorchFP8Linear. It is not FP8 GEMM, and its scale layout matches no standard FP8 checkpoint schema, which is why every save either collides with a real fp8 name or needs a private alias like gptqmodel_fp8.
We should hard-deprecate the row/tensor export instead of maintaining it:
Load-only for existing quant_method: fp8 / gptqmodel_fp8 checkpoints; stop writing new ones.
Warn at FP8Config() construction and at save, then refuse the export after the deprecation window.
Target MXFP8 (E4M3/E5M2 values, E8M0 block-32 scales, OCP microscaling) and NVFP8 (E4M3 values, FP8 block-16 scales plus the per-tensor _scale_2) as the supported FP8 exports, under quant_method names that don't collide.
The read side already exists: utils/model_dequant.py decodes E8M0 block-32 and _scale_2, and Marlin carries MXFP8 kernels. What's missing is the quantize/export path, not a new kernel family. That would leave fp8 with one meaning in checkpoints, make the accuracy claim defensible against a real block-scaled baseline, and stop us shipping a format only we can load.
Activity
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-root-5128-fp8-quant-methodis working on this issue now.Started 2026-11-18T05:49:19Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: fix: publish non-block FP8 checkpoints under a GPT-QModel-owned quant_method, refuse it in plain transformers, and warn at save time
Qubitium commentedon Nov 18, 2026
Agent claim released — withdrawn.
This claim comment was posted outside the
issue-claimhelper, so it is not tracked by the fleet'sheldview. Withdrawing it; the issue is free.Qubitium commentedon Nov 18, 2026
Agent claim released — withdrawn.
This claim was posted outside the
issue-claimhelper. Superseding it with the same workload id so the fleet no longer treats it as live.Qubitium commentedon Nov 18, 2026
Agent claim:
agent-4e3a0639ecafis working on this issue now.Started 2026-11-18T08:20:30Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: stop default FP8Config checkpoints writing quant_method
fp8(plain transformers then routes them to FineGrainedFP8 and burns 15 min on a wrong CPU dequant); publish a GPT-QModel-owned method and refuse/warn at save timefix(fp8): publish non-block FP8 as `gptqmodel_fp8` (#5128)
fix(fp8): publish non-block FP8 as `gptqmodel_fp8` (#5128)
Qubitium commentedon Nov 18, 2026
The rename in #5181 is the right stopgap, but it labels the problem rather than fixing it.
FP8Config's defaultrow/tensorlayout is a GPT-QModel-only "faux FP8": E4M3 weights with a 1-D per-row (or scalar) inverse scale, weight-only, dequantized to bf16 inTorchFP8Linear. It is not FP8 GEMM, and its scale layout matches no standard FP8 checkpoint schema, which is why every save either collides with a realfp8name or needs a private alias likegptqmodel_fp8.We should hard-deprecate the row/tensor export instead of maintaining it:
quant_method: fp8/gptqmodel_fp8checkpoints; stop writing new ones.FP8Config()construction and at save, then refuse the export after the deprecation window._scale_2) as the supported FP8 exports, underquant_methodnames that don't collide.The read side already exists:
utils/model_dequant.pydecodes E8M0 block-32 and_scale_2, and Marlin carries MXFP8 kernels. What's missing is the quantize/export path, not a new kernel family. That would leavefp8with one meaning in checkpoints, make the accuracy claim defensible against a real block-scaled baseline, and stop us shipping a format only we can load.fix(fp8): publish non-block FP8 as `gptqmodel_fp8` (ModelCloud#5128) (M…