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 #5247 (fix of #5194): gptqmodel_post_init now calls _post_init_offloaded for every BaseQuantLinear, which reads module.qweight - every NF12 / QQQ / VPTQ (and other qweight-less kernel) checkpoint fails to load with AttributeError, even on a single GPU #5261
Found on main @ c1807f8, RTX 4090, torch 2.15 + CUDA 13.2, transformers 5.22.
What is wrong
#5247 (fix of #5194, e247431) changed the generic branch of gptqmodel_post_init (gptqmodel/utils/model.py:2273-2274). It now calls _post_init_offloaded(submodule) for everyBaseQuantLinear, and that helper starts with:
Many kernels have no qweight attribute. Their payload lives under other names: NF12 (weight_*), QQQ (B/s_*), VPTQ (indices/centroids), FP8 (weight/weight_scale*), BitsAndBytes (weight), and likely MacaQ, FP4 and the W4A* kernels. Their post_init is never reached. EveryGPTQModel.load() of such a checkpoint now raises AttributeError: '<Kernel>' object has no attribute 'qweight'. This happens on a plain single-GPU load (device="cuda:0"), which has no offload at all.
Repro
2-layer Qwen2.5-0.5B-Instruct quantized with each method on main (quantize + save work), then:
FAIL nf12 AttributeError 'NF12Linear' object has no attribute 'qweight'
FAIL qqq AttributeError 'QQQLinear' object has no attribute 'qweight'
FAIL vptq AttributeError 'VPTQCudaLinear' object has no attribute 'qweight'
File "gptqmodel/models/loader.py", line 3845, in from_quantized
model = gptqmodel_post_init(model, use_act_order=qcfg.desc_act, quantize_config=qcfg)
File "gptqmodel/utils/model.py", line 2275, in gptqmodel_post_init
_post_init_offloaded(submodule)
File "gptqmodel/utils/model.py", line 2061, in _post_init_offloaded
if not module.qweight.is_meta:
At e247431^ (before #5247), the same three checkpoints load, and a forward returns finite logits:
OK nf12 ['NF12Linear'] finite True
OK qqq ['QQQLinear'] finite True
OK vptq ['VPTQCudaLinear'] finite True
GPTQ (Marlin), EXL3 and Paro checkpoints still load, because they have a qweight.
Suggested fix
Do not key the meta check on qweight. Check whether any persistent tensor of the module is on meta, e.g. any(t.is_meta for t in itertools.chain(module.parameters(recurse=False), module.buffers(recurse=False))). Better still, only take the offload branch when the layer actually has an Accelerate offload hook, and call module.post_init() unchanged otherwise.
Test that should have caught it
The #5247 tests only cover GPTQ/AWQ-GEMM modules (which have qweight). A load smoke test over one checkpoint per kernel family (NF12, QQQ, VPTQ, FP8, BnB) would have caught this. Every family has a save -> load test in tests/ that should now be red on a GPU host.
Severity
High. This is a regression that stops every NF12, QQQ, VPTQ (and by the same code path FP8 / BitsAndBytes / MacaQ / FP4) checkpoint from loading with GPTQModel.load.
Agent claim:agent-4e3a0639ecaf is working on this issue now.
Started 2026-11-18T15:45:01Z. 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: fix the #5247 regression: gptqmodel_post_init must not assume every BaseQuantLinear owns a qweight; route each kernel through its own meta/offload probe so NF12/QQQ/VPTQ/FP8/BnB checkpoints load again on a plain single-GPU load, with a per-kernel load regression matrix
So MacaQ is confirmed affected. FP8 is not affected, because TorchFP8Linear exposes a qweight property (#4948). The same crash also hits the in-session quantize -> save() -> GPTQModel.load() round trip for NF12 and QQQ on ROCm, not only older checkpoints.
When _post_init_offloaded calls plain module.post_init() for modules without qweight (the pre-#5247 behaviour), every one of these checkpoints loads again with unchanged PPL.
Agent claim released:agent-4e3a0639ecaf finished this issue.
PR: #5276 — base main, head a5a46600d (branch fix/5261-post-init-payload), 5 files, +736/−2.
Fix
_post_init_offloaded (and _post_init_cpu_offloaded_marlin) decided "disk-offloaded?" from module.qweight.is_meta. NF12, QQQ, VPTQ, BitsAndBytes and MacaQ never register qweight, so every plain GPTQModel.load() raised AttributeError before post_init ran.
BaseQuantLinear.checkpoint_payload_tensors() resolves the family's own CHECKPOINT_REQUIRED_BUFFERS (dotted submodule names included) and falls back to list_buffers() when a kernel declares nothing or its declared tensors were replaced by a derived cache.
BaseQuantLinear.checkpoint_payload_is_meta() is the new offload probe.
Both post-init paths now ask the kernel instead of assuming the GPTQ name. Resident layers still run post_init exactly once; meta layers still go materialize → post_init → restore-meta; undeclared meta kernels still fail closed.
docs/kernel-dispatch-cpu.md documents the contract.
Evidence
family
mainc1807f889
e24743120^
fixed
GPTQ / FP8
OK
OK
OK
NF12 / QQQ / VPTQ / BnB
AttributeError
OK
OK
New tests/test_post_init_payload_5261.py: 14 failed, 2 passed on pristine main → 16 passed on the fix (the 2 pristine passes are the GPTQ/Marlin control and FP8, whose PEFT adapter exposes a qweight property).
test_hf_bridge_cpu_offload_5022.py + new file: 32 passed (re-verified by the parent agent).
Not verified: MacaQ end-to-end load (payload-contract unit only; FP4 is not a BaseQuantLinear; W4A* inherits the GPTQ payload — reasoned, not loaded); device_map="disk" end-to-end for non-Marlin kernels (meta materialize/restore covered on CPU with a real NF12 layer plus fakes); tests/test_offload_files.py and tests/test_loader.py not run in full.
Fixed by #5276 (merged as 0054a03): gptqmodel_post_init now asks each kernel for its checkpoint payload (checkpoint_payload_is_meta()) instead of reading module.qweight, so NF12/QQQ/VPTQ/BnB checkpoints load on a plain single-GPU load again. Closing — the PR body did not carry the auto-close keyword.
Activity
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-4e3a0639ecafis working on this issue now.Started 2026-11-18T15:45:01Z. 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: fix the #5247 regression: gptqmodel_post_init must not assume every BaseQuantLinear owns a qweight; route each kernel through its own meta/offload probe so NF12/QQQ/VPTQ/FP8/BnB checkpoints load again on a plain single-GPU load, with a per-kernel load regression matrix
Qubitium commentedon Nov 18, 2026
Additional data from the round-22 quality sweep (
main@ c1807f8, RTX 4090 and R9700/ROCm), loading checkpoints withBACKEND.AUTO:GPTQModel.loadon mainMacaqTritonLinearAttributeError: 'MacaqTritonLinear' object has no attribute 'qweight'NF12LinearAttributeError(same path)QQQLinear(CUDA) /QQQTorchLinear(ROCm)AttributeError(same path)weight_scale_semantics="inverse")TorchFP8LinearSo MacaQ is confirmed affected. FP8 is not affected, because
TorchFP8Linearexposes aqweightproperty (#4948). The same crash also hits the in-session quantize ->save()->GPTQModel.load()round trip for NF12 and QQQ on ROCm, not only older checkpoints.When
_post_init_offloadedcalls plainmodule.post_init()for modules withoutqweight(the pre-#5247 behaviour), every one of these checkpoints loads again with unchanged PPL.🤖 Generated with Claude Code
fix(load): gate post_init on each kernel's checkpoint payload (#5261) (…
Qubitium commentedon Nov 18, 2026
Agent claim released:
agent-4e3a0639ecaffinished this issue.PR: #5276 — base
main, heada5a46600d(branchfix/5261-post-init-payload), 5 files, +736/−2.Fix
_post_init_offloaded(and_post_init_cpu_offloaded_marlin) decided "disk-offloaded?" frommodule.qweight.is_meta. NF12, QQQ, VPTQ, BitsAndBytes and MacaQ never registerqweight, so every plainGPTQModel.load()raisedAttributeErrorbeforepost_initran.BaseQuantLinear.checkpoint_payload_tensors()resolves the family's ownCHECKPOINT_REQUIRED_BUFFERS(dotted submodule names included) and falls back tolist_buffers()when a kernel declares nothing or its declared tensors were replaced by a derived cache.BaseQuantLinear.checkpoint_payload_is_meta()is the new offload probe.post_initexactly once; meta layers still go materialize →post_init→ restore-meta; undeclared meta kernels still fail closed.docs/kernel-dispatch-cpu.mddocuments the contract.Evidence
mainc1807f889e24743120^tests/test_post_init_payload_5261.py: 14 failed, 2 passed on pristinemain→ 16 passed on the fix (the 2 pristine passes are the GPTQ/Marlin control and FP8, whose PEFT adapter exposes aqweightproperty).test_hf_bridge_cpu_offload_5022.py+ new file: 32 passed (re-verified by the parent agent).Not verified: MacaQ end-to-end load (payload-contract unit only; FP4 is not a
BaseQuantLinear; W4A* inherits the GPTQ payload — reasoned, not loaded);device_map="disk"end-to-end for non-Marlin kernels (meta materialize/restore covered on CPU with a real NF12 layer plus fakes);tests/test_offload_files.pyandtests/test_loader.pynot run in full.Qubitium commentedon Nov 18, 2026
Fixed by #5276 (merged as 0054a03):
gptqmodel_post_initnow asks each kernel for its checkpoint payload (checkpoint_payload_is_meta()) instead of readingmodule.qweight, so NF12/QQQ/VPTQ/BnB checkpoints load on a plain single-GPU load again. Closing — the PR body did not carry the auto-close keyword.