Repository navigation
Description
Found on main @ b225a43, RTX 4090 and CPU (transformers 5.22.1, torch 2.15). This is pre-existing: tests/test_qwen2_5_omni_lm_head.py fails the same way at 12c1273.
What is wrong
A Qwen2.5-Omni model quantized and saved by GPT-QModel reloads with its non-quantized weights uninitialized: the whole audio tower, the whole vision tower, and the text embed_tokens. Nothing is logged. There is no missing-key or unexpected-key warning.
The saved checkpoint uses the in-memory Transformers 5.22 module layout, not the on-disk HF layout of the source checkpoint:
| tensor | source checkpoint (HF layout) | written by model.save() |
|---|---|---|
| audio conv | thinker.audio_tower.conv1.weight |
thinker.model.audio_tower.conv1.weight |
| vision patch embed | thinker.visual.patch_embed.proj.weight |
thinker.model.visual.patch_embed.proj.weight |
| text embeddings | thinker.model.embed_tokens.weight |
thinker.model.language_model.embed_tokens.weight |
GPTQModel.load() of that output does not map these keys back onto the modules. The parameters keep their torch.empty contents, which are random values and sometimes NaN/inf. The quantized decoder layers do load.
Qwen2.5-VL is not affected: the same RTN quantize -> save -> reload on Qwen2.5-VL-3B (2 text layers) restores visual.patch_embed and embed_tokens exactly. The problem is specific to the nested thinker layout of Omni.
Repro on the real model
Qwen2.5-Omni-3B with the thinker text decoder truncated to 2 layers (config copy, same weights). Weight-only RTN, so no calibration is needed. require_pkgs is cleared only because audioread is not installed on this host, the same way the repo test does it.
import torch, json
from gptqmodel import GPTQModel, BACKEND
from gptqmodel.quantization.config import RTNConfig
from gptqmodel.models.definitions.qwen2_5_omni import Qwen2_5_OmniGPTQ
Qwen2_5_OmniGPTQ.require_pkgs = []
m = GPTQModel.load("Qwen/Qwen2.5-Omni-3B", quantize_config=RTNConfig(bits=4, group_size=128), dtype=torch.bfloat16)
m.quantize(None); m.save("out")
q = GPTQModel.load("out", backend=BACKEND.TORCH, device="cuda:0", dtype=torch.bfloat16)
th = q.model.thinker
# compare with the tensors in the original safetensorsOutput (reloaded vs original source tensor):
saved keys: thinker.model.audio_tower.conv1.weight, thinker.model.language_model.embed_tokens.weight, thinker.model.visual.patch_embed.proj.weight
thinker.audio_tower.conv1.weight reloaded==original: False finite: False max|diff|: nan
thinker.visual.patch_embed.proj.weight reloaded==original: False finite: True max|diff|: 0.1387
thinker.model.embed_tokens.weight reloaded==original: False finite: True max|diff|: 0.9102
On the repo's tiny Omni fixture (CPU, RTN, lm_head=False), 50 of the 82 saved tensors differ from what the reloaded model holds, and 18 are non-finite: every audio_tower.* and visual.* tensor plus embed_tokens. Two reloads of the same directory give different values.
Failing repo tests
tests/test_qwen2_5_omni_lm_head.py::test_omni_lm_head_quantize_save_reload fails for all 8 cases:
[*-rtn]:AssertionError: thinker.model.audio_tower.conv1.weight: Tensor-likes are not equal! ... Greatest absolute difference: nan. The test reloads twice and compares, which exposes the uninitialized memory.[*-gptq]:quantize()itself raisesRuntimeError: Offload: base modules remain on the meta device after quantization (thinker.lm_head)afterWARN Offload: failed to restore 'thinker.lm_head': File does not contain tensor weight. This is the same layout mismatch, hit on the in-session restore path.
Suggested fix
Write the checkpoint in the source (HF) key layout by applying the model's reverse checkpoint-conversion mapping on save, as save_pretrained does. Alternatively, apply the forward conversion when loading GPT-QModel checkpoints. In either case, fail loudly when a checkpoint leaves any non-quantized parameter unmaterialized after load, instead of silently keeping torch.empty storage.
Severity
High. Every GPT-QModel-quantized Qwen2.5-Omni checkpoint (GPTQ, RTN, ...) loads with random audio/vision encoders and random text embeddings, and nothing is reported.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-53ba17eb4d83finished this issue.Pull request: #4801
Qwen2.5-Omni reload writes thinker.model.* internal layout; uninitialized towers/embed; worktree /root/work-4758
fix(omni): save and load Qwen2.5-Omni checkpoints in the source HF ke…