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.

test(qwen-image-2-1): pin the strength rounding and the guidance slice

Alexander Eichhorn15b4257ae289
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 f8de60a6d6..7279c395b1 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
@@ -1,7 +1,7 @@
---
title: Model Format Support
description: Which file formats and quantizations InvokeAI loads for every model family, text encoder, VAE and adapter.
-lastUpdated: 2026-10-11
+lastUpdated: 2026-10-16
sidebar:
order: 3
---
@@ -91,7 +91,7 @@ not recognized.
| 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,
-Wan, Anima and Ideogram 4 VAEs fail with a message when they load. The FLUX.1 and SD 1.x / SDXL single-file VAEs do
+Qwen-Image-2.1, Wan, Anima and Ideogram 4 VAEs fail with a message when they load. The FLUX.1 and SD 1.x / SDXL single-file VAEs do
not check, so a quantized file there fails with an unclear error or decodes incorrectly.
## LoRAs and adapters
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 4414cf8379..25e2a520ad 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
@@ -1,7 +1,7 @@
---
title: Qwen-Image-2.1
description: Generate images with Qwen-Image-2.1 and its 8-step Turbo variant, from the Diffusers folders or a GGUF transformer, including transparent (RGBA) output.
-lastUpdated: 2026-10-10
+lastUpdated: 2026-10-16
sidebar:
order: 8
---
@@ -68,4 +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.
+- **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 at noise level 0.5): the same value changes the image less on Turbo than on the base model.
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 b7d7673fb8..20e7fa0ad0 100644
--- a/tests/app/invocations/test_qwen_image_2_1_nodes.py
+++ b/tests/app/invocations/test_qwen_image_2_1_nodes.py
@@ -137,22 +137,27 @@ def test_without_guidance_the_negative_prompt_is_never_run() -> None:
assert {prompt for prompt, *_ in transformer.calls} == {"pos"}
-def test_image_to_image_on_turbo_starts_at_the_noise_level_of_its_strength() -> None:
+ ("cfg_scale", "negative_calls"),
+ # One value per configured step; only the last two are reached from 0.5. Guidance on just those two runs the
+ # negative prompt twice; guidance on just the skipped ones, never -- a slice off by one would run it once.
+ [([1.0] * 6 + [4.0, 4.0], 2), ([4.0] * 6 + [1.0, 1.0], 0)],
+ ids=["guided-tail", "guided-head"],
+)
+def test_image_to_image_on_turbo_starts_at_the_noise_level_of_its_strength(
+ cfg_scale: list[float], negative_calls: int
+) -> None:
# Turbo's table is front-loaded (six of eight steps above 0.84). A strength of 0.5 must start at 0.5, not at
# the table's fifth entry (0.895), which would all but discard the input image.
transformer = _Transformer()
init = torch.zeros(1, LATENT_CHANNELS, 4, 4)
_denoise(
- steps=8,
- denoising_start=0.5,
- latents=LatentsField(latents_name="init"),
- # One value per configured step; only the last two are reached from 0.5.
- cfg_scale=[1.0] * 6 + [4.0, 4.0],
+ steps=8, denoising_start=0.5, latents=LatentsField(latents_name="init"), cfg_scale=cfg_scale
)._run_diffusion(_context(transformer, QwenImage21VariantType.Turbo, init_latents=init))
positive = [(mode, t) for prompt, _cache, mode, t in transformer.calls if prompt == "pos"]
assert positive == [("extract", 0.5), ("cached", 0.415)]
- assert sum(prompt == "neg" for prompt, *_ in transformer.calls) == 2
+ assert sum(prompt == "neg" for prompt, *_ in transformer.calls) == negative_calls
def test_image_to_image_on_base_starts_at_the_step_its_strength_names() -> None:
@@ -173,7 +178,16 @@ def test_image_to_image_on_base_starts_at_the_step_its_strength_names() -> None:
@pytest.mark.parametrize(
("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))],
+ [
+ (0.0, 1.0, (0, 8)),
+ (0.5, 1.0, (4, 4)),
+ # Rounded to the nearest step, as Qwen-Image's own denoise rounds: 5.6 -> 6, 4.8 -> 5.
+ (0.7, 1.0, (6, 2)),
+ (0.0, 0.6, (0, 5)),
+ (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]
@@ -191,8 +205,12 @@ 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.
[email protected]("dtype", [torch.float32, torch.bfloat16])
+def test_the_estimate_is_priced_at_the_compute_dtypes_width(
+ dtype: torch.dtype, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ # A hard-coded width at the call site would halve the float32 estimate, or double the bf16 one CUDA runs.
+ monkeypatch.setattr(f"{DENOISE}.TorchDevice.choose_bfloat16_safe_dtype", lambda _device: dtype)
widths: list[int] = []
estimate = QwenImage21DenoiseInvocation._estimate_working_memory
@@ -202,7 +220,7 @@ def test_the_estimate_is_priced_at_the_compute_dtypes_width(monkeypatch: pytest.
monkeypatch.setattr(QwenImage21DenoiseInvocation, "_estimate_working_memory", staticmethod(spy))
_denoise()._run_diffusion(_context(_Transformer(), QwenImage21VariantType.Base))
- assert widths == [torch.float32.itemsize]
+ assert widths == [dtype.itemsize]
class _DecodingVAE: