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] HF bridge: a matching-width pre-7.3.4 qzeros is deferred to meta, so a mixed GPU/CPU device_map fails in dispatch_model #6396
Loading a published pre-7.3.4 GPTQ checkpoint with a mixed GPU+CPU device_map fails inside accelerate.dispatch_model:
ValueError: qzeros is on the meta device, we need a `value` to put in on 0.
Checkpoint: ModelCloud/DeepSeek-R1-Distill-Qwen-7B-gptqmodel-4bit-vortex-v1
(meta.quantizer: ["gptqmodel:1.7.4"], checkpoint_format: "gptq", bits=4,
group_size=32, sym=true, desc_act=true). All 196 qzeros tensors in it are
32-aligned and already have the current ceil width.
ValueError: qzeros is on the meta device, we need a `value` to put in on 0.
The failing tensor is a GPU-placed Marlin projection
(self_attn.k_proj.qzeros). With max_memory={0: "1GiB", ...} the same load
instead fails later with ValueError: GPTQ Marlin requires CUDA tensors, got 'cpu'; that second failure is #6387 and this repro was measured on top of it.
Mechanism
_hf_legacy_qzeros_quant_linear wraps every symmetric checkpoint from a
pre-7.3.4 producer in a subclass with _HF_DEFER_SYM_QZEROS = True. PackedGroupedQuantLinear._save_to_state_dict then pops qzeros from the
state dict used to build the loader's expected-key set, so the checkpoint
tensor is never loaded and the module keeps its constructor (meta) buffer. _materialize_hf_sym_qzeros regenerates it, but Optimum calls that from post_init_model, i.e. afteraccelerate.dispatch_model.
The deferral only exists to hide the pre-#2983floor-width mismatch
(out_features // 32 * bits vs ceil(out_features * bits / 32)). The two
widths are identical for every 32-aligned projection, so for those layers
there is nothing to defer.
Fix direction
Resolve the deferral per layer at construction: when the legacy wrapper is
built for a 32-aligned out_features, clear _HF_DEFER_SYM_QZEROS so the
checkpoint tensor is loaded normally. A genuine floor-width projection keeps
the deferral and is still regenerated after loading. Moving _materialize_hf_sym_qzeros earlier is not safe because the kernel class can
still change during post-init (#6253/#6387).
Fixed by #6409 (merged as 203031939): GPTQQuantLinear.__init__ now clears _HF_DEFER_SYM_QZEROS for a 32-aligned legacy projection, so the checkpoint qzeros is loaded instead of staying meta until post-init. Floor-width layers keep the deferral. Verified on the checkpoint from this report with max_memory={0: "3GiB", "cpu": "14GiB"}: 3GiB OK {MarlinLinear: 196}, finite logits.
Activity
Qubitium commentedon Nov 29, 2026
Fixed by #6409 (merged as
203031939):GPTQQuantLinear.__init__now clears_HF_DEFER_SYM_QZEROSfor a 32-aligned legacy projection, so the checkpointqzerosis loaded instead of staying meta until post-init. Floor-width layers keep the deferral. Verified on the checkpoint from this report withmax_memory={0: "3GiB", "cpu": "14GiB"}:3GiB OK {MarlinLinear: 196}, finite logits.test(qzeros): pin the symmetric-qzeros state machine invariants (#6432)
Strict everywhere: port Accelerate-dispatch tests to GPTQModel placem…
Remove accelerate: explicit WeightLoader for weight loading, placemen…