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(qwen-image-2-1): start Base image-to-image by step index; add 2.1 to the format page

Alexander Eichhornbd69e42ccd7d
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 9179c25335..f8de60a6d6 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
@@ -34,6 +34,7 @@ Ministral 3B encoder. Others are recognized by their layer names and fail, or mi
| [CogView4](/users-guide/models/local-models/cogview4/) | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| [Z-Image](/users-guide/models/local-models/z-image/) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ |
| [Qwen-Image](/users-guide/models/local-models/qwen-image/) | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ | ✗ | ✗ |
+| [Qwen-Image-2.1](/users-guide/models/local-models/qwen-image-2-1/) | ✓ | ✓ | ✓ | ✓ | R | – | ✓ | ✗ | ✗ |
| [Anima](/users-guide/models/local-models/anima/) | – | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ |
| [Krea-2](/users-guide/models/local-models/krea-2/) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| [Ideogram 4](/users-guide/models/local-models/ideogram4/) | ✓ | ✓ | ✓ | ✓ | R | ✓ | ✓ | ✗ | inside the Diffusers folder |
@@ -43,7 +44,8 @@ Ministral 3B encoder. Others are recognized by their layer names and fail, or mi
| [MiniMax H3](/users-guide/video-generation/minimax-h3/) | ✓ | ✓ | L | ✓ | L | ✗ | ✗ | ✗ | ✗ |
- **int8** means ComfyUI's `int8_convrot` (`int8_tensorwise`) builds. **nvfp4** and **fp8 scaled** mean ComfyUI's
- checkpoint layouts; other exports of the same schemes (AWQ, ModelOpt) fail when the model loads.
+ checkpoint layouts; other exports of the same schemes (AWQ, ModelOpt) fail when the model loads. For Qwen-Image-2.1,
+ torchao exports such as unsloth's FP8 build are refused at install.
- **GGUF** covers the llama.cpp types (Q4_0 through Q8_0, the K-quants, BF16). ComfyUI-GGUF's `Q8_CR` files load
for Krea-2 only; for every other model with GGUF support the install fails.
- LTX-2.0/2.3 files fail to install with a message. Wan 2.1, Wan Animate, S2V, Fun-Control and VACE single files and
@@ -57,7 +59,7 @@ Ministral 3B encoder. Others are recognized by their layer names and fail, or mi
| T5-XXL | FLUX.1, SD 3 | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ | ✓ (and bitsandbytes int8) |
| CLIP-L / CLIP-G | SD, SDXL, FLUX.1, SD 3 | ✓ | ✓ | R | R | – | ✗ | CLIP-L inside a FLUX.1 SDNQ pipeline |
| Qwen3 0.6B / 4B / 8B | Z-Image, FLUX.2 Klein, Anima | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Qwen3-VL 4B / 8B | Krea-2, Ideogram 4 | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ |
+| Qwen3-VL 4B / 8B | Krea-2, Ideogram 4, Qwen-Image-2.1 (8B) | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ |
| Qwen3-VL 32B (truncated) | MiniMax H3 | in the Diffusers folder | ✓ | L | ✓ | L | ✗ | ✗ |
| Qwen3.5 4B | Anima 3.8B | ✗ | ✓ | L | L | L | ✗ | ✗ |
| Qwen2.5-VL | Qwen-Image | ✓ | ✓ | ✓ | L | ✓ | ✗ | ✗ |
@@ -85,6 +87,7 @@ not recognized.
| SD 2.x | ✓ | ✗ | SD 2.x |
| Wan (16 and 48 channels) | ✓ | ✓ | Wan 2.2; the Wan 2.1 VAE also by Anima |
| Qwen-Image | ✓ | ✗ | Qwen-Image, Krea-2 |
+| Qwen-Image-2.1 | ✓ | ✓ | Qwen-Image-2.1 |
| CogView4, LTX-2, MiniMax H3 | – | bundled | taken from the model's own folder |
Quantized VAE files (fp8, int8, nvfp4) are not supported; use the unquantized VAE. The SD 3, FLUX.2, Qwen-Image,
@@ -101,7 +104,7 @@ not check, so a quantized file there fails with an unclear error or decodes inco
| FLUX.2, Z-Image | ✓ (LyCORIS, Diffusers) | Z-Image only | |
| Qwen-Image, Krea-2, Wan 2.2, Anima | ✓ (LyCORIS/kohya, including LoKR where noted on the family page) | Anima (ControlNet-LLLite) | |
| LTX-2, MiniMax H3 | ✓ (plain low-rank; LoKR, LoHA and DoRA are refused) | ✗ | |
-| SD 3, CogView4, Ideogram 4, ERNIE-Image | ✗ | ✗ | |
+| SD 3, CogView4, Ideogram 4, ERNIE-Image, Qwen-Image-2.1 | ✗ | ✗ | |
[PiD decoders](/users-guide/image-generation/advanced-topics/pid-decode/) load for FLUX.1, FLUX.2, SD 3, SDXL and
Qwen-Image (v1 and v1.5, bf16 and int8 builds).
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/qwen-image-2-1.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/qwen-image-2-1.mdx
index ce1e200a4b..4414cf8379 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/qwen-image-2-1.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/qwen-image-2-1.mdx
@@ -68,3 +68,4 @@ Image-to-image, inpainting and outpainting read the colors of the input image an
- **Steps** — 40 for the base model and 8 for Turbo. Turbo's schedule is tuned for 8 steps; other step counts are spread over the same curve and work, but 8 is what it was distilled for.
- **CFG** — 1 by default, which runs one prompt per step. Above 1, the negative prompt is used and each step costs about twice as long.
- There is no scheduler setting: both variants use the schedule they were trained with.
+- **Denoising strength** (image-to-image, inpainting) — on the base model a strength changes the image about as much as on Qwen-Image or Z-Image. Turbo's 8-step schedule spends most of its steps at high noise, so there a strength sets the starting noise level directly (0.5 starts half-way): the same value changes the image less on Turbo than on the base model.
diff --git a/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py b/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py
index a42ce8893c..5e49d96666 100644
--- a/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py
+++ b/invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py
@@ -23,7 +23,7 @@ from invokeai.app.invocations.primitives import LatentsOutput
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.app.util.startup_utils import log_attention_backends
from invokeai.backend.flux.sampling_utils import clip_timestep_schedule_fractional
-from invokeai.backend.model_manager.taxonomy import BaseModelType
+from invokeai.backend.model_manager.taxonomy import BaseModelType, QwenImage21VariantType
from invokeai.backend.quantization.dequantizing_linear import peak_dequant_transient_bytes
from invokeai.backend.qwen_image_2_1.sampling import build_sigmas
from invokeai.backend.rectified_flow.rectified_flow_inpaint_extension import RectifiedFlowInpaintExtension
@@ -41,18 +41,26 @@ TOKENS_PER_SLOT = 4
logger = InvokeAILogger.get_logger(__name__)
-def clip_sigmas(sigmas: list[float], denoising_start: float, denoising_end: float) -> tuple[list[float], int]:
- """The part of the schedule from noise level `1 - denoising_start` to `1 - denoising_end`, and the index of the
- configured step it starts in.
+def clip_sigmas(
+ sigmas: list[float], denoising_start: float, denoising_end: float, *, by_noise_level: bool
+) -> tuple[list[float], int]:
+ """The part of the schedule `denoising_start` to `denoising_end` covers, and the index of the configured step
+ it starts in. A range shorter than a step still runs one step.
- Picked by noise level, not by step index: Turbo's distilled table sits above 0.84 for six of its eight steps, so a
- start picked by index would begin a moderate-strength image-to-image almost from pure noise. By level, a strength
- means the same noise for both variants, and a range shorter than a step still runs one step.
+ Base picks by step index, as Qwen-Image, Z-Image and diffusers' image-to-image pipelines do, so a strength changes
+ the image as much as it does on those models: its shifted schedule stays at high noise for most of its steps.
+ Turbo picks by noise level (`1 - denoising_start` to `1 - denoising_end`): its distilled table sits above 0.84 for
+ six of its eight steps, so by index any strength from 0.5 to 0.85 would begin almost from pure noise.
"""
- clipped = clip_timestep_schedule_fractional(list(sigmas), denoising_start, denoising_end)
- # The configured step `clipped[0]` falls in: the last one starting at or above the start level.
- first_step = sum(1 for sigma in sigmas if sigma >= 1.0 - denoising_start - 1e-6) - 1
- return clipped, first_step
+ if by_noise_level:
+ clipped = clip_timestep_schedule_fractional(list(sigmas), denoising_start, denoising_end)
+ # The configured step `clipped[0]` falls in: the last one starting at or above the start level.
+ first_step = sum(1 for sigma in sigmas if sigma >= 1.0 - denoising_start - 1e-6) - 1
+ return clipped, first_step
+ steps = len(sigmas) - 1
+ first_step = min(int(round(denoising_start * steps)), steps - 1)
+ last_step = max(int(round(denoising_end * steps)), first_step + 1)
+ return list(sigmas[first_step : last_step + 1]), first_step
def pack_latents(latents: torch.Tensor) -> torch.Tensor:
@@ -171,8 +179,14 @@ class QwenImage21DenoiseInvocation(BaseInvocation, WithMetadata, WithBoard):
latent_height, latent_width = self.height // VAE_SCALE_FACTOR, self.width // VAE_SCALE_FACTOR
image_seq_len = latent_height * latent_width
- full_sigmas = build_sigmas(getattr(transformer_config, "variant", None), self.steps, image_seq_len)
- sigmas, first_step = clip_sigmas(full_sigmas.tolist(), self.denoising_start, self.denoising_end)
+ variant = getattr(transformer_config, "variant", None)
+ full_sigmas = build_sigmas(variant, self.steps, image_seq_len)
+ sigmas, first_step = clip_sigmas(
+ full_sigmas.tolist(),
+ self.denoising_start,
+ self.denoising_end,
+ by_noise_level=variant is QwenImage21VariantType.Turbo,
+ )
sigmas = torch.tensor(sigmas, dtype=torch.float32, device=device)
cfg_scale = self._prepare_cfg_scale(len(full_sigmas) - 1)[first_step : first_step + len(sigmas) - 1]
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 53a4bbcde2..f61e441084 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
@@ -1084,7 +1084,10 @@ describe('Qwen-Image-2.1 graphs', () => {
expect(withCfg.nodes.neg_cond?.type).toBe('qwen_image_2_1_text_encoder');
expect(getEdge(withCfg, 'denoise_latents', 'negative_conditioning')?.source.node_id).toBe('neg_cond');
expect(getEdge(withCfg, 'neg_cond', 'prompt')?.source.node_id).toBe('negative_prompt');
- expect(getEdge(withCfg, 'neg_cond', 'qwen3_vl_encoder')?.source.node_id).toBe('model_loader');
+ expect(getEdge(withCfg, 'neg_cond', 'qwen3_vl_encoder')?.source).toEqual({
+ field: 'qwen3_vl_encoder',
+ node_id: 'model_loader',
+ });
expect(withCfg.nodes.denoise_latents).toMatchObject({ cfg_scale: 4 });
});
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
index 984cffc0b1..a1478499ef 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
@@ -1291,16 +1291,11 @@ const buildQwenImage21Graph = (
outputIsIntermediate: boolean,
projectSettings: GenerationProjectSettings
): BackendGraphContract => {
- // A Diffusers pipeline brings its VAE and encoder; single-file and GGUF transformers need both supplied.
- const isDiffusers = model.format === 'diffusers';
+ // A Diffusers pipeline brings its VAE and encoder; for single-file and GGUF transformers the generation policy
+ // requires both before this runs.
const vaeModel = getCompatibleVae(settings, model);
const qwen3VlEncoderModel = getCompatibleComponent(settings.qwen3VLEncoderModel, isQwen3Vl8bEncoder);
- if (!isDiffusers) {
- requireComponent(vaeModel, 'Qwen-Image-2.1 VAE');
- requireComponent(qwen3VlEncoderModel, 'Qwen3-VL Encoder');
- }
-
const graph: BackendGraphContract = { edges: [], id: createId('qwen_image_2_1_graph'), nodes: {} };
const { negativePrompt, positivePrompt, seed } = addPromptAndSeedNodes(graph);
// True CFG runs only above 1, the model's default being off; a negative prompt has no effect without it.
diff --git a/tests/app/invocations/test_qwen_image_2_1_nodes.py b/tests/app/invocations/test_qwen_image_2_1_nodes.py
index 9a4b6a7efd..b7d7673fb8 100644
--- a/tests/app/invocations/test_qwen_image_2_1_nodes.py
+++ b/tests/app/invocations/test_qwen_image_2_1_nodes.py
@@ -16,6 +16,7 @@ from invokeai.app.invocations.model import ModelIdentifierField, TransformerFiel
from invokeai.app.invocations.qwen_image_2_1.qwen_image_2_1_denoise import (
LATENT_CHANNELS,
QwenImage21DenoiseInvocation,
+ clip_sigmas,
pack_latents,
unpack_latents,
)
@@ -154,6 +155,35 @@ def test_image_to_image_on_turbo_starts_at_the_noise_level_of_its_strength() ->
assert sum(prompt == "neg" for prompt, *_ in transformer.calls) == 2
+def test_image_to_image_on_base_starts_at_the_step_its_strength_names() -> None:
+ # Base picks by step index, as Qwen-Image and diffusers' image-to-image pipelines do: a strength of 0.5 skips
+ # the first half of the steps. Its shifted schedule is still well above 0.5 there.
+ from invokeai.backend.qwen_image_2_1.sampling import build_sigmas
+
+ schedule = build_sigmas(QwenImage21VariantType.Base, 8, (64 // 16) * (64 // 16)).tolist()
+ transformer = _Transformer()
+ _denoise(steps=8, denoising_start=0.5, latents=LatentsField(latents_name="init"))._run_diffusion(
+ _context(transformer, QwenImage21VariantType.Base, init_latents=torch.zeros(1, LATENT_CHANNELS, 4, 4))
+ )
+
+ starts = [t for prompt, _cache, _mode, t in transformer.calls if prompt == "pos"]
+ assert starts == pytest.approx(schedule[4:8], abs=1e-3)
+ assert starts[0] > 0.5
+
+
+ ("start", "end", "expected"),
+ [(0.0, 1.0, (0, 8)), (0.5, 1.0, (4, 4)), (0.99, 1.0, (7, 1)), (0.0, 0.01, (0, 1)), (0.25, 0.75, (2, 4))],
+)
+def test_a_strength_on_base_names_whole_steps_and_always_runs_one(
+ start: float, end: float, expected: tuple[int, int]
+) -> None:
+ sigmas = [1.0 - i / 8 for i in range(9)]
+ clipped, first_step = clip_sigmas(sigmas, start, end, by_noise_level=False)
+ assert (first_step, len(clipped) - 1) == expected
+ assert clipped == sigmas[first_step : first_step + len(clipped)]
+
+
def test_a_float32_fallback_reserves_twice_the_bfloat16_activations() -> None:
estimate = QwenImage21DenoiseInvocation._estimate_working_memory
base = 1024**3
@@ -161,6 +191,20 @@ def test_a_float32_fallback_reserves_twice_the_bfloat16_activations() -> None:
assert estimate(4096, 300, 300, True, 4) - base == 2 * bf16
+def test_the_estimate_is_priced_at_the_compute_dtypes_width(monkeypatch: pytest.MonkeyPatch) -> None:
+ # The CPU fixture computes in float32; a hard-coded bf16 width at the call site would halve the estimate.
+ widths: list[int] = []
+ estimate = QwenImage21DenoiseInvocation._estimate_working_memory
+
+ def spy(*args):
+ widths.append(args[-1])
+ return estimate(*args)
+
+ monkeypatch.setattr(QwenImage21DenoiseInvocation, "_estimate_working_memory", staticmethod(spy))
+ _denoise()._run_diffusion(_context(_Transformer(), QwenImage21VariantType.Base))
+ assert widths == [torch.float32.itemsize]
+
+
class _DecodingVAE:
"""A bf16 VAE that records what it decodes and answers with a fixed opaque bf16 decode."""