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] With default offload_to_disk=True, using the model in-session after quantize() is broken: CPU input_ids silently generate garbage, CUDA inputs and string prompts crash #4203
Severity: medium (default config; one input form returns silently wrong output) Version: 7.11.0 @ 9dad249
Summary
looper/module_looper.py:1904-1918 offloads base modules (embed_tokens) to disk/meta and never restores them after quantization.
utils/structure.py:1272-1273: LazyTurtle.materialize_submodule calls target_model.tie_weights() after every layer. That re-ties lm_head.weight to the meta embedding parameter, which has no offload hook.
Afterwards model.device is meta.
Reproduce (Qwen3-0.6B, tied embeddings)
fromgptqmodelimportGPTQModel, QuantizeConfigcal= ["The quick brown fox jumps over the lazy dog. "*8+str(i) foriinrange(16)]
foroffin (False, True):
m=GPTQModel.load("Qwen/Qwen3-0.6B", quantize_config=QuantizeConfig(bits=4, group_size=128, offload_to_disk=off))
m.quantize(cal, batch_size=4, calibration_data_min_length=1)
hf=m.modelprint(off, hf.device, hf.get_input_embeddings().weight.device, hf.get_output_embeddings().weight.device)
print(m.generate(**m.tokenizer("Hello, my name is", return_tensors="pt"), max_new_tokens=8, do_sample=False)[0].tolist())
m.generate("Hello, my name is", max_new_tokens=8)
Actual with offload_to_disk=True:
embed_tokens and lm_head are meta, and hf.device == meta.
A string prompt raises Tensor.item() cannot be called on meta tensors.
CUDA ids raise Expected all tensors to be on the same device ... cuda:0 and cpu in RMSNorm.
Expected: output identical to offload_to_disk=False in-session and to the reloaded checkpoint ([9707, 11, 847, 829, 374, 1172, 95480, 453, ...]), or a clear error telling the user to reload the saved checkpoint.
Different path from the lm_head=True + tied + offload crash in #4184.
Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
fix: restore offloaded base modules after quantization (#4203) (#4295)
Qubitium commentedon Nov 16, 2026
Round-11 follow-up at
842d666: the same symptom withoffload_to_disk=False, for non-GPTQ methods.After
quantize(), the quantized modules sit on CPU.TorchLinear, so in-sessiongenerate()works.AwqGEMMLinear/AwqGEMVLinear/AwqGEMVFastLinear.QQQLinear.GGUFTritonKernel.These kernels are all CUDA-only, so in-session generation crashes:
NotImplementedError: Could not run 'gptqmodel_awq::gemm_forward' with arguments from the 'CPU' backend.qqq_gemm.Found by AI-assisted review (Claude Code) on RTX 4090.
tests: pin file-backed offload instead of meta + hook offload (#6471)
Remove accelerate: explicit WeightLoader for weight loading, placemen…