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] Follow-up on #4380/#4381: after quantize() with the default offload_to_disk=True, layers stay disk-offloaded and hooked (can't .to(), re-read every forward, break after gc); AWQ/QQQ keep CUDA-only kernels on CPU; FP8/GGUF hit a device mismatch #4450
Severity: high. Kind: incomplete fix of #4380 (3cc0492) and #4381 (1b48454). 03f778e/a427804 make one part worse. Confirmed at 489aed6 on an RTX 4090 with Qwen2.5-0.5B-Instruct.
The #4380 decode fix works. Over an 8-config matrix (gptq/gptq_v2 × sym/asym × desc_act), in-session NLL now matches the reloaded checkpoint within 3e-4. But the in-session model is still not a normal model.
1. Offload hooks and meta tensors stay on quantized layers
(a) Hooks and meta tensors remain. 168 modules still have _hf_hook and 912 meta buffers remain. Every forward re-reads the quantized weights from the safetensors bundles on disk. The offload_to_disk=False control has 0 hooks and 0 meta tensors.
(b) The model can't be moved.m.model.to("cuda:0") raises NotImplementedError: Cannot copy out of meta tensor. The model is left half-moved, and a later generate fails with "Expected all tensors on the same device".
Actual:NotImplementedError: Could not run 'gptqmodel_awq::gemm_forward_fp32_reduce' ... 'CPU' backend. QQQ gives the same error from gptqmodel_qqq::qqq_gemm.
Cause:rehome_quantized_kernel (models/base.py ~600-660). Every qweight is on meta while offloaded, so runtime_device() skips them all, device is None, and the function returns without switching the kernel.
Control: with offload_to_disk=False, AWQ switches to AwqTorchLinear. In-session NLL 16.0237 vs reloaded 16.0235.
3. FP8/GGUF in-session fail with "Expected all tensors to be on the same device, cuda:0 and cpu"
Repro:QuantizeConfig(method="fp8") or QuantizeConfig(method="gguf", bits=4, format="q_k_m") with the default offload, call quantize(), then run a forward or generate.
What happens:
weight_only_looper._materialize_meta_base_modules puts embed_tokens, norm and rotary_emb on CPU.
The quantized modules are hooked with execution device CPU.
The per-layer input_layernorm and post_attention_layernorm are left on cuda:0.
RMSNorm fails at self.weight * hidden_states.
Control: with offload_to_disk=False both work.
FP8: 16.0344 in-session vs 16.034 reloaded.
GGUF: 16.0056 vs 16.0042.
Found during an AI-assisted review (Claude Code, round 13) of 489aed6; repros were run at that commit (A/B against def6e61 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
A second reviewer confirmed this independently at 489aed6 on an RTX 5090, and found that RTN (weight-only) is affected the same way as FP8/GGUF:
m=GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", quantize_config=RTNConfig(bits=4, group_size=128))
m.quantize(["The quick brown fox jumps over the lazy dog. "*8+str(i) foriinrange(16)], batch_size=4)
m.generate("The capital of France is", max_new_tokens=8)
Devices are mixed.embed_tokens and model.norm are on CPU, while all 48 input_layernorm / post_attention_layernorm stay on cuda:0.
Every input path fails:
generate(str) and a forward with CPU ids fail with Expected all tensors to be on the same device ... cuda:0 and cpu in RMSNorm.
A forward with CUDA ids fails with an index_select device error.
Where:gptqmodel/looper/weight_only_looper.py:1222-1226. With offload on, the layer-wide post_quantize() CPU move is skipped.
Behaviour at def6e61: it failed earlier, with a meta .item() error.
Control: with offload_to_disk=False, in-session runs and equals the reload exactly (PPL 24.8083).
That reviewer also confirmed part 2: AWQ with default offload, then generate → gemm_forward_fp32_reduce ... 'CPU' backend.
Default-offload GPTQ in-session on CPU is fine: it matches the reload bit-exactly (NLL 3.03941 both).
Activity
Qubitium commentedon Nov 16, 2026
A second reviewer confirmed this independently at 489aed6 on an RTX 5090, and found that RTN (weight-only) is affected the same way as FP8/GGUF:
embed_tokensandmodel.normare on CPU, while all 48input_layernorm/post_attention_layernormstay oncuda:0.generate(str)and a forward with CPU ids fail withExpected all tensors to be on the same device ... cuda:0 and cpuin RMSNorm.gptqmodel/looper/weight_only_looper.py:1222-1226. With offload on, the layer-widepost_quantize()CPU move is skipped..item()error.offload_to_disk=False, in-session runs and equals the reload exactly (PPL 24.8083).That reviewer also confirmed part 2: AWQ with default offload, then
generate→gemm_forward_fp32_reduce ... 'CPU' backend.Default-offload GPTQ in-session on CPU is fine: it matches the reload bit-exactly (NLL 3.03941 both).
(AI-assisted review, round 13 at
489aed6)fix(offload): leave a normal in-session model after disk-offloaded qu…
tests: pin file-backed offload instead of meta + hook offload (#6471)
Remove accelerate: explicit WeightLoader for weight loading, placemen…