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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(qwen-image-2-1): decode bit-identically to the pipeline and refuse torchao files
Alexander Eichhornfaf49edacd4b
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.mdxindex a7c000377a..ce1e200a4b 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@@ -40,7 +40,7 @@ A GGUF or single-file transformer carries only the transformer. Pick the other tThe **Qwen-Image-2.1 (Q4_K_M GGUF)** starter model, from [`unsloth/Qwen-Image-2.1-GGUF`](https://huggingface.co/unsloth/Qwen-Image-2.1-GGUF), installs the VAE and the 8B encoder with it, ~15 GB in all. Other quantization levels from that repository load the same way.-Single-file transformers in bf16, scaled fp8 or `int8_convrot` (ComfyUI repackages) load as well. nvfp4 files, and int8 files without ComfyUI's `int8_convrot` marker, are refused at install. GGUF files with int8 layers (ComfyUI-GGUF's `Q8_CR`) are refused too.+Single-file transformers in bf16, scaled fp8 or `int8_convrot` (ComfyUI repackages) load as well. nvfp4 files, torchao-quantized files (such as unsloth's FP8 build), and int8 files without ComfyUI's `int8_convrot` marker, are refused at install. GGUF files with int8 layers (ComfyUI-GGUF's `Q8_CR`) are refused too.The Turbo variant is recognized from the filename: a single file or GGUF whose name contains `turbo` installs as Turbo, anything else as the base model. If a file was detected as the wrong variant, edit the model in the Model Manager and change its **Variant**. The default settings were chosen at install, so also set **Steps** under **Default Settings**: 8 for Turbo, 40 for 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.pyindex 7bd93a0dd2..a42ce8893c 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@@ -232,7 +232,11 @@ class QwenImage21DenoiseInvocation(BaseInvocation, WithMetadata, WithBoard):neg_img_mask = image_slot_mask(neg_embeds.shape[1]) if neg_embeds is not None else Noneworking_memory = self._estimate_working_memory(- image_seq_len, pos_embeds.shape[1], None if neg_embeds is None else neg_embeds.shape[1], do_cfg+ image_seq_len,+ pos_embeds.shape[1],+ None if neg_embeds is None else neg_embeds.shape[1],+ do_cfg,+ dtype.itemsize,)working_memory += self._attention_score_bytes(transformer_info.model,@@ -316,19 +320,23 @@ class QwenImage21DenoiseInvocation(BaseInvocation, WithMetadata, WithBoard):return unpack_latents(latents, latent_height, latent_width).float()@staticmethod- def _estimate_working_memory(image_seq_len: int, pos_text_len: int, neg_text_len: int | None, do_cfg: bool) -> int:+ def _estimate_working_memory(+ image_seq_len: int, pos_text_len: int, neg_text_len: int | None, do_cfg: bool, element_size: int+ ) -> int:"""Peak transformer activations, in bytes, for the model cache to keep free.Measured on an RTX 4090 in bf16 with the transformer fully resident: 0.55 GiB of activations at1024x1024 (4096 image tokens) and 2.2 GiB at 2048x2048 (16384), about 0.14 MiB per token. 0.25 MiB pertoken plus a 1 GiB base leaves room for the allocator and the prefix cache, which holds K and V of every- text token in all 32 blocks (~0.5 MiB per text token, per guidance branch).+ text token in all 32 blocks (~0.5 MiB per text token, per guidance branch). Both per-token terms are bf16+ figures and scale with `element_size`, the compute dtype's width: a float32 fallback needs twice as much."""mib, gib = 1024**2, 1024**3+ width = element_size / 2text_len = max(pos_text_len, neg_text_len or 0)- estimated = int((image_seq_len + text_len) * 0.25 * mib) + gib+ estimated = int((image_seq_len + text_len) * 0.25 * mib * width) + gibbranches = 2 if do_cfg else 1- estimated += int(branches * (pos_text_len if neg_text_len is None else text_len) * 0.5 * mib)+ estimated += int(branches * (pos_text_len if neg_text_len is None else text_len) * 0.5 * mib * width)return estimated@staticmethoddiff --git a/invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.py b/invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.pyindex 848bbbda1a..eb1a3d6e6a 100644--- a/invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.py+++ b/invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.py@@ -51,11 +51,13 @@ class QwenImage21LatentsToImageInvocation(BaseInvocation, WithMetadata, WithBoarwith vae_info.model_on_device(working_mem_bytes=working_memory) as (_, vae):context.util.signal_progress("Running VAE")- # Denormalize in fp32, then cast to the VAE's dtype. The device is the VAE's configured one, not the- # residency of its weights, which partial loading may have moved to the CPU.- mean = torch.tensor(vae.config.latents_mean, device=device).view(1, -1, 1, 1, 1)- std = torch.tensor(vae.config.latents_std, device=device).view(1, -1, 1, 1, 1)- z = (latents.to(device=device, dtype=torch.float32).unsqueeze(2) * std + mean).to(vae.dtype)+ # Denormalized in the VAE's dtype, as the pipeline does: the latents cast first, the float32 statistics+ # cast to them, so a bf16 decode reads the same input as the pipeline's. The device is the VAE's+ # configured one, not the residency of its weights, which partial loading may have moved to the CPU.+ z = latents.to(device=device, dtype=vae.dtype).unsqueeze(2)+ mean = torch.tensor(vae.config.latents_mean).view(1, -1, 1, 1, 1).to(device, z.dtype)+ std = torch.tensor(vae.config.latents_std).view(1, -1, 1, 1, 1).to(device, z.dtype)+ z = z * std + meanTorchDevice.empty_cache()with torch.inference_mode(), patch_qwen_image_vae_tiling(vae, tile_size, SPATIAL_SCALE):decoded = vae.decode(z, return_dict=False)[0][0, :, 0]diff --git a/invokeai/backend/model_manager/configs/main.py b/invokeai/backend/model_manager/configs/main.pyindex 9cd3203e32..fc2e04af9e 100644--- a/invokeai/backend/model_manager/configs/main.py+++ b/invokeai/backend/model_manager/configs/main.py@@ -1549,14 +1549,19 @@ def _raise_for_unsupported_comfy_quantization(mod: ModelOnDisk, state_dict: dictright outcome is a refusal the installer shows, not a fall-through to `Unknown_Config` thatregisters it as a model nothing can load.- Two of them. nvfp4 packs two codes per byte, so its uint8 weights are indistinguishable from+ Three of them. torchao's serialized tensor subclasses (unsloth's Qwen-Image-2.1 FP8 build) store each quantized+ weight as `<layer>._weight_qdata` beside its scale, with no `<layer>.weight` the transformer could load. Only+ a family whose fingerprint reads unquantized tensors gets here with such a file: Qwen-Image-2.1 does, while an+ Ideogram 4 build that quantized its fingerprint Linears would not match at all.++ nvfp4 packs two codes per byte, so its uint8 weights are indistinguishable fromthe `comfy_quant` markers every repack carries -- including the two supported ones; theper-tensor `weight_scale_2` is what only nvfp4 writes.And int8 weights *without* a readable `int8_tensorwise` marker: the loader refuses those(`reject_unmarked_int8_weights`), because a rotated weight loaded as if it were not one- generates noise. Refusing them here too is what keeps that refusal at install time -- a- torchao or `int8_dynamic` repack would otherwise register as a multi-GiB model, pull in its+ generates noise. Refusing them here too is what keeps that refusal at install time -- an+ `int8_dynamic` repack would otherwise register as a multi-GiB model, pull in itsstarter dependencies, and fail at the first render.The markers come from the file's header rather than from `state_dict`: identification loads@@ -1564,6 +1569,11 @@ def _raise_for_unsupported_comfy_quantization(mod: ModelOnDisk, state_dict: dictis a header parse plus one seek per marker, and it only happens for a file that has int8weights to explain in the first place."""+ if any(isinstance(key, str) and key.endswith("._weight_qdata") for key in state_dict):+ raise InvalidMatchError(+ f"this {family} transformer is saved as torchao-quantized tensors (as unsloth's FP8 build is), which "+ "is not supported. Install the bf16, fp8_scaled or int8_convrot build, or a GGUF, instead."+ )if any(isinstance(key, str) and key.endswith(".weight_scale_2") for key in state_dict):raise InvalidMatchError(f"this is an nvfp4-quantized {family} transformer, which is not supported yet. "diff --git a/invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py b/invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.pyindex d9ae87414d..e108a678fc 100644--- a/invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py+++ b/invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py@@ -81,7 +81,12 @@ class QwenImage21DiffusersModel(GenericDiffusersLoader):if submodel_type is SubModelType.Tokenizer:return AutoTokenizer.from_pretrained(model_path / "processor", local_files_only=True)- dtype = TorchDevice.choose_bfloat16_safe_dtype(TorchDevice.choose_torch_device())+ if submodel_type is SubModelType.VAE:+ # The configured precision, except float16, which is unstable on this autoencoder: bfloat16 where the+ # device has it, float32 otherwise.+ dtype = self._torch_dtype_avoiding_float16()+ else:+ dtype = TorchDevice.choose_bfloat16_safe_dtype(TorchDevice.choose_torch_device())repo_variant = config.repo_variant if isinstance(config, Diffusers_Config_Base) else Nonevariant = repo_variant.value if repo_variant else Noneif submodel_type is SubModelType.TextEncoder:diff --git a/invokeai/backend/qwen_image_2_1/vae.py b/invokeai/backend/qwen_image_2_1/vae.pyindex 6f7be0ab99..f787f2bb44 100644--- a/invokeai/backend/qwen_image_2_1/vae.py+++ b/invokeai/backend/qwen_image_2_1/vae.py@@ -83,8 +83,13 @@ _MAX_TRANSPARENT_FRACTION = 0.001def to_image(decoded: torch.Tensor) -> Image.Image:- """A `(4, H, W)` decode in [-1, 1] as an RGB image when it is opaque, RGBA when it is not."""- pixels = ((decoded.float().clamp(-1, 1) + 1) * 127.5).round().to(torch.uint8).permute(1, 2, 0).cpu().numpy()+ """A `(4, H, W)` decode in [-1, 1] as an RGB image when it is opaque, RGBA when it is not.++ Mapped to [0, 1] in the decode's own dtype and only then widened, as the pipeline's `VaeImageProcessor` does:+ from a bf16 decode, widening first rounds 1 in ~8 % of pixels the other way.+ """+ unit = (decoded * 0.5 + 0.5).clamp(0, 1).float()+ pixels = (unit * 255).round().to(torch.uint8).permute(1, 2, 0).cpu().numpy()alpha = pixels[..., 3]if np.count_nonzero(alpha < _OPAQUE_ALPHA) <= _MAX_TRANSPARENT_FRACTION * alpha.size:return Image.fromarray(np.ascontiguousarray(pixels[..., :3]), mode="RGB")diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.test.tsindex 789d05819c..675c16293e 100644--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts@@ -1035,6 +1035,67 @@ describe('Krea-2, Ideogram 4 and Wan graphs', () => {});});+describe('Qwen-Image-2.1 graphs', () => {+ const qwen21Diffusers: MainModelConfig = {+ base: 'qwen-image-2-1',+ format: 'diffusers',+ key: 'qwen21-diffusers',+ name: 'Qwen-Image-2.1',+ type: 'main',+ variant: 'qwen_image_21_base',+ };+ const qwen21Gguf: MainModelConfig = {+ base: 'qwen-image-2-1',+ format: 'gguf_quantized',+ key: 'qwen21-gguf',+ name: 'Qwen-Image-2.1 Q4_K_M',+ type: 'main',+ variant: 'qwen_image_21_base',+ };+ const qwen21Vae: VaeModelConfig = {+ base: 'qwen-image-2-1',+ key: 'qwen21-vae',+ name: 'Qwen-Image-2.1 VAE',+ type: 'vae',+ };+ const qwen3Vl8bEncoder: ComponentModelConfig = {+ base: 'any',+ key: 'qwen3-vl-8b',+ name: 'Qwen3-VL 8B',+ type: 'qwen3_vl_encoder',+ variant: 'qwen3_vl_8b',+ };++ it('runs the negative prompt only with CFG above 1, wired through its own encoder', () => {+ // Qwen-Image-2.1 is sampled without guidance by default; there the model takes no negative input.+ const withoutCfg = compile(qwen21Diffusers, { cfgScale: 1 });++ expect(withoutCfg.nodes.neg_cond).toBeUndefined();+ expect(getEdge(withoutCfg, 'denoise_latents', 'negative_conditioning')).toBeUndefined();++ const withCfg = compile(qwen21Diffusers, { cfgScale: 4 });++ 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(withCfg.nodes.denoise_latents).toMatchObject({ cfg_scale: 4 });+ });++ it('requires the VAE and the encoder for a GGUF transformer, and passes them to the loader', () => {+ expect(() => compile(qwen21Gguf, { qwen3VLEncoderModel: qwen3Vl8bEncoder })).toThrow(+ 'Generate needs a VAE for non-Diffusers Qwen-Image-2.1 models.'+ );+ expect(() => compile(qwen21Gguf, { vae: qwen21Vae })).toThrow(+ 'Generate needs a Qwen3-VL 8B Encoder for non-Diffusers Qwen-Image-2.1 models.'+ );++ const graph = compile(qwen21Gguf, { qwen3VLEncoderModel: qwen3Vl8bEncoder, vae: qwen21Vae });++ expect(graph.nodes.model_loader).toMatchObject({ qwen3_vl_encoder_model: qwen3Vl8bEncoder, vae_model: qwen21Vae });+ });+});+describe('ERNIE-Image graphs', () => {const ernieModel: MainModelConfig = {base: 'ernie-image',diff --git a/tests/app/invocations/test_qwen_image_2_1_nodes.py b/tests/app/invocations/test_qwen_image_2_1_nodes.pyindex 30f4ebf063..9a4b6a7efd 100644--- a/tests/app/invocations/test_qwen_image_2_1_nodes.py+++ b/tests/app/invocations/test_qwen_image_2_1_nodes.py@@ -7,6 +7,7 @@ an image-to-image run starts on each variant's schedule, and which components thfrom contextlib import contextmanagerfrom types import SimpleNamespace+import numpy as npimport pytestimport torch@@ -153,6 +154,91 @@ 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_a_float32_fallback_reserves_twice_the_bfloat16_activations() -> None:+ estimate = QwenImage21DenoiseInvocation._estimate_working_memory+ base = 1024**3+ bf16 = estimate(4096, 300, 300, True, 2) - base+ assert estimate(4096, 300, 300, True, 4) - base == 2 * bf16+++class _DecodingVAE:+ """A bf16 VAE that records what it decodes and answers with a fixed opaque bf16 decode."""++ dtype = torch.bfloat16+ use_tiling = False+ tile_sample_min_height = tile_sample_min_width = 256+ tile_sample_stride_height = tile_sample_stride_width = 192++ def __init__(self, mean: list[float], std: list[float]) -> None:+ self.config = SimpleNamespace(latents_mean=mean, latents_std=std)+ self.decoded_from: torch.Tensor | None = None+ generator = torch.Generator().manual_seed(1)+ self.decode_output = (torch.rand(1, 4, 1, 64, 64, generator=generator) * 2.4 - 1.2).to(torch.bfloat16)+ self.decode_output[:, 3] = 1.0++ def parameters(self):+ return iter([torch.zeros(1, dtype=torch.bfloat16)])++ def disable_tiling(self) -> None:+ self.use_tiling = False++ def decode(self, z: torch.Tensor, return_dict: bool = False):+ self.decoded_from = z+ return (self.decode_output,)+++def test_a_decode_reads_and_writes_exactly_what_the_pipeline_does() -> None:+ from diffusers.image_processor import VaeImageProcessor++ from invokeai.app.invocations.vae.qwen_image_2_1_latents_to_image import QwenImage21LatentsToImageInvocation++ generator = torch.Generator().manual_seed(0)+ latents = torch.randn(1, LATENT_CHANNELS, 4, 4, generator=generator)+ mean = torch.randn(LATENT_CHANNELS, generator=generator).tolist()+ std = (torch.rand(LATENT_CHANNELS, generator=generator) * 3).tolist()+ vae = _DecodingVAE(mean, std)+ saved: list = []++ @contextmanager+ def on_device(**_kwargs):+ yield None, vae++ def save(image):+ saved.append(image)+ return SimpleNamespace(image_name="out.png", width=image.width, height=image.height)++ context = SimpleNamespace(+ tensors=SimpleNamespace(load=lambda _name: latents),+ images=SimpleNamespace(save=save),+ models=SimpleNamespace(+ load=lambda _identifier: SimpleNamespace(+ compute_device=torch.device("cpu"), model=vae, model_on_device=on_device+ )+ ),+ config=SimpleNamespace(get=lambda: SimpleNamespace(force_tiled_decode=False, auto_tiled_decode=False)),+ util=SimpleNamespace(signal_progress=lambda _message: None),+ )+ node = QwenImage21LatentsToImageInvocation.model_construct(+ latents=LatentsField(latents_name="latents"), vae=SimpleNamespace(vae=None), tiled=False, tile_size=0+ )++ node.invoke(context)++ # In: the pipeline's order -- latents to bf16, the float32 statistics to bf16, the multiply-add in bf16. In+ # float32 first, a bf16 decode reads a different input for most elements.+ bf16_mean = torch.tensor(mean).view(1, -1, 1, 1, 1).to(torch.bfloat16)+ bf16_std = torch.tensor(std).view(1, -1, 1, 1, 1).to(torch.bfloat16)+ expected = latents.to(torch.bfloat16).unsqueeze(2) * bf16_std + bf16_mean+ float32_first = (+ latents.unsqueeze(2) * torch.tensor(std).view(1, -1, 1, 1, 1) + torch.tensor(mean).view(1, -1, 1, 1, 1)+ ).to(torch.bfloat16)+ assert not torch.equal(expected, float32_first)+ assert torch.equal(vae.decoded_from, expected)+ # Out: the pixels diffusers' own post-processing makes of the same bf16 decode.+ pipeline = VaeImageProcessor(vae_scale_factor=16).postprocess(vae.decode_output[:, :, 0], output_type="pil")[0]+ assert np.array_equal(np.asarray(saved[0]), np.asarray(pipeline.convert("RGB")))++def _loader(**fields) -> QwenImage21ModelLoaderInvocation:def ident(key: str, base: BaseModelType, type: ModelType) -> ModelIdentifierField:return ModelIdentifierField(key=key, hash=key, name=key, base=base, type=type)diff --git a/tests/backend/model_manager/configs/test_qwen_image_2_1_config.py b/tests/backend/model_manager/configs/test_qwen_image_2_1_config.pyindex 2b1009e401..b3a3ee5176 100644--- a/tests/backend/model_manager/configs/test_qwen_image_2_1_config.py+++ b/tests/backend/model_manager/configs/test_qwen_image_2_1_config.py@@ -84,6 +84,19 @@ def test_an_nvfp4_file_is_refused_at_install() -> None:_identify(sd, Path("qwen_image_2.1_nvfp4.safetensors"))+def test_a_torchao_file_is_refused_at_install() -> None:+ # unsloth's FP8 build: torchao Float8Tensors, saved as the payload and a per-row scale, no `.weight`.+ layer = "transformer_blocks.0.attn.to_q"+ sd = _transformer(+ **{+ f"{layer}._weight_qdata": torch.zeros(8, 8, dtype=torch.float8_e4m3fn),+ f"{layer}._weight_scale": torch.ones(8, 1),+ }+ )+ with pytest.raises(InvalidMatchError, match="torchao"):+ _identify(sd, Path("Qwen-Image-2.1-FP8.safetensors"))++def _int8_gate_up(marker: dict | None) -> dict[str, Any]:layer = "model.diffusion_model.transformer_blocks.0.img_mlp.gate_up"sd: dict[str, Any] = {diff --git a/tests/backend/qwen_image_2_1/test_vae.py b/tests/backend/qwen_image_2_1/test_vae.pyindex d98082b095..6927099581 100644--- a/tests/backend/qwen_image_2_1/test_vae.py+++ b/tests/backend/qwen_image_2_1/test_vae.py@@ -1,5 +1,6 @@"""Qwen-Image-2.1's RGBA VAE: how a decode becomes an image, what an encode reads, and the tile geometry it runs in."""+import numpy as npimport pytestimport torchfrom diffusers import AutoencoderKLQwenImage21@@ -42,12 +43,15 @@ def test_a_transparent_background_is_kept() -> None:assert image.getpixel((0, 0))[3] == 0 and image.getpixel((63, 0))[3] == 255-def test_values_map_like_the_pipelines_postprocess() -> None:- # (x / 2 + 0.5) * 255, rounded: -1 -> 0, 0 -> 128 (127.5 rounds to even), 1 -> 255.- decoded = torch.tensor([-1.0, 0.0, 1.0]).view(1, 1, 3).expand(4, 1, 3).clone()[email protected]("dtype", [torch.bfloat16, torch.float32])+def test_values_map_exactly_as_the_pipelines_postprocess(dtype: torch.dtype) -> None:+ from diffusers.image_processor import VaeImageProcessor++ generator = torch.Generator().manual_seed(0)+ decoded = (torch.rand(4, 64, 64, generator=generator) * 2.4 - 1.2).to(dtype)decoded[3] = 1.0- image = to_image(decoded)- assert [image.getpixel((x, 0)) for x in range(3)] == [(0, 0, 0), (128, 128, 128), (255, 255, 255)]+ expected = VaeImageProcessor(vae_scale_factor=16).postprocess(decoded[None], output_type="pil")[0]+ assert np.array_equal(np.asarray(to_image(decoded)), np.asarray(expected.convert("RGB")))def test_an_encode_ignores_the_images_alpha() -> None:@@ -108,3 +112,33 @@ def test_nothing_is_tiled_unless_asked_or_too_large(monkeypatch: pytest.MonkeyPadef test_a_tile_size_field_below_the_floor_is_raised_to_it() -> None:assert choose_tile_size(2048, 2048, 2, CPU, tiled=True, tile_size=16, auto_tile=False) == MIN_TILE_SIZEassert choose_tile_size(2048, 2048, 2, CPU, tiled=True, tile_size=768, auto_tile=False) == 768+++ ("precision", "expected"),+ [(torch.float16, torch.bfloat16), (torch.bfloat16, torch.bfloat16), (torch.float32, torch.float32)],+)+def test_the_pipelines_vae_loads_at_the_configured_precision_but_never_float16(+ precision: torch.dtype, expected: torch.dtype, tmp_path, monkeypatch: pytest.MonkeyPatch+) -> None:+ from types import SimpleNamespace++ from invokeai.backend.model_manager.load.model_loaders.qwen_image_2_1 import QwenImage21DiffusersModel+ from invokeai.backend.model_manager.taxonomy import SubModelType++ loaded: dict[str, torch.dtype] = {}++ class _VAE:+ @staticmethod+ def from_pretrained(_path, *, torch_dtype, **_kwargs):+ loaded["dtype"] = torch_dtype+ return torch.nn.Identity()++ loader = object.__new__(QwenImage21DiffusersModel)+ loader._torch_dtype = precision+ loader._torch_device = torch.device("cpu")+ monkeypatch.setattr(loader, "get_hf_load_class", lambda *_args: _VAE)++ loader._load_model(SimpleNamespace(path=str(tmp_path)), SubModelType.VAE)++ assert loaded["dtype"] is expecteddiff --git a/tests/model_identification/stripped_models/ec7a0dd6-8623-4a39-ae9d-5a8eac1ecf3d/scheduler/scheduler_config.json b/tests/model_identification/stripped_models/ec7a0dd6-8623-4a39-ae9d-5a8eac1ecf3d/scheduler/scheduler_config.jsonindex d3d243ccf3..03e9855f9f 100644--- a/tests/model_identification/stripped_models/ec7a0dd6-8623-4a39-ae9d-5a8eac1ecf3d/scheduler/scheduler_config.json+++ b/tests/model_identification/stripped_models/ec7a0dd6-8623-4a39-ae9d-5a8eac1ecf3d/scheduler/scheduler_config.json@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:4b7c9bc1ac2e4bc6fc5d18dff301e0ddd1f96664be2bf320d874945268f2f02b-size 503+oid sha256:16c948c71f9152a34cce6e3a2f309e97ad2dca32beecbe5e2fd3a7925b7eb4bb+size 486