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.

feat(krea-2): read edit references with a GGUF encoder through the mmproj vision tower (#10244)

Alexander Eichhorn9ee34cd61d73
diff --git a/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx b/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
index ec09b16efa..d38fb59cfd 100644
--- a/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
@@ -104,7 +104,8 @@ CLIP encoders from the main model only, so a separate CLIP file does not change
FLUX.1 takes CLIP-L only.
The Qwen3-VL and Qwen2.5-VL GGUF encoders are the language model only. The Qwen3-VL `mmproj` vision file installs
-as its own **Qwen3-VL Vision Tower** model, which Qwen-Image-2.1 edits read reference images through; a Qwen2.5-VL
+as its own **Qwen3-VL Vision Tower** model, which Krea-2 (the 4B file) and Qwen-Image-2.1 (the 8B file) edits read
+reference images through beside a GGUF encoder; a Qwen2.5-VL
`mmproj` file is refused. Without the vision tower, Qwen-Image Edit cannot read reference images with the Qwen2.5-VL GGUF encoder and says so
before generating. A Qwen2-VL GGUF, the previous generation under the same llama.cpp architecture name, is refused.
Qwen3-VL nvfp4 single files keep their layers packed: ComfyUI's `qwen3vl_8b_nvfp4`, and repacks that name their nvfp4
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
index 15fd621bec..65bd547390 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
@@ -100,9 +100,14 @@ encoder closely; the remaining difference is the quantization of the encoder.
same shapes but conditions wrongly, so InvokeAI identifies the encoder from the file's
`qwen3vl` architecture tag and does not install a plain Qwen3 file as one.
- The `mmproj-*.gguf` file next to it holds the vision part and is not needed for text-to-image. It installs
- as its own **Qwen3-VL Vision Tower** model, but Krea-2 does not use it yet: without the vision part in the
- encoder, a GGUF encoder cannot encode the reference images of [edit LoRAs](#edit-loras-and-reference-images).
- [Qwen-Image-2.1](/users-guide/models/local-models/qwen-image-2-1/#reference-images) takes it for its own references.
+ as its own **Qwen3-VL Vision Tower** model. Select the 4B one (*Qwen3-VL 4B Vision Tower*, hidden size 2560)
+ as **Vision Tower** beside a GGUF encoder and it reads the reference images of
+ [edit LoRAs](#edit-loras-and-reference-images). The **Vision Tower** slot shows only while a GGUF 4B encoder is
+ selected, and a tower beside any other encoder is refused: those carry their own. Without a tower, a GGUF
+ encoder is refused when reference images are connected. A tower of the 8B encoder does not fit Krea-2. The tower runs on the encoder's device, so when the
+ encoder is set to CPU Only in the Model Manager, set the tower to CPU Only too.
+ [Qwen-Image-2.1](/users-guide/models/local-models/qwen-image-2-1/#reference-images) reads its references through
+ the 8B's.
- ComfyUI-GGUF's `Q8_CR` and `Q4_CR` encoder files are refused at install; only the transformer loads from them.
- LoRAs with text-encoder layers still apply to a quantized encoder.
@@ -111,7 +116,8 @@ Qwen3-VL encoder starter models, none of which belong to a bundle:
| Starter model | Format | Size | Used by |
| --- | --- | --- | --- |
| Qwen3-VL 4B Encoder (bf16 / fp8 / int8) | Comfy-Org single files | ~8.9 / ~5.2 / ~4.9 GB | Krea-2, FLUX.3 |
-| Qwen3-VL 4B Encoder (Q4_K_M / Q8_0 GGUF) | GGUF, language tower only | ~2.5 / ~4.3 GB | Krea-2, FLUX.3; text only |
+| Qwen3-VL 4B Encoder (Q4_K_M / Q8_0 GGUF) | GGUF, language tower only | ~2.5 / ~4.3 GB | Krea-2, FLUX.3; Krea-2 edit references need the 4B Vision Tower |
+| Qwen3-VL 4B Vision Tower | GGUF mmproj (F16) | ~0.8 GB | Krea-2 edit references beside a GGUF 4B encoder |
| Qwen3-VL 8B Encoder (NVFP4) | Comfy-Org single file | ~6.3 GB | Ideogram 4, Qwen-Image-2.1 |
| Qwen3-VL 8B Encoder (Q4_K_M / Q8_0 GGUF) | GGUF, language tower only | ~5.0 / ~8.7 GB | Ideogram 4, Qwen-Image-2.1; text only |
@@ -211,8 +217,9 @@ A reference image reaches the model twice, and both are needed:
keeps its size. A side shorter than 28 pixels is stretched to 28. The Qwen3-VL processor then works on 32-pixel cells and enlarges an image below its floor
of 65,536 pixels to that floor. This needs the encoder's vision weights. The encoder of the Krea-2
Diffusers models has them, and so do Qwen3-VL single files and folders that include the vision weights.
- [GGUF encoders](#qwen3-vl-gguf-encoders) do not. An encoder without them is refused when reference images
- are connected.
+ A [GGUF encoder](#qwen3-vl-gguf-encoders) has none and reads references through the selected Vision Tower
+ model instead. A GGUF encoder without a Vision Tower, or another encoder without vision weights, is refused when
+ reference images are connected.
- **The transformer sees it as clean image tokens.** The reference is encoded with the VAE and its tokens
are added after the image being generated. They are always presented as fully denoised. An image above
1 megapixel is scaled to about 1 megapixel, keeping its aspect ratio, and both sides are then rounded to
@@ -241,7 +248,8 @@ not be part of the canvas image. On the Canvas the Edit references apply to ever
image-to-image and inpainting.
With CFG above 1 the negative prompt reads the same references. Invoke stays disabled, and says why, while
-Edit references are combined with a Style reference or with a [GGUF Qwen3-VL encoder](#qwen3-vl-gguf-encoders).
+Edit references are combined with a Style reference or with a [GGUF Qwen3-VL encoder](#qwen3-vl-gguf-encoders)
+that has no Vision Tower selected, or with a tower and encoder whose CPU Only settings differ.
A Canvas Invoke with enabled regional guidance layers stops with a message instead, since Edit references
cannot be combined with regional prompts. **Reference K/V cache** under **Advanced** sets the
[K/V cache](#reference-kv-cache) below; it can be switched only while Edit references are active and a LoRA is
diff --git a/invokeai/app/invocations/krea2/krea2_model_loader.py b/invokeai/app/invocations/krea2/krea2_model_loader.py
index 48f70738d6..6bfb4ceb91 100644
--- a/invokeai/app/invocations/krea2/krea2_model_loader.py
+++ b/invokeai/app/invocations/krea2/krea2_model_loader.py
@@ -16,7 +16,10 @@ from invokeai.app.invocations.model import (
)
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.backend.architectures import accepted_vae_bases, accepts_vae
-from invokeai.backend.model_manager.qwen3_vl_labels import raise_for_wrong_qwen3_vl_variant
+from invokeai.backend.model_manager.qwen3_vl_labels import (
+ raise_for_unfit_vision_tower,
+ raise_for_wrong_qwen3_vl_variant,
+)
from invokeai.backend.model_manager.taxonomy import (
BaseModelType,
ModelFormat,
@@ -42,7 +45,7 @@ class Krea2ModelLoaderOutput(BaseInvocationOutput):
title="Main Model - Krea-2",
tags=["model", "krea2", "krea-2"],
category="model",
- version="1.0.0",
+ version="1.1.0",
classification=Classification.Prototype,
)
class Krea2ModelLoaderInvocation(BaseInvocation):
@@ -80,6 +83,16 @@ class Krea2ModelLoaderInvocation(BaseInvocation):
title="Qwen3-VL Encoder",
)
+ qwen3_vl_vision_tower_model: Optional[ModelIdentifierField] = InputField(
+ default=None,
+ description="Qwen3-VL 4B vision tower (the llama.cpp mmproj file). "
+ "Lets a GGUF encoder read edit reference images.",
+ input=Input.Direct,
+ ui_model_base=BaseModelType.Any,
+ ui_model_type=ModelType.Qwen3VLVisionTower,
+ title="Vision Tower",
+ )
+
def invoke(self, context: InvocationContext) -> Krea2ModelLoaderOutput:
main_config = context.models.get_config(self.model)
if main_config.base is not BaseModelType.Krea2 or main_config.type is not ModelType.Main:
@@ -122,12 +135,31 @@ class Krea2ModelLoaderInvocation(BaseInvocation):
tokenizer = self.model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
text_encoder = self.model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
+ vision_tower = self._vision_tower(context)
+
return Krea2ModelLoaderOutput(
transformer=TransformerField(transformer=transformer, loras=[]),
- qwen3_vl_encoder=Qwen3VLEncoderField(tokenizer=tokenizer, text_encoder=text_encoder, loras=[]),
+ qwen3_vl_encoder=Qwen3VLEncoderField(
+ tokenizer=tokenizer, text_encoder=text_encoder, vision_tower=vision_tower, loras=[]
+ ),
vae=VAEField(vae=vae),
)
+ def _vision_tower(self, context: InvocationContext) -> Optional[ModelIdentifierField]:
+ """The mmproj tower for a GGUF encoder, checked against it; None when none was selected."""
+ if self.qwen3_vl_vision_tower_model is None:
+ return None
+ encoder_config = (
+ context.models.get_config(self.qwen3_vl_encoder_model) if self.qwen3_vl_encoder_model is not None else None
+ )
+ raise_for_unfit_vision_tower(
+ context.models.get_config(self.qwen3_vl_vision_tower_model),
+ encoder_config,
+ Qwen3VLVariantType.Qwen3VL_4B,
+ "Krea-2",
+ )
+ return self.qwen3_vl_vision_tower_model
+
def _validate_diffusers_format(
self, context: InvocationContext, model: ModelIdentifierField, model_name: str
) -> None:
diff --git a/invokeai/app/invocations/model.py b/invokeai/app/invocations/model.py
index 8dd322a656..8d6b5bf3eb 100644
--- a/invokeai/app/invocations/model.py
+++ b/invokeai/app/invocations/model.py
@@ -162,7 +162,7 @@ class Qwen3VLEncoderField(BaseModel):
text_encoder: ModelIdentifierField = Field(description="Info to load text_encoder submodel")
vision_tower: ModelIdentifierField | None = Field(
default=None,
- description="Info to load the vision tower of a GGUF encoder, which has none of its own (Qwen-Image-2.1 only)",
+ description="Info to load the vision tower of a GGUF encoder, which has none of its own",
)
loras: List[LoRAField] = Field(default_factory=list, description="LoRAs to apply on model loading")
diff --git a/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py b/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py
index 71992fc402..09cdac5e08 100644
--- a/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py
+++ b/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py
@@ -11,7 +11,7 @@ from invokeai.app.invocations.fields import FieldDescriptions, Input, InputField
from invokeai.app.invocations.model import ModelIdentifierField, Qwen3VLEncoderField, TransformerField, VAEField
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.backend.architectures import accepted_vae_bases, accepts_vae
-from invokeai.backend.model_manager.qwen3_vl_labels import variant_label
+from invokeai.backend.model_manager.qwen3_vl_labels import raise_for_unfit_vision_tower, variant_label
from invokeai.backend.model_manager.taxonomy import (
BaseModelType,
ModelFormat,
@@ -129,30 +129,18 @@ class QwenImage21ModelLoaderInvocation(BaseInvocation):
)
def _vision_tower(self, context: InvocationContext) -> Optional[ModelIdentifierField]:
- """The mmproj tower for a GGUF encoder, checked against it; None when none was selected.
-
- Refused beside any other encoder rather than ignored: those bring a tower of their own, and a stale
- selection would silently decide nothing while looking as if it did.
- """
+ """The mmproj tower for a GGUF encoder, checked against it; None when none was selected."""
if self.qwen3_vl_vision_tower_model is None:
return None
- tower_config = context.models.get_config(self.qwen3_vl_vision_tower_model)
- tower_variant = getattr(tower_config, "variant", None)
- if tower_config.type is not ModelType.Qwen3VLVisionTower:
- raise ValueError(f"'{tower_config.name}' is not a Qwen3-VL vision tower (the llama.cpp mmproj file).")
- if tower_variant is not Qwen3VLVariantType.Qwen3VL_8B:
- raise ValueError(
- f"'{tower_config.name}' is the Qwen3-VL {variant_label(tower_variant)} vision tower. "
- "Qwen-Image-2.1 reads references with the 8B one (hidden size 4096)."
- )
encoder_config = (
context.models.get_config(self.qwen3_vl_encoder_model) if self.qwen3_vl_encoder_model is not None else None
)
- if encoder_config is None or encoder_config.format is not ModelFormat.GGUFQuantized:
- raise ValueError(
- f"The vision tower '{tower_config.name}' pairs only with a GGUF Qwen3-VL encoder, which has none. "
- "Any other encoder brings its own: clear the vision tower."
- )
+ raise_for_unfit_vision_tower(
+ context.models.get_config(self.qwen3_vl_vision_tower_model),
+ encoder_config,
+ Qwen3VLVariantType.Qwen3VL_8B,
+ "Qwen-Image-2.1",
+ )
return self.qwen3_vl_vision_tower_model
@staticmethod
diff --git a/invokeai/app/invocations/text_encoder/krea2_text_encoder.py b/invokeai/app/invocations/text_encoder/krea2_text_encoder.py
index fd257a750e..ef2c694806 100644
--- a/invokeai/app/invocations/text_encoder/krea2_text_encoder.py
+++ b/invokeai/app/invocations/text_encoder/krea2_text_encoder.py
@@ -25,7 +25,7 @@ from invokeai.backend.krea2.text_encoding import (
working_memory_bytes,
)
from invokeai.backend.model_manager.load.model_cache.utils import get_effective_device
-from invokeai.backend.model_manager.taxonomy import SubModelType
+from invokeai.backend.model_manager.taxonomy import ModelFormat, SubModelType
from invokeai.backend.patches.layer_patcher import LayerPatcher, PatchSpec
from invokeai.backend.patches.lora_conversions.krea2_lora_constants import KREA2_LORA_QWEN3VL_PREFIX
from invokeai.backend.patches.model_patch_raw import ModelPatchRaw
@@ -48,13 +48,19 @@ from invokeai.backend.util.devices import TorchDevice
# ai-toolkit trains edit LoRAs with the encoder frozen.
_VISUAL_TOWER_LORA_LAYERS = re.compile(rf"^{re.escape(KREA2_LORA_QWEN3VL_PREFIX)}visual\.")
+_NO_VISION_TOWER = (
+ "Reference images are read by the Qwen3-VL vision tower, and the GGUF encoder '{name}' has none. Select the "
+ "Vision Tower model (the 4B llama.cpp mmproj file) beside it, or use a Diffusers Krea-2 model's own encoder or "
+ "a standalone non-GGUF Qwen3-VL 4B encoder."
+)
+
@invocation(
"krea2_text_encoder",
title="Prompt - Krea-2",
tags=["prompt", "conditioning", "krea2", "krea-2"],
category="conditioning",
- version="1.2.0",
+ version="1.3.0",
classification=Classification.Prototype,
idle_gpu_offloadable=True,
)
@@ -83,7 +89,7 @@ class Krea2TextEncoderInvocation(BaseInvocation):
default=[],
max_length=KREA2_MAX_REFERENCE_IMAGES,
description="Up to three reference images for an edit LoRA, read by the Qwen3-VL vision tower in this order "
- "(Picture 1, 2, 3). Needs a safetensors or Diffusers encoder: a GGUF encoder has no vision tower.",
+ "(Picture 1, 2, 3). A GGUF encoder reads them through the selected Vision Tower model (the mmproj file).",
)
@torch.no_grad()
@@ -106,9 +112,22 @@ class Krea2TextEncoderInvocation(BaseInvocation):
def _encode(self, context: InvocationContext) -> tuple[torch.Tensor, torch.Tensor | None]:
images = [prepare_vlm_reference(context.images.get_pil(field.image_name)) for field in self.reference_images]
+ encoder_config = context.models.get_config(self.qwen3_vl_encoder.text_encoder)
+ text_encoder_format = encoder_config.format
+ # Chosen on the config, before anything heavy loads. A GGUF encoder has no tower of its own: it reads the
+ # model the field names, the mmproj file (not a submodel of anything). Any other encoder carries its own.
+ vision_identifier = None
+ if images:
+ field = self.qwen3_vl_encoder
+ if text_encoder_format is not ModelFormat.GGUFQuantized:
+ vision_identifier = field.text_encoder.model_copy(update={"submodel_type": SubModelType.VisionEncoder})
+ elif field.vision_tower is not None:
+ vision_identifier = field.vision_tower.model_copy(update={"submodel_type": None})
+ else:
+ raise ValueError(_NO_VISION_TOWER.format(name=encoder_config.name))
tokenizer_info = context.models.load(self.qwen3_vl_encoder.tokenizer)
image_inputs = vision_info = None
- if images:
+ if vision_identifier is not None:
# The processor and tokenizer are small and run on the CPU, so a reference the processor refuses (an
# extreme aspect ratio) fails here, before either tower is read.
processor_info = context.models.load(
@@ -116,14 +135,17 @@ class Krea2TextEncoderInvocation(BaseInvocation):
)
with processor_info as processor, tokenizer_info as tokenizer:
image_inputs = tokenize_krea2_prompt_with_images(self.prompt, images, processor, tokenizer)
- # Before the encoder: the loader refuses an encoder without a tower (GGUF) here, ahead of reading
+ # Before the encoder: the loader refuses an encoder without a tower here, ahead of reading
# the far larger language tower for nothing. The tower is its own cache entry, so text-only prompts
# never pay for it.
- vision_info = context.models.load(
- self.qwen3_vl_encoder.text_encoder.model_copy(update={"submodel_type": SubModelType.VisionEncoder})
- )
+ vision_info = context.models.load(vision_identifier)
text_encoder_info = context.models.load(self.qwen3_vl_encoder.text_encoder)
- text_encoder_format = context.models.get_config(self.qwen3_vl_encoder.text_encoder).format
+ if vision_info is not None and vision_info.compute_device != text_encoder_info.compute_device:
+ raise RuntimeError(
+ f"The vision tower runs on {vision_info.compute_device} and the encoder on "
+ f"{text_encoder_info.compute_device}; an edit attaches one to the other, so they need one device. "
+ "Give both models the same CPU Only setting in the Model Manager."
+ )
# An nvfp4 or GGUF build dequantizes each packed Linear per forward, a transient its resident size does
# not cover. Read from the unlocked model, before the lock the reservation applies to; zero for
# other builds.
diff --git a/invokeai/backend/model_manager/load/model_loaders/krea2.py b/invokeai/backend/model_manager/load/model_loaders/krea2.py
index ea93cbf662..19961cd8c1 100644
--- a/invokeai/backend/model_manager/load/model_loaders/krea2.py
+++ b/invokeai/backend/model_manager/load/model_loaders/krea2.py
@@ -30,6 +30,7 @@ from invokeai.backend.model_manager.load.load_default import (
from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry
from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoader
from invokeai.backend.model_manager.load.quantized_embedding import materialize_quantized_embedding
+from invokeai.backend.model_manager.qwen3_vl_labels import variant_label
from invokeai.backend.model_manager.taxonomy import (
AnyModel,
BaseModelType,
@@ -973,9 +974,9 @@ def _reject_incomplete_load(model: Any, *, what: str) -> None:
QWEN3VL_GGUF_HAS_NO_VISION_TOWER = (
- "The GGUF Qwen3-VL encoder '{name}' has no vision tower (llama.cpp keeps it in a separate mmproj file, which "
- "only Qwen-Image-2.1 edits take), so it cannot read reference images. Use a Qwen3-VL encoder file that includes the vision "
- "tower, or a Diffusers model's own encoder."
+ "The GGUF Qwen3-VL encoder '{name}' has no vision tower (llama.cpp keeps it in a separate mmproj file), so it "
+ "cannot read reference images. Select a Vision Tower model (the {variant} mmproj file) beside it, use a Qwen3-VL "
+ "encoder file that includes the vision tower, or a Diffusers model's own encoder."
)
@@ -1351,7 +1352,9 @@ class Qwen3VLEncoderGGUFLoader(_Qwen3VLEncoderSingleFileLoader[Qwen3VLEncoder_GG
return 0
def _load_vision_encoder(self, config: Qwen3VLEncoder_GGUF_Config) -> AnyModel:
- raise ValueError(QWEN3VL_GGUF_HAS_NO_VISION_TOWER.format(name=config.name))
+ raise ValueError(
+ QWEN3VL_GGUF_HAS_NO_VISION_TOWER.format(name=config.name, variant=variant_label(config.variant))
+ )
def _load_text_encoder(self, config: Qwen3VLEncoder_GGUF_Config) -> AnyModel:
from transformers import Qwen3VLModel
diff --git a/invokeai/backend/model_manager/qwen3_vl_labels.py b/invokeai/backend/model_manager/qwen3_vl_labels.py
index fe47f9dc37..850a865558 100644
--- a/invokeai/backend/model_manager/qwen3_vl_labels.py
+++ b/invokeai/backend/model_manager/qwen3_vl_labels.py
@@ -6,7 +6,9 @@ from the picker -- and a third config class (MiniMax H3's truncated Qwen3-VL-32B
type while carrying no variant at all, so `None` has to render as something better than "None".
"""
-from invokeai.backend.model_manager.taxonomy import Qwen3VLVariantType
+from typing import Any
+
+from invokeai.backend.model_manager.taxonomy import ModelFormat, ModelType, Qwen3VLVariantType
_LABELS = {
Qwen3VLVariantType.Qwen3VL_4B: "4B",
@@ -40,3 +42,27 @@ def raise_for_wrong_qwen3_vl_variant(
f"'{encoder_name}' is the Qwen3-VL {variant_label(variant)} encoder. {architecture} conditions on the "
f"{_LABELS[expected]} one (hidden size {_HIDDEN_SIZES[expected]})."
)
+
+
+def raise_for_unfit_vision_tower(
+ tower_config: Any, encoder_config: Any | None, expected: Qwen3VLVariantType, architecture: str
+) -> None:
+ """Refuse a selected mmproj vision tower that cannot serve the architecture's GGUF encoder.
+
+ Refused beside any other encoder rather than ignored: those bring a tower of their own, and a stale
+ selection would silently decide nothing while looking as if it did. `encoder_config` is None when no
+ standalone encoder was selected.
+ """
+ if tower_config.type is not ModelType.Qwen3VLVisionTower:
+ raise ValueError(f"'{tower_config.name}' is not a Qwen3-VL vision tower (the llama.cpp mmproj file).")
+ tower_variant = getattr(tower_config, "variant", None)
+ if tower_variant is not expected:
+ raise ValueError(
+ f"'{tower_config.name}' is the Qwen3-VL {variant_label(tower_variant)} vision tower. "
+ f"{architecture} reads references with the {_LABELS[expected]} one (hidden size {_HIDDEN_SIZES[expected]})."
+ )
+ if encoder_config is None or encoder_config.format is not ModelFormat.GGUFQuantized:
+ raise ValueError(
+ f"The vision tower '{tower_config.name}' pairs only with a GGUF Qwen3-VL encoder, which has none. "
+ "Any other encoder brings its own: clear the vision tower."
+ )
diff --git a/invokeai/backend/model_manager/starter_models/__init__.py b/invokeai/backend/model_manager/starter_models/__init__.py
index 222e5ebf63..b472bbe3c1 100644
--- a/invokeai/backend/model_manager/starter_models/__init__.py
+++ b/invokeai/backend/model_manager/starter_models/__init__.py
@@ -61,6 +61,7 @@ from invokeai.backend.model_manager.starter_models.common import (
qwen3_vl_encoder_8b_gguf_q4_k_m,
qwen3_vl_encoder_8b_gguf_q8_0,
qwen3_vl_encoder_8b_nvfp4,
+ qwen3_vl_vision_tower_4b,
qwen3_vl_vision_tower_8b,
qwen_vl_encoder_diffusers,
qwen_vl_encoder_fp8,
@@ -625,6 +626,7 @@ STARTER_MODELS: list[StarterModel] = [
qwen3_vl_encoder_8b_nvfp4,
qwen3_vl_encoder_8b_gguf_q4_k_m,
qwen3_vl_encoder_8b_gguf_q8_0,
+ qwen3_vl_vision_tower_4b,
qwen3_vl_vision_tower_8b,
moss_image_base,
moss_image_sft,
diff --git a/invokeai/backend/model_manager/starter_models/common.py b/invokeai/backend/model_manager/starter_models/common.py
index 108630f007..d946d1d6fb 100644
--- a/invokeai/backend/model_manager/starter_models/common.py
+++ b/invokeai/backend/model_manager/starter_models/common.py
@@ -430,8 +430,9 @@ qwen3_vl_encoder_8b = StarterModel(
# More Qwen3-VL encoder builds, pinned to commits. The 4B is what Krea-2 and FLUX.3 condition on, the 8B what Ideogram 4
# and Qwen-Image-2.1 condition on; the two are not interchangeable. The GGUF files hold the language tower only (the
-# vision tower lives in a separate mmproj file), so they encode text but cannot read Krea-2 edit reference images.
-# Qwen-Image-2.1 edits read them through the 8B's mmproj, installed as `qwen3_vl_vision_tower_8b`.
+# vision tower lives in a separate mmproj file), so they encode text but read edit reference images only through
+# that file: Krea-2 through the 4B's mmproj (`qwen3_vl_vision_tower_4b`), Qwen-Image-2.1 through the 8B's
+# (`qwen3_vl_vision_tower_8b`).
_QWEN3_VL_KREA2 = (
"https://huggingface.co/Comfy-Org/Krea-2/resolve/588feaf955b08b9ac4723eeb751752ab045dba71/text_encoders"
)
@@ -450,8 +451,8 @@ _QWEN3_VL_8B_USE = (
"interchangeable."
)
_QWEN3_VL_GGUF_NOTE = (
- "The GGUF holds the language tower only, so it encodes text and cannot read Krea-2 edit reference images; use a "
- "safetensors encoder for those."
+ "The GGUF holds the language tower only, so it encodes text; edit reference images need the matching Vision Tower "
+ "model beside it (4B: Krea-2, 8B: Qwen-Image-2.1)."
)
qwen3_vl_encoder_4b_bf16 = StarterModel(
@@ -546,6 +547,16 @@ qwen3_vl_vision_tower_8b = StarterModel(
format=ModelFormat.GGUFQuantized,
)
+qwen3_vl_vision_tower_4b = StarterModel(
+ name="Qwen3-VL 4B Vision Tower",
+ base=BaseModelType.Any,
+ source=f"{_QWEN3_VL_4B_GGUF}/mmproj-Qwen3VL-4B-Instruct-F16.gguf",
+ description="The vision tower (llama.cpp mmproj, F16) of Qwen3-VL 4B. Select it as the Vision Tower beside a GGUF "
+ "Qwen3-VL 4B encoder so Krea-2 can read edit reference images. Not needed with other encoders. ~0.8GB",
+ type=ModelType.Qwen3VLVisionTower,
+ format=ModelFormat.GGUFQuantized,
+)
+
# region Wan 2.2 (local)
# Shared components — all Wan 2.2 variants use the UMT5-XXL text encoder. A14B
# (both T2V and I2V) uses a 16-channel VAE; TI2V-5B uses a 48-channel VAE. The
diff --git a/invokeai/frontend/api/openapi.json b/invokeai/frontend/api/openapi.json
index 1e78200cf0..f366c16196 100644
--- a/invokeai/frontend/api/openapi.json
+++ b/invokeai/frontend/api/openapi.json
@@ -68323,6 +68323,25 @@
"title": "Qwen3-VL Encoder",
"ui_model_type": ["qwen3_vl_encoder"]
},
+ "qwen3_vl_vision_tower_model": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ModelIdentifierField"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Qwen3-VL 4B vision tower (the llama.cpp mmproj file). Lets a GGUF encoder read edit reference images.",
+ "field_kind": "input",
+ "input": "direct",
+ "orig_default": null,
+ "orig_required": false,
+ "title": "Vision Tower",
+ "ui_model_base": ["any"],
+ "ui_model_type": ["qwen3_vl_vision_tower"]
+ },
"type": {
"const": "krea2_model_loader",
"default": "krea2_model_loader",
@@ -68335,7 +68354,7 @@
"tags": ["model", "krea2", "krea-2"],
"title": "Main Model - Krea-2",
"type": "object",
- "version": "1.0.0",
+ "version": "1.1.0",
"output": {
"$ref": "#/components/schemas/Krea2ModelLoaderOutput"
}
@@ -68934,7 +68953,7 @@
},
"reference_images": {
"default": [],
- "description": "Up to three reference images for an edit LoRA, read by the Qwen3-VL vision tower in this order (Picture 1, 2, 3). Needs a safetensors or Diffusers encoder: a GGUF encoder has no vision tower.",
+ "description": "Up to three reference images for an edit LoRA, read by the Qwen3-VL vision tower in this order (Picture 1, 2, 3). A GGUF encoder reads them through the selected Vision Tower model (the mmproj file).",
"field_kind": "input",
"input": "any",
"items": {
@@ -68958,7 +68977,7 @@
"tags": ["prompt", "conditioning", "krea2", "krea-2"],
"title": "Prompt - Krea-2",
"type": "object",
- "version": "1.2.0",
+ "version": "1.3.0",
"output": {
"$ref": "#/components/schemas/Krea2ConditioningOutput"
}
@@ -103791,7 +103810,7 @@
}
],
"default": null,
- "description": "Info to load the vision tower of a GGUF encoder, which has none of its own (Qwen-Image-2.1 only)"
+ "description": "Info to load the vision tower of a GGUF encoder, which has none of its own"
},
"loras": {
"description": "LoRAs to apply on model loading",
diff --git a/invokeai/frontend/api/schema.ts b/invokeai/frontend/api/schema.ts
index 151cd326f5..52e8097495 100644
--- a/invokeai/frontend/api/schema.ts
+++ b/invokeai/frontend/api/schema.ts
@@ -26780,6 +26780,12 @@ export type components = {
* @default null
*/
qwen3_vl_encoder_model?: components["schemas"]["ModelIdentifierField"] | null;
+ /**
+ * Vision Tower
+ * @description Qwen3-VL 4B vision tower (the llama.cpp mmproj file). Lets a GGUF encoder read edit reference images.
+ * @default null
+ */
+ qwen3_vl_vision_tower_model?: components["schemas"]["ModelIdentifierField"] | null;
/**
* type
* @default krea2_model_loader
@@ -27179,7 +27185,7 @@ export type components = {
qwen3_vl_encoder?: components["schemas"]["Qwen3VLEncoderField"] | null;
/**
* Reference Images
- * @description Up to three reference images for an edit LoRA, read by the Qwen3-VL vision tower in this order (Picture 1, 2, 3). Needs a safetensors or Diffusers encoder: a GGUF encoder has no vision tower.
+ * @description Up to three reference images for an edit LoRA, read by the Qwen3-VL vision tower in this order (Picture 1, 2, 3). A GGUF encoder reads them through the selected Vision Tower model (the mmproj file).
* @default []
*/
reference_images?: components["schemas"]["ImageField"][];
@@ -44713,7 +44719,7 @@ export type components = {
/** @description Info to load text_encoder submodel */
text_encoder: components["schemas"]["ModelIdentifierField"];
/**
- * @description Info to load the vision tower of a GGUF encoder, which has none of its own (Qwen-Image-2.1 only)
+ * @description Info to load the vision tower of a GGUF encoder, which has none of its own
* @default null
*/
vision_tower?: components["schemas"]["ModelIdentifierField"] | null;
diff --git a/invokeai/frontend/webv2/src/app/graphExport.test.ts b/invokeai/frontend/webv2/src/app/graphExport.test.ts
index d412ca5a8a..f4d80c9c73 100644
--- a/invokeai/frontend/webv2/src/app/graphExport.test.ts
+++ b/invokeai/frontend/webv2/src/app/graphExport.test.ts
@@ -248,6 +248,37 @@ describe('graph export', () => {
}
});
+ it('opens the Krea-2 Vision Tower slot from a GGUF 4B encoder pick, and has no slot beside any other encoder', () => {
+ const krea2Models = [
+ ...MODELS,
+ model('k2-gguf', 'krea-2', 'main', { format: 'gguf_quantized', variant: 'krea2_base' }),
+ model('k2-encoder-gguf', 'any', 'qwen3_vl_encoder', { format: 'gguf_quantized', variant: 'qwen3_vl_4b' }),
+ model('k2-encoder-st', 'any', 'qwen3_vl_encoder', { format: 'checkpoint', variant: 'qwen3_vl_4b' }),
+ model('k2-mmproj', 'any', 'qwen3_vl_vision_tower', { format: 'gguf_quantized', variant: 'qwen3_vl_4b' }),
+ model('k2-vae', 'qwen-image', 'vae', { format: 'checkpoint' }),
+ ];
+ const exportWith = (encoder: string) =>
+ exportOne(
+ sdxlCase('k2', {
+ components: { qwen3VLEncoderModel: encoder, qwen3VLVisionTowerModel: 'k2-mmproj', vae: 'k2-vae' },
+ model_key: 'k2-gguf',
+ }),
+ krea2Models
+ );
+
+ const gguf = exportWith('k2-encoder-gguf');
+
+ expect(gguf.components).toEqual({
+ qwen3VLEncoderModel: 'k2-encoder-gguf',
+ qwen3VLVisionTowerModel: 'k2-mmproj',
+ vae: 'k2-vae',
+ });
+ expect(gguf.batch.graph.nodes.model_loader).toMatchObject({ qwen3_vl_vision_tower_model: { key: 'k2-mmproj' } });
+
+ // A safetensors encoder has no tower slot, so a tower pick is rejected rather than sent.
+ expect(() => exportWith('k2-encoder-st')).toThrow(/Unknown component slot .{1,4}qwen3VLVisionTowerModel/);
+ });
+
// The working-memory calibration planner (`default_vae`) restates this: it sizes each case for the VAE that decodes.
it("decodes with the main model's default VAE, which a pick replaces where the model has a VAE slot", () => {
const withDefaultVae = (key: string, vaeKey: string) => [
diff --git a/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json b/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
index 042f7722a7..0b0434a61d 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
+++ b/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
@@ -300,6 +300,10 @@
"qwen3VLEncoderModel",
"vae"
],
+ "standalone-gguf-encoder": [
+ "qwen3VLEncoderModel",
+ "vae"
+ ],
"diffusers-with-edit-references": []
},
"nodeTypes": [
@@ -1904,6 +1908,7 @@
],
"model": [],
"qwen3_vl_encoder_model": [],
+ "qwen3_vl_vision_tower_model": [],
"use_cache": [
true
],
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
index d26b9ef822..e95102a41c 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
@@ -1864,7 +1864,22 @@ describe('component policies', () => {
type: 'qwen3_vl_encoder',
variant: 'qwen3_vl_4b',
};
- const ggufReason = `Krea-2 edit references need a Qwen3-VL encoder with vision weights, which the GGUF encoder "${ggufEncoder.name}" does not have. Select a safetensors file or Diffusers folder that includes the vision weights.`;
+ const towerReason =
+ "Edit references need this GGUF encoder's Vision Tower (the mmproj file). Select it under Components.";
+ const cpuReason =
+ 'The Vision Tower and the encoder must have the same CPU Only setting. Change it in the Model Manager.';
+ const ggufTower = (
+ variant: 'qwen3_vl_4b' | 'qwen3_vl_8b' = 'qwen3_vl_4b',
+ cpuOnly?: boolean
+ ): ComponentModelConfig => ({
+ base: 'any',
+ cpu_only: cpuOnly,
+ format: 'gguf_quantized',
+ key: `mmproj-${variant}`,
+ name: 'mmproj',
+ type: 'qwen3_vl_vision_tower',
+ variant,
+ });
it('types a new Krea-2 reference as style only when it is the one running reference', () => {
const typesAfterAdding = (count: number, referenceImages: GenerateSettings['referenceImages'] = []) =>
@@ -1993,18 +2008,41 @@ describe('component policies', () => {
);
});
- it('blocks edit references on a GGUF encoder, which has no vision tower, and only then', () => {
+ it('blocks edit references on a GGUF encoder without its 4B Vision Tower, and only then', () => {
const checkpoint = createModel('krea-2', { format: 'checkpoint', key: 'krea2-checkpoint' });
const vae: VaeModelConfig = { base: 'qwen-image', key: 'krea2-vae', name: 'Qwen VAE', type: 'vae' };
const safetensorsEncoder: ComponentModelConfig = { ...ggufEncoder, format: 'checkpoint', key: 'qwen3-vl-st' };
+ const issuesFor = (model: MainModelConfig, overrides: Partial<GenerateSettings>) =>
+ getGenerationValidationIssues(model, createSettings(model, overrides)).filter(
+ (issue) => issue.message === towerReason
+ );
expect(reasonsFor(checkpoint, { qwen3VLEncoderModel: ggufEncoder, referenceImages: [edit('a')], vae })).toEqual([
- ggufReason,
+ towerReason,
]);
// A Diffusers main reads with the GGUF override too, when one is selected.
expect(reasonsFor(krea2, { qwen3VLEncoderModel: ggufEncoder, referenceImages: [edit('a')] })).toEqual([
- ggufReason,
+ towerReason,
+ ]);
+ // The issue points at the Vision Tower setting, where the fix is.
+ expect(issuesFor(krea2, { qwen3VLEncoderModel: ggufEncoder, referenceImages: [edit('a')] })).toEqual([
+ expect.objectContaining({ target: { field: 'qwen3VLVisionTowerModel', section: 'components' } }),
]);
+ // An 8B tower does not fit the 4B encoder.
+ expect(
+ reasonsFor(krea2, {
+ qwen3VLEncoderModel: ggufEncoder,
+ qwen3VLVisionTowerModel: ggufTower('qwen3_vl_8b'),
+ referenceImages: [edit('a')],
+ })
+ ).toEqual([towerReason]);
+ expect(
+ reasonsFor(krea2, {
+ qwen3VLEncoderModel: ggufEncoder,
+ qwen3VLVisionTowerModel: ggufTower(),
+ referenceImages: [edit('a')],
+ })
+ ).toEqual([]);
expect(reasonsFor(krea2, { referenceImages: [edit('a')] })).toEqual([]);
expect(
reasonsFor(checkpoint, { qwen3VLEncoderModel: safetensorsEncoder, referenceImages: [edit('a')], vae })
@@ -2019,6 +2057,43 @@ describe('component policies', () => {
).toEqual([]);
});
+ it('blocks edit references when the GGUF encoder and its Vision Tower differ in CPU Only', () => {
+ const withCpu = (encoderCpu: boolean | undefined, towerCpu: boolean | undefined, refs = [edit('a')]) =>
+ reasonsFor(krea2, {
+ qwen3VLEncoderModel: { ...ggufEncoder, cpu_only: encoderCpu },
+ qwen3VLVisionTowerModel: ggufTower('qwen3_vl_4b', towerCpu),
+ referenceImages: refs,
+ });
+
+ expect(withCpu(true, undefined)).toEqual([cpuReason]);
+ expect(withCpu(undefined, true)).toEqual([cpuReason]);
+ expect(withCpu(false, undefined)).toEqual([]);
+ expect(withCpu(true, true)).toEqual([]);
+ expect(withCpu(true, undefined, [style('s')] as never)).toEqual([]);
+ });
+
+ it('offers the Krea-2 Vision Tower slot below a GGUF 4B encoder only, and drops a stale 8B pick', () => {
+ const checkpoint = createModel('krea-2', { format: 'checkpoint', key: 'krea2-checkpoint' });
+ const slotKeys = (encoder: ComponentModelConfig | null) =>
+ getComponentSectionPolicy(checkpoint, createSettings(checkpoint, { qwen3VLEncoderModel: encoder })).slots.map(
+ (slot) => slot.key
+ );
+
+ expect(slotKeys(ggufEncoder)).toEqual(['vae', 'qwen3VLEncoderModel', 'qwen3VLVisionTowerModel']);
+ expect(slotKeys({ ...ggufEncoder, format: 'checkpoint' })).toEqual(['vae', 'qwen3VLEncoderModel']);
+ expect(slotKeys(null)).toEqual(['vae', 'qwen3VLEncoderModel']);
+
+ const select = (qwen3VLVisionTowerModel: ComponentModelConfig) =>
+ getGenerateModelSelectionResult({
+ currentValues: createSettings(checkpoint, { qwen3VLEncoderModel: ggufEncoder, qwen3VLVisionTowerModel }),
+ model: checkpoint,
+ models: [],
+ }).settings;
+
+ expect(select(ggufTower()).qwen3VLVisionTowerModel).toEqual(ggufTower());
+ expect(select(ggufTower('qwen3_vl_8b')).qwen3VLVisionTowerModel).toBeNull();
+ });
+
it('re-targets references into Krea-2 as one set and switches off the ones that cannot run together', () => {
const flux2 = createModel('flux2', { format: 'diffusers' });
const flux2Reference = (id: string, isEnabled = true) => ({
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
index b268d16684..66f886dd5c 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
@@ -47,7 +47,9 @@ import {
isErnieImageMistralEncoder,
isFlux2MistralEncoder,
isFlux2Qwen3EncoderForModel,
+ isGgufQwen3Vl4bEncoder,
isGgufQwen3Vl8bEncoder,
+ isQwen3Vl4bVisionTower,
isQwen3Vl8bEncoder,
isQwen3Vl8bVisionTower,
isIdeogram4UnconditionalBranch,
@@ -858,8 +860,8 @@ const qwen3VlEncoderSlot = (helpText: string, filter: GenerateComponentFilter):
filter,
});
-/** Optional; only a GGUF 8B encoder needs it, so the slot appears with such an encoder alone. */
-const qwen3VlVisionTowerSlot = (helpText: string): ComponentSlotPolicy =>
+/** Optional; only a GGUF encoder needs it, so the slot appears with such an encoder alone. */
+const qwen3VlVisionTowerSlot = (helpText: string, filter: GenerateComponentFilter): ComponentSlotPolicy =>
slot({
key: 'qwen3VLVisionTowerModel',
label: 'Vision Tower',
@@ -867,7 +869,7 @@ const qwen3VlVisionTowerSlot = (helpText: string): ComponentSlotPolicy =>
valueKind: 'component',
helpText,
placeholder: 'None',
- filter: isQwen3Vl8bVisionTower,
+ filter,
});
const qwen35EncoderSlot = (helpText: string, filter: GenerateComponentFilter): ComponentSlotPolicy =>
@@ -1300,6 +1302,17 @@ const getBaseComponentSectionPolicy = (
required: (ctx) => ctx.model.format !== 'diffusers',
missingMessage: 'Generate needs a Qwen3-VL Encoder for non-Diffusers Krea-2 models.',
},
+ // Same rule as Qwen-Image-2.1: the loader refuses a tower beside any other encoder. Style references skip it.
+ ...(settings.qwen3VLEncoderModel && isGgufQwen3Vl4bEncoder(settings.qwen3VLEncoderModel)
+ ? [
+ qwen3VlVisionTowerSlot(
+ 'The mmproj file of the GGUF encoder (mmproj-Qwen3VL-4B-Instruct-F16.gguf, the "Qwen3-VL 4B Vision ' +
+ 'Tower" starter model). It lets the GGUF encoder read edit reference images; text-to-image and ' +
+ 'style references work without it. Install it from the Model Manager.',
+ isQwen3Vl4bVisionTower
+ ),
+ ]
+ : []),
]);
case 'qwen-image-2-1':
// A Diffusers pipeline brings its own VAE and encoder; single-file and GGUF transformers need both.
@@ -1328,7 +1341,8 @@ const getBaseComponentSectionPolicy = (
qwen3VlVisionTowerSlot(
'The mmproj file of the GGUF encoder (for example mmproj-Qwen3VL-8B-Instruct-F16.gguf from ' +
'Qwen/Qwen3-VL-8B-Instruct-GGUF). It lets the GGUF encoder read reference images; ' +
- 'text-to-image works without it. Install it from the Model Manager.'
+ 'text-to-image works without it. Install it from the Model Manager.',
+ isQwen3Vl8bVisionTower
),
]
: []),
@@ -2542,9 +2556,14 @@ export const QWEN_IMAGE_21_NO_VISION_TOWER_REASON =
export const QWEN_IMAGE_21_GGUF_VISION_TOWER_REASON =
"Reference images need this encoder's Vision Tower (the mmproj file). Select it under Components.";
-const QWEN_IMAGE_21_VISION_TOWER_CPU_ONLY_REASON =
+const VISION_TOWER_CPU_ONLY_REASON =
'The Vision Tower and the encoder must have the same CPU Only setting. Change it in the Model Manager.';
+const KREA2_VISION_TOWER_TARGET = { field: 'qwen3VLVisionTowerModel', section: 'components' } as const;
+
+const KREA2_GGUF_VISION_TOWER_REASON =
+ "Edit references need this GGUF encoder's Vision Tower (the mmproj file). Select it under Components.";
+
const getReferenceImageValidationIssues = (
model: GenerateModelConfig,
settings: GenerateSettings
@@ -2732,7 +2751,7 @@ const getReferenceImageValidationIssues = (
(encoder.cpu_only === true) !== (tower.cpu_only === true)
) {
issues.push(
- createUntranslatedGenerationIssue(QWEN_IMAGE_21_VISION_TOWER_CPU_ONLY_REASON, {
+ createUntranslatedGenerationIssue(VISION_TOWER_CPU_ONLY_REASON, {
field: 'qwen3VLVisionTowerModel',
section: 'components',
})
@@ -2762,33 +2781,42 @@ export const getGuidanceBoundReason = (
/**
* Combinations the backend refuses only after queueing. The encoder reads edit references with its vision tower, which
- * a GGUF Qwen3-VL encoder does not carry; a Diffusers main without an encoder override uses its bundled one. A
- * standalone encoder folder may lack the vision weights too, but its config does not say so, so the message names
- * what the encoder needs rather than a format that always has it.
+ * a GGUF Qwen3-VL encoder replaces with its mmproj Vision Tower; a Diffusers main without an encoder override uses its
+ * bundled one.
*/
-const getKrea2ReferenceValidationReasons = (settings: GenerateSettings): string[] => {
+const getKrea2ReferenceValidationReasons = (
+ settings: GenerateSettings
+): Array<{ reason: string; target: GenerationIssue['target'] }> => {
const styleCount = settings.referenceImages.filter(
(referenceImage) => isReferenceImageActive(referenceImage) && referenceImage.config.type === 'krea2_reference_image'
).length;
const hasEditReferences = hasEnabledKrea2EditReferences(settings.referenceImages);
- const reasons: string[] = [];
+ const reasons: Array<{ reason: string; target: GenerationIssue['target'] }> = [];
if (styleCount > 1) {
- reasons.push('Krea-2 uses one style reference at a time. Turn off all but one, or switch all of them to Edit.');
+ reasons.push({
+ reason: 'Krea-2 uses one style reference at a time. Turn off all but one, or switch all of them to Edit.',
+ target: REFERENCE_IMAGES_TARGET,
+ });
}
if (styleCount > 0 && hasEditReferences) {
- reasons.push(
- 'Krea-2 cannot combine a style reference with edit references. Switch the style reference to Edit, or turn off one kind.'
- );
+ reasons.push({
+ reason:
+ 'Krea-2 cannot combine a style reference with edit references. Switch the style reference to Edit, or turn off one kind.',
+ target: REFERENCE_IMAGES_TARGET,
+ });
}
const encoder = settings.qwen3VLEncoderModel;
+ const tower = settings.qwen3VLVisionTowerModel;
- if (hasEditReferences && encoder && isQwen3Vl4bEncoder(encoder) && encoder.format === 'gguf_quantized') {
- reasons.push(
- `Krea-2 edit references need a Qwen3-VL encoder with vision weights, which the GGUF encoder "${encoder.name}" does not have. Select a safetensors file or Diffusers folder that includes the vision weights.`
- );
+ if (hasEditReferences && encoder && isGgufQwen3Vl4bEncoder(encoder)) {
+ if (!tower || !isQwen3Vl4bVisionTower(tower)) {
+ reasons.push({ reason: KREA2_GGUF_VISION_TOWER_REASON, target: KREA2_VISION_TOWER_TARGET });
+ } else if ((encoder.cpu_only === true) !== (tower.cpu_only === true)) {
+ reasons.push({ reason: VISION_TOWER_CPU_ONLY_REASON, target: KREA2_VISION_TOWER_TARGET });
+ }
}
return reasons;
@@ -2800,8 +2828,8 @@ const getModelFamilyValidationIssues = (model: MainModelConfig, settings: Genera
if (model.base === 'krea-2') {
issues.push(
- ...getKrea2ReferenceValidationReasons(settings).map((reason) =>
- createUntranslatedGenerationIssue(reason, REFERENCE_IMAGES_TARGET)
+ ...getKrea2ReferenceValidationReasons(settings).map(({ reason, target }) =>
+ createUntranslatedGenerationIssue(reason, target)
)
);
}
diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
index ac54e9e33a..0f28595508 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
@@ -114,14 +114,20 @@ export const isQwen3Vl4bEncoder: GenerateComponentFilter = (model) =>
export const isQwen3Vl8bEncoder: GenerateComponentFilter = (model) =>
model.type === 'qwen3_vl_encoder' && model.variant === 'qwen3_vl_8b';
-/** The mmproj file of a GGUF Qwen3-VL encoder; the loader accepts the 8B one only. */
+/** The mmproj file of a GGUF Qwen3-VL encoder; the loader accepts the tower of the encoder's own size only. */
export const isQwen3Vl8bVisionTower: GenerateComponentFilter = (model) =>
model.type === 'qwen3_vl_vision_tower' && model.variant === 'qwen3_vl_8b';
+export const isQwen3Vl4bVisionTower: GenerateComponentFilter = (model) =>
+ model.type === 'qwen3_vl_vision_tower' && model.variant === 'qwen3_vl_4b';
+
/** A GGUF encoder keeps no vision tower (llama.cpp splits it into an mmproj file), so references need the tower model. */
export const isGgufQwen3Vl8bEncoder: GenerateComponentFilter = (model) =>
isQwen3Vl8bEncoder(model) && model.format === 'gguf_quantized';
+export const isGgufQwen3Vl4bEncoder: GenerateComponentFilter = (model) =>
+ isQwen3Vl4bEncoder(model) && model.format === 'gguf_quantized';
+
/** Exclude only single-file unconditional branches (safetensors or GGUF); Diffusers bundles both branches. */
export const isIdeogram4UnconditionalBranch: GenerateComponentFilter = (model) =>
model.type === 'main' &&
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
index 85d29004e9..1f2a660a3e 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
@@ -1532,6 +1532,40 @@ describe('Krea-2, Ideogram 4 and Wan graphs', () => {
});
});
+ it('sends the Krea-2 Vision Tower only beside a GGUF 4B encoder, and never a stale or 8B one', () => {
+ const ggufEncoder: ComponentModelConfig = { ...qwen3VlEncoder, format: 'gguf_quantized' };
+ const tower = (variant: 'qwen3_vl_4b' | 'qwen3_vl_8b'): ComponentModelConfig => ({
+ base: 'any',
+ format: 'gguf_quantized',
+ key: `mmproj-${variant}`,
+ name: 'mmproj',
+ type: 'qwen3_vl_vision_tower',
+ variant,
+ });
+ const tower4b = tower('qwen3_vl_4b');
+ const nodes = (encoder: ComponentModelConfig, vision: ComponentModelConfig) => {
+ const graph = compile(krea2Checkpoint, {
+ qwen3VLEncoderModel: encoder,
+ qwen3VLVisionTowerModel: vision,
+ vae: krea2Vae,
+ });
+
+ return { loader: graph.nodes.model_loader, metadata: getNodeByType(graph, 'core_metadata') };
+ };
+
+ const sent = nodes(ggufEncoder, tower4b);
+
+ expect(sent.loader).toMatchObject({ qwen3_vl_vision_tower_model: tower4b });
+ expect(sent.metadata).toMatchObject({ qwen3_vl_vision_tower: tower4b });
+ expect(
+ (nodes(ggufEncoder, tower('qwen3_vl_8b')).loader as Record<string, unknown>)?.qwen3_vl_vision_tower_model
+ ).toBeUndefined();
+ expect(
+ (nodes(qwen3VlEncoder, tower4b).loader as Record<string, unknown>)?.qwen3_vl_vision_tower_model
+ ).toBeUndefined();
+ expect((nodes(qwen3VlEncoder, tower4b).metadata as Record<string, unknown>)?.qwen3_vl_vision_tower).toBeUndefined();
+ });
+
it('sends an anima-registered Qwen-Image VAE to the Krea-2 loader', () => {
// Graph compilation accepts compatible cross-registration VAEs.
const animaRegisteredVae: VaeModelConfig = {
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
index 59f3013dc5..54bb4cd9ef 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
@@ -35,9 +35,11 @@ import {
isBundledFlux2Main,
isBundledMainForBase,
isErnieImageMistralEncoder,
+ isGgufQwen3Vl4bEncoder,
isGgufQwen3Vl8bEncoder,
isFlux2MistralEncoder,
isFlux2Qwen3EncoderForModel,
+ isQwen3Vl4bVisionTower,
isQwen3Vl8bEncoder,
isQwen3Vl8bVisionTower,
isMossImageQwen35Encoder,
@@ -1470,6 +1472,11 @@ const buildKrea2Graph = (
const isDiffusers = model.format === 'diffusers';
const vaeModel = getCompatibleVae(settings, model);
const qwen3VlEncoderModel = getCompatibleComponent(settings.qwen3VLEncoderModel, isQwen3Vl4bEncoder);
+ // The loader refuses a tower beside any other encoder, so a stale pick is never sent.
+ const qwen3VlVisionTowerModel =
+ qwen3VlEncoderModel && isGgufQwen3Vl4bEncoder(qwen3VlEncoderModel)
+ ? getCompatibleComponent(settings.qwen3VLVisionTowerModel, isQwen3Vl4bVisionTower)
+ : null;
if (!isDiffusers) {
requireComponent(vaeModel, 'Krea-2 VAE');
@@ -1485,6 +1492,7 @@ const buildKrea2Graph = (
id: 'model_loader',
model,
qwen3_vl_encoder_model: qwen3VlEncoderModel ?? undefined,
+ qwen3_vl_vision_tower_model: qwen3VlVisionTowerModel ?? undefined,
type: 'krea2_model_loader',
vae_model: vaeModel ?? undefined,
});
@@ -1583,6 +1591,7 @@ const buildKrea2Graph = (
...(styleReference ? { krea2_style_strength: styleReference.config.styleStrength } : {}),
...(referenceKvCache === undefined ? {} : { krea2_reference_kv_cache: referenceKvCache }),
qwen3_vl_encoder: qwen3VlEncoderModel ?? undefined,
+ qwen3_vl_vision_tower: qwen3VlVisionTowerModel ?? undefined,
vae: vaeModel ?? undefined,
});
addReferenceImageMetadata(graph, output, settings);
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts b/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts
index 52f7c77bae..aa956ddd6d 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts
@@ -38,7 +38,7 @@ import { clampDimension, deriveAspectRatioId } from './settings';
export interface ModelShape {
label: string;
overrides: Partial<MainModelConfig>;
- /** Qwen-Image-2.1: read the references with a GGUF encoder and its Vision Tower instead of a safetensors encoder. */
+ /** Qwen-Image-2.1 and Krea-2: read the references with a GGUF encoder and its Vision Tower instead of a safetensors encoder. */
ggufEncoder?: true;
}
@@ -66,11 +66,15 @@ export const SHAPE_OVERRIDES: Partial<Record<SupportedGenerateBase, readonly Mod
{ label: 'dev-standalone', overrides: { format: 'gguf_quantized', variant: 'dev' } },
{ label: 'klein-9b-standalone', overrides: { format: 'gguf_quantized', variant: 'klein_9b' } },
],
- // The Vision Tower slot opens only beside a GGUF encoder, so that path needs its own shape.
+ // The Vision Tower slot opens only beside a GGUF encoder, so that path needs its own shape (Krea-2 below).
'qwen-image-2-1': [
...DEFAULT_SHAPES,
{ ggufEncoder: true, label: 'standalone-gguf-encoder', overrides: { format: 'gguf_quantized' } },
],
+ 'krea-2': [
+ ...DEFAULT_SHAPES,
+ { ggufEncoder: true, label: 'standalone-gguf-encoder', overrides: { format: 'gguf_quantized' } },
+ ],
// FLUX.3 Klein samples without CFG; Klein Base compiles the negative branch at its CFG default.
flux3: [
{ label: 'klein-diffusers', overrides: { format: 'diffusers', variant: 'flux3_klein' } },
diff --git a/invokeai/frontend/webv2/src/features/models/core/relationships.ts b/invokeai/frontend/webv2/src/features/models/core/relationships.ts
index 636bb13dc4..a951503eda 100644
--- a/invokeai/frontend/webv2/src/features/models/core/relationships.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/relationships.ts
@@ -25,8 +25,8 @@ export const NULL_BASE_ALLOWANCES: Readonly<Partial<Record<ModelTaxonomyType, Re
qwen3_encoder: new Set(['anima', 'flux2', 'z-image']),
/** krea2_model_loader, qwen_image_2_1_model_loader, flux3_model_loader. */
qwen3_vl_encoder: new Set(['flux3', 'krea-2', 'qwen-image-2-1']),
- /** qwen_image_2_1_model_loader (mmproj of a GGUF 8B encoder). */
- qwen3_vl_vision_tower: new Set(['qwen-image-2-1']),
+ /** qwen_image_2_1_model_loader (mmproj of a GGUF 8B encoder), krea2_model_loader (4B). */
+ qwen3_vl_vision_tower: new Set(['krea-2', 'qwen-image-2-1']),
/** anima_model_loader (Anima-3.8B's semantic connector), moss_image_model_loader. */
qwen3_5_encoder: new Set(['anima', 'moss-image']),
/** qwen_image_model_loader. */
diff --git a/tests/app/invocations/test_krea2_model_loader.py b/tests/app/invocations/test_krea2_model_loader.py
index 855631f545..505df58032 100644
--- a/tests/app/invocations/test_krea2_model_loader.py
+++ b/tests/app/invocations/test_krea2_model_loader.py
@@ -110,3 +110,82 @@ def test_loader_rejects_a_qwen3_vl_encoder_of_the_wrong_size(variant, match: str
with pytest.raises(ValueError, match=match):
Krea2ModelLoaderInvocation(model=main, vae_model=vae, qwen3_vl_encoder_model=encoder).invoke(_context(configs))
+
+
+def _tower_configs(
+ encoder_format: ModelFormat, tower_type: ModelType, tower_variant: Qwen3VLVariantType
+) -> dict[str, SimpleNamespace]:
+ return {
+ "main": _config(BaseModelType.Krea2, ModelType.Main, ModelFormat.Checkpoint),
+ "vae": _config(BaseModelType.QwenImage, ModelType.VAE, ModelFormat.Checkpoint),
+ "encoder": _config(BaseModelType.Any, ModelType.Qwen3VLEncoder, encoder_format, Qwen3VLVariantType.Qwen3VL_4B),
+ "tower": _config(BaseModelType.Any, tower_type, ModelFormat.GGUFQuantized, tower_variant),
+ }
+
+
+def _tower_loader(with_tower: bool = True) -> Krea2ModelLoaderInvocation:
+ return Krea2ModelLoaderInvocation(
+ model=_model("main", BaseModelType.Krea2, ModelType.Main),
+ vae_model=_model("vae", BaseModelType.QwenImage, ModelType.VAE),
+ qwen3_vl_encoder_model=_model("encoder", BaseModelType.Any, ModelType.Qwen3VLEncoder),
+ qwen3_vl_vision_tower_model=(
+ _model("tower", BaseModelType.Any, ModelType.Qwen3VLVisionTower) if with_tower else None
+ ),
+ )
+
+
+def test_loader_hands_the_vision_tower_beside_a_gguf_encoder_to_the_field() -> None:
+ configs = _tower_configs(ModelFormat.GGUFQuantized, ModelType.Qwen3VLVisionTower, Qwen3VLVariantType.Qwen3VL_4B)
+
+ field = _tower_loader().invoke(_context(configs)).qwen3_vl_encoder
+
+ assert field.vision_tower is not None
+ assert field.vision_tower.key == "tower"
+
+
+ ("encoder_format", "tower_type", "tower_variant", "match"),
+ [
+ (
+ ModelFormat.GGUFQuantized,
+ ModelType.Qwen3VLVisionTower,
+ Qwen3VLVariantType.Qwen3VL_8B,
+ "Krea-2 reads references with the 4B one",
+ ),
+ (
+ ModelFormat.GGUFQuantized,
+ ModelType.Qwen3VLEncoder,
+ Qwen3VLVariantType.Qwen3VL_4B,
+ "is not a Qwen3-VL vision tower",
+ ),
+ (
+ ModelFormat.Qwen3VLEncoder,
+ ModelType.Qwen3VLVisionTower,
+ Qwen3VLVariantType.Qwen3VL_4B,
+ "pairs only with a GGUF Qwen3-VL encoder",
+ ),
+ ],
+)
+def test_loader_refuses_a_vision_tower_that_does_not_fit(
+ encoder_format: ModelFormat, tower_type: ModelType, tower_variant: Qwen3VLVariantType, match: str
+) -> None:
+ configs = _tower_configs(encoder_format, tower_type, tower_variant)
+
+ with pytest.raises(ValueError, match=match):
+ _tower_loader().invoke(_context(configs))
+
+
+def test_loader_refuses_a_vision_tower_without_a_standalone_encoder() -> None:
+ """The Diffusers pipeline's own encoder brings a tower; a stale selection must not pass silently."""
+ configs = _tower_configs(ModelFormat.GGUFQuantized, ModelType.Qwen3VLVisionTower, Qwen3VLVariantType.Qwen3VL_4B)
+ configs["main"] = _config(BaseModelType.Krea2, ModelType.Main, ModelFormat.Diffusers)
+ loader = _tower_loader().model_copy(update={"qwen3_vl_encoder_model": None})
+
+ with pytest.raises(ValueError, match="pairs only with a GGUF Qwen3-VL encoder"):
+ loader.invoke(_context(configs))
+
+
+def test_loader_leaves_the_vision_tower_empty_when_none_is_selected() -> None:
+ configs = _tower_configs(ModelFormat.GGUFQuantized, ModelType.Qwen3VLVisionTower, Qwen3VLVariantType.Qwen3VL_4B)
+
+ assert _tower_loader(with_tower=False).invoke(_context(configs)).qwen3_vl_encoder.vision_tower is None
diff --git a/tests/app/invocations/test_krea2_text_encoder.py b/tests/app/invocations/test_krea2_text_encoder.py
index f5638a773f..e79427d94d 100644
--- a/tests/app/invocations/test_krea2_text_encoder.py
+++ b/tests/app/invocations/test_krea2_text_encoder.py
@@ -442,38 +442,49 @@ def processing() -> dict:
def _edit_context(
- events: list[str], loaded: list, infos: dict, *, refuse_tower: bool = False, processing: dict | None = None
+ events: list[str],
+ loaded: list,
+ infos: dict,
+ *,
+ refuse_vision_weights: bool = False,
+ processing: dict | None = None,
+ config: SimpleNamespace = _ENCODER_CONFIG,
+ tower_device: str = "cpu",
) -> SimpleNamespace:
- """Records every model loaded, in order. `processing` swaps in real models by submodel type."""
+ """Records every model loaded, in order. `processing` swaps in real models by submodel type; a model
+ loaded without a submodel type is the standalone mmproj tower of a GGUF encoder."""
from PIL import Image
def load(identifier):
loaded.append(identifier)
- if refuse_tower and identifier.submodel_type is SubModelType.VisionEncoder:
- raise ValueError("The GGUF Qwen3-VL encoder 'encoder' has no vision tower")
- name = identifier.submodel_type.value
+ if refuse_vision_weights and identifier.submodel_type is SubModelType.VisionEncoder:
+ raise ValueError("The Qwen3-VL encoder 'encoder' has no vision weights")
+ name = identifier.submodel_type.value if identifier.submodel_type is not None else "vision_tower_model"
fakes = {SubModelType.TextEncoder: _TextEncoder, SubModelType.Tokenizer: _Tokenizer}
if processing is not None and identifier.submodel_type in processing:
model = processing[identifier.submodel_type]
else:
model = fakes.get(identifier.submodel_type, object)()
infos[name] = _RecordingInfo(name, model, events)
+ if identifier.submodel_type is None:
+ infos[name].compute_device = torch.device(tower_device)
return infos[name]
return SimpleNamespace(
- models=SimpleNamespace(load=load, get_config=lambda _identifier: _ENCODER_CONFIG),
+ models=SimpleNamespace(load=load, get_config=lambda _identifier: config),
util=SimpleNamespace(signal_progress=lambda _message: None),
images=SimpleNamespace(get_pil=lambda name: Image.new("RGB", _IMAGE_SIZES.get(name, (64, 48)))),
)
-def _edit_invocation(*image_names: str) -> Krea2TextEncoderInvocation:
+def _edit_invocation(*image_names: str, vision_tower: ModelIdentifierField | None = None) -> Krea2TextEncoderInvocation:
from invokeai.app.invocations.fields import ImageField
encoder = _identifier("encoder", ModelType.Qwen3VLEncoder)
field = Qwen3VLEncoderField(
tokenizer=encoder.model_copy(update={"submodel_type": SubModelType.Tokenizer}),
text_encoder=encoder.model_copy(update={"submodel_type": SubModelType.TextEncoder}),
+ vision_tower=vision_tower,
loras=[],
)
return Krea2TextEncoderInvocation(
@@ -583,11 +594,15 @@ def test_a_reference_the_processor_refuses_fails_before_either_tower_is_read(_no
assert [identifier.submodel_type for identifier in loaded] == [SubModelType.Tokenizer, SubModelType.Processor]
-def test_an_encoder_without_a_tower_fails_before_the_encoder_is_read(_no_lora_patching, processing) -> None:
+def test_a_non_gguf_encoder_without_vision_weights_fails_before_the_encoder_is_read(
+ _no_lora_patching, processing
+) -> None:
loaded: list = []
- with pytest.raises(ValueError, match="has no vision tower"):
- _edit_invocation("small")._encode(_edit_context([], loaded, {}, refuse_tower=True, processing=processing))
+ with pytest.raises(ValueError, match="has no vision weights"):
+ _edit_invocation("small")._encode(
+ _edit_context([], loaded, {}, refuse_vision_weights=True, processing=processing)
+ )
assert SubModelType.TextEncoder not in {identifier.submodel_type for identifier in loaded}
@@ -611,3 +626,72 @@ def test_the_conditioning_records_how_many_references_it_read(monkeypatch, image
invocation.invoke(context)
assert saved["data"].conditionings[0].num_reference_images == len(image_names)
+
+
+_GGUF_CONFIG = SimpleNamespace(format=ModelFormat.GGUFQuantized, name="gguf-encoder")
+_MMPROJ = _identifier("mmproj", ModelType.Qwen3VLVisionTower)
+
+
+def test_a_gguf_encoder_reads_references_through_the_selected_tower_model(monkeypatch, _no_lora_patching) -> None:
+ """The mmproj model is the tower itself, not a submodel of the encoder, and is lent under the same lock
+ order as a tower that belongs to the encoder."""
+ loaded: list = []
+ events: list[str] = []
+ infos: dict = {}
+ captured: dict = {}
+
+ def encode(inputs, text_encoder, vision_tower):
+ events.append("encode")
+ captured["vision_tower"] = vision_tower
+ return torch.zeros(1, 266, 12, 4), torch.ones(1, 266, dtype=torch.bool)
+
+ monkeypatch.setattr(
+ f"{_INVOCATION_MODULE}.tokenize_krea2_prompt_with_images",
+ lambda *_args: {"input_ids": torch.zeros(1, 300, dtype=torch.long)},
+ )
+ monkeypatch.setattr(f"{_INVOCATION_MODULE}.encode_krea2_prompt_with_images", encode)
+
+ _edit_invocation("small", vision_tower=_MMPROJ)._encode(_edit_context(events, loaded, infos, config=_GGUF_CONFIG))
+
+ tower_loads = [identifier for identifier in loaded if identifier.key == "mmproj"]
+ assert len(tower_loads) == 1 and tower_loads[0].submodel_type is None
+ assert SubModelType.VisionEncoder not in {identifier.submodel_type for identifier in loaded}
+ assert captured["vision_tower"] is infos["vision_tower_model"].model
+ assert events == [
+ "lock text_encoder",
+ "lock vision_tower_model",
+ "encode",
+ "unlock vision_tower_model",
+ "unlock text_encoder",
+ ]
+ assert infos["vision_tower_model"].working_mem_bytes == infos["text_encoder"].working_mem_bytes
+
+
+def test_a_gguf_encoder_without_a_tower_model_fails_before_anything_loads(_no_lora_patching) -> None:
+ loaded: list = []
+
+ with pytest.raises(ValueError, match="Select the Vision Tower model"):
+ _edit_invocation("small")._encode(_edit_context([], loaded, {}, config=_GGUF_CONFIG))
+
+ assert loaded == []
+
+
+def test_a_gguf_text_only_prompt_never_loads_the_tower_model(_no_lora_patching) -> None:
+ loaded: list = []
+
+ _edit_invocation(vision_tower=_MMPROJ)._encode(_edit_context([], loaded, {}, config=_GGUF_CONFIG))
+
+ assert "mmproj" not in {identifier.key for identifier in loaded if identifier.submodel_type is None}
+ assert {identifier.submodel_type for identifier in loaded} == {SubModelType.Tokenizer, SubModelType.TextEncoder}
+
+
+def test_a_tower_on_another_device_than_the_encoder_is_refused(monkeypatch, _no_lora_patching) -> None:
+ monkeypatch.setattr(
+ f"{_INVOCATION_MODULE}.tokenize_krea2_prompt_with_images",
+ lambda *_args: {"input_ids": torch.zeros(1, 300, dtype=torch.long)},
+ )
+
+ with pytest.raises(RuntimeError, match="need one device"):
+ _edit_invocation("small", vision_tower=_MMPROJ)._encode(
+ _edit_context([], [], {}, config=_GGUF_CONFIG, tower_device="meta")
+ )
diff --git a/tests/backend/model_manager/load/test_qwen3_vl_vision_encoder.py b/tests/backend/model_manager/load/test_qwen3_vl_vision_encoder.py
index 577c485b3a..5785f37bf8 100644
--- a/tests/backend/model_manager/load/test_qwen3_vl_vision_encoder.py
+++ b/tests/backend/model_manager/load/test_qwen3_vl_vision_encoder.py
@@ -311,7 +311,7 @@ def test_a_gguf_encoder_refuses_the_tower_by_name(tmp_path: Path) -> None:
path=str(tmp_path / "enc.gguf"), variant=Qwen3VLVariantType.Qwen3VL_4B, name="tiny-gguf"
)
- with pytest.raises(ValueError, match="'tiny-gguf' has no vision tower"):
+ with pytest.raises(ValueError, match="'tiny-gguf' has no vision tower.*the 4B mmproj file"):
_loader(Qwen3VLEncoderGGUFLoader)._load_model(config, SubModelType.VisionEncoder)