Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(model-manager): keep Qwen3-VL single files out of the Qwen2.5-VL checkpoint config (#10366)

Lincoln Steineaff21c1527f
diff --git a/invokeai/backend/model_manager/configs/qwen_vl_encoder.py b/invokeai/backend/model_manager/configs/qwen_vl_encoder.py
index eabccd54ac..a180fe62f3 100644
--- a/invokeai/backend/model_manager/configs/qwen_vl_encoder.py
+++ b/invokeai/backend/model_manager/configs/qwen_vl_encoder.py
@@ -13,6 +13,7 @@ from invokeai.backend.model_manager.configs.identification_utils import (
raise_if_not_dir,
raise_if_not_file,
)
+from invokeai.backend.model_manager.configs.qwen3_encoder import _has_qwen3_specific_keys
from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType
@@ -152,6 +153,10 @@ class QwenVLEncoder_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
if not _has_qwen_vl_keys(keys):
raise NotAMatchError("state dict does not look like a Qwen2.5-VL/Qwen2-VL checkpoint")
+ # Qwen3-VL single files (Krea-2, Ideogram 4, MiniMax H3) share this LM + visual-tower layout; only
+ # Qwen3's QK-norm tells them apart. Both configs would otherwise match, leaving the pick to set order.
+ if _has_qwen3_specific_keys(keys):
+ raise NotAMatchError("state dict has Qwen3 QK-norm weights; this is a Qwen3-VL checkpoint, not Qwen2.5-VL")
return cls(**override_fields)
diff --git a/tests/backend/model_manager/configs/test_qwen_vl_encoder_config.py b/tests/backend/model_manager/configs/test_qwen_vl_encoder_config.py
index 9678b99711..c75ffaa5c0 100644
--- a/tests/backend/model_manager/configs/test_qwen_vl_encoder_config.py
+++ b/tests/backend/model_manager/configs/test_qwen_vl_encoder_config.py
@@ -99,3 +99,24 @@ def test_checkpoint_config_rejects_non_safetensors_extension() -> None:
with pytest.raises(NotAMatchError, match="expected a .safetensors file"):
QwenVLEncoder_Checkpoint_Config.from_model_on_disk(mod, dict(_OVERRIDE_FIELDS))
+
+
+def test_checkpoint_config_rejects_qwen3_vl_safetensors() -> None:
+ """A Qwen3-VL single file (e.g. MiniMax H3's 32B encoder) has the same LM + visual layout but QK-norm."""
+ with TemporaryDirectory() as tmpdir:
+ path = Path(tmpdir) / "qwen3vl_32b_minimax_h3_int8_convrot.safetensors"
+ _write_safetensors(
+ path,
+ [
+ "model.embed_tokens.weight",
+ "model.layers.0.self_attn.q_proj.weight",
+ "model.layers.0.self_attn.q_norm.weight",
+ "visual.blocks.0.attn.qkv.weight",
+ ],
+ )
+
+ mod = MagicMock()
+ mod.path = path
+
+ with pytest.raises(NotAMatchError, match="Qwen3-VL"):
+ QwenVLEncoder_Checkpoint_Config.from_model_on_disk(mod, dict(_OVERRIDE_FIELDS))