Repository navigation
fix(omni): save and load Qwen2.5-Omni checkpoints in the source HF key layout (#4758) - #4810
Merged
Merged
Conversation
This was referenced Nov 17, 2026
sLaffey
pushed a commit
to sLaffey/GPTQModel
that referenced
this pull request
Nov 18, 2026
…lCloud#4978) Seven tests went red because their doubles/oracles predate library changes that behave as intended. This is test-only; no product code changes. - test_fusion_kernel_backends: gc.collect() before the weakref check; ModelCloud#4871 leaves transient Dynamo trace garbage that keeps the pre-fusion weight alive. The refs are still asserted dead afterwards. - test_failed_run_fence_4595: del qmodel + gc.collect() so ModelCloud#4829's finalizer runs before the no-leak assertion; a late finalizer must not recreate the released run dir. - test_exl3_projection_resume: add _release_deferred_hessian_sources() to the _Capture double (ModelCloud#4837). - test_kernel_audit_regressions: stub _needs_torch_fallback=lambda: False on the SimpleNamespace self (ModelCloud#4835). - test_moe_resave_preserves_experts_4589: accept the earlier RuntimeError "does not provide tensors" refusal (ModelCloud#4810); still assert no safetensors. - test_positional_mask_capture_4660: build the native oracle with the same mask-derived position_ids the capture uses (ModelCloud#4930). - test_qqq_kernel_memory_4387: snapshot the oracle weight/s_channel before the first forward, which may drop the checkpoint layout (ModelCloud#4856).
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Qwen2.5-Omni model quantized and saved by GPT-QModel was written in the in-memory Transformers 5.22 layout (
thinker.model.audio_tower.*,thinker.model.visual.*,thinker.model.language_model.embed_tokens.*). On reload the reverse map's broadthinker.model.(.+) -> thinker.model.language_model.\1rule double-prefixed those keys, so the dense tensors were never loaded: the audio tower, vision tower andembed_tokenskepttorch.emptystorage (random, sometimes NaN) with no warning. All 8test_omni_lm_head_quantize_save_reloadcases failed on main.Fix
gptqmodel/models/definitions/base_qwen2_5_omni.py: addcheckpoint_key_for_save/checkpoint_key_for_loadbuilt on the model'sHF_CONVERSION_MAP_REVERSED(the Gemma3 pattern), so quantized saves writethinker.audio_tower.*,thinker.visual.*,thinker.model.embed_tokens.*,thinker.model.layers.*.gptqmodel/utils/model.py: after a quantized load,_raise_on_unmaterialized_checkpoint_parameterscompares the converted checkpoint key set against live parameters and raises aRuntimeErrornaming them when a non-quantized parameter has no source tensor. It skips meta/lazy-shell params,QUANT_TYPEmodule params, tied params sharing a loaded tensor and_keys_to_ignore_on_load_missing.gptqmodel/utils/offload.py:restore_offloaded_modulesskips a captured base module that was replaced during quantization (thethinker.lm_headbundle collision that causedOffload: base modules remain on the meta device).Tests
tests/test_qwen2_5_omni_lm_head.py:test_omni_saved_checkpoint_uses_source_hf_layout(GPTQ + RTN,lm_head=False): asserts source-layout keys for the audio tower / vision tower /embed_tokens/ decoder and a bit-identical reload from the file;test_omni_load_fails_loudly_on_unmapped_checkpoint_keys.Red on parent: 2 failed —
assert 'thinker.audio_tower.conv1.weight' in {'thinker.model.audio_tower.conv1.weight': ...}(GPTQ + RTN); removing only the save mapping produces the louddoes not provide tensors for 50 non-quantized parameter(s)error, matching the issue's 50/82 tensors.Verification
tests/test_qwen2_5_omni_lm_head.py: 19 passed (all 8 original save/reload cases, CPU + cuda:0)test_gemma3_vl_support.py18 passed;models/test_non_w4a_lifecycle.py16 passed;test_checkpoint_interop_4053.py27 passed/1 skipped; legacy VL + LFM2-VL + InternVL: 8 passed/10 skippedruff check gptqmodel tests: cleantest_checkpoint_compat.py::test_untied_lm_head_quantizes_and_reloadsfails identically on parent (Marlin JIT,CUDA_HOMEunset) — environmentalCloses #4758