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(backend): reconcile upstream services and model support
joshistoast2da7c31982aa
diff --git a/invokeai/app/invocations/wan_model_loader.py b/invokeai/app/invocations/wan_model_loader.pyindex 7524e4c0ca..1e109d4b74 100644--- a/invokeai/app/invocations/wan_model_loader.py+++ b/invokeai/app/invocations/wan_model_loader.py@@ -129,9 +129,9 @@ class WanModelLoaderInvocation(BaseInvocation):# low-noise expert (A14B only). boundary_ratio comes from the probed# model_index.json.#- # GGUF main: the file itself is one expert (high or low). For A14B,- # the user wires the other expert to transformer_low_noise_model.- # We swap so the *high*-noise expert is always the primary if needed.+ # GGUF main: the file itself is one expert. For A14B, the user wires+ # the other expert to transformer_low_noise_model. The explicit slots+ # define the roles; filename-derived expert tags are advisory only.# boundary_ratio falls back to 0.875 unless a Diffusers component_source# provides a recorded value.boundary_ratio = 0.9 if main_variant == WanVariantType.I2V_A14B else 0.875@@ -172,18 +172,10 @@ class WanModelLoaderInvocation(BaseInvocation):if getattr(low_config, "variant", None) != main_variant:raise ValueError("The high-noise and low-noise GGUF models must use the same Wan variant.")- # The expert tag is a filename heuristic, so 'none' (untagged)- # is common on community finetunes. The wiring itself is- # explicit user intent — main slot = high, low-noise slot =- # low — so an untagged file is taken at its wired position (or- # inferred as the complement of its tagged partner). Only a- # genuine conflict, both files claiming the *same* expert, is- # an error.- if primary_expert == low_expert != "none":- raise ValueError(- f"Both selected GGUF models are tagged as the {primary_expert}-noise expert. "- "A Wan A14B expert pair must contain one high and one low expert."- )+ # Expert tags come from filenames and may be absent or wrong on+ # community models. Explicit graph wiring is authoritative:+ # Transformer is high-noise and Transformer (Low Noise) is+ # low-noise. Tags can only trigger an advisory warning.if primary_expert == "none" and low_expert == "none":context.logger.warning("Neither Wan A14B GGUF filename identifies its expert, so 'Transformer' is assumed to "@@ -191,24 +183,14 @@ class WanModelLoaderInvocation(BaseInvocation):"output looks wrong, swap the two models.")- # Make sure 'transformer' is the high-noise expert and- # 'transformer_low_noise' is the low-noise expert. If the user- # accidentally swapped them, swap back.- if primary_expert == "low" or low_expert == "high":- transformer = low_id- transformer_low_noise = primary_id- # The swap overrides the wiring on the strength of a- # filename tag, so say so: a mistagged file is otherwise an- # invisible expert inversion.+ elif primary_expert == "low" or low_expert == "high" or primary_expert == low_expert:context.logger.warning(- f"The wired Wan A14B GGUF experts look reversed, so they were swapped: "- f"'{low_config.name}' (tagged '{low_expert}') runs as the high-noise expert and "- f"'{main_config.name}' (tagged '{primary_expert}') as the low-noise expert. "- "The tags come from the filenames — if the output looks wrong, a filename is lying."+ "The Wan A14B GGUF filename tags disagree with the explicit transformer wiring. "+ "The wiring is authoritative: 'Transformer' runs as the high-noise expert and "+ "'Transformer (Low Noise)' runs as the low-noise expert.")- else:- transformer = primary_id- transformer_low_noise = low_id+ transformer = primary_id+ transformer_low_noise = low_idelse:transformer = primary_id# A14B without a paired low-noise GGUF will produce degradeddiff --git a/tests/app/invocations/test_wan_model_loader.py b/tests/app/invocations/test_wan_model_loader.pyindex 93442b265b..0a120af301 100644--- a/tests/app/invocations/test_wan_model_loader.py+++ b/tests/app/invocations/test_wan_model_loader.py@@ -92,18 +92,22 @@ def _warnings(context: MagicMock) -> list[str]:@pytest.mark.parametrize("variant", [WanVariantType.T2V_A14B, WanVariantType.I2V_A14B])[email protected]("main_expert,low_expert", [("high", "low"), ("low", "high")])-def test_gguf_loader_accepts_valid_expert_pair_in_either_order(+ "main_expert,low_expert",+ [("high", "low"), ("low", "high"), ("high", "high"), ("low", "low"), ("none", "none")],+)+def test_gguf_loader_preserves_explicit_slot_wiring_regardless_of_filename_tags(variant: WanVariantType, main_expert: str, low_expert: str) -> None:+ """Filename-derived expert tags are advisory; explicit graph wiring defines the roles."""output = _invoke(_config("main", variant, main_expert),_config("low", variant, low_expert),)- assert output.transformer.transformer.key == ("main" if main_expert == "high" else "low")+ assert output.transformer.transformer.key == "main"assert output.transformer.transformer_low_noise is not None- assert output.transformer.transformer_low_noise.key == ("low" if low_expert == "low" else "main")+ assert output.transformer.transformer_low_noise.key == "low"@pytest.mark.parametrize(@@ -113,46 +117,37 @@ def test_gguf_loader_accepts_valid_expert_pair_in_either_order(_config("main", WanVariantType.T2V_A14B, "high"),_config("low", WanVariantType.I2V_A14B, "low"),),- (- _config("main", WanVariantType.T2V_A14B, "high"),- _config("low", WanVariantType.T2V_A14B, "high"),- ),- (- _config("main", WanVariantType.T2V_A14B, "low"),- _config("low", WanVariantType.T2V_A14B, "low"),- ),],)-def test_gguf_loader_rejects_invalid_expert_pair(main_config: SimpleNamespace, low_config: SimpleNamespace) -> None:- with pytest.raises(ValueError, match="expert|variant"):+def test_gguf_loader_rejects_mismatched_expert_variants(+ main_config: SimpleNamespace, low_config: SimpleNamespace+) -> None:+ with pytest.raises(ValueError, match="variant"):_invoke(main_config, low_config)@pytest.mark.parametrize(- "main_expert,low_expert,expected_high_key",+ "main_expert,low_expert",[# The expert tag comes from a filename heuristic, so untagged community- # finetunes are common. The wiring is explicit intent: take the untagged- # file at its wired position, or as the complement of a tagged partner.- ("none", "none", "main"),- ("high", "none", "main"),- ("none", "low", "main"),- ("none", "high", "low"),- ("low", "none", "low"),+ # finetunes are common. The explicit slot wiring remains authoritative+ # whether one, both, or neither filename supplies an expert hint.+ ("none", "none"),+ ("high", "none"),+ ("none", "low"),+ ("none", "high"),+ ("low", "none"),],)-def test_gguf_loader_falls_back_to_wiring_for_untagged_experts(- main_expert: str, low_expert: str, expected_high_key: str-) -> None:+def test_gguf_loader_uses_wiring_for_untagged_experts(main_expert: str, low_expert: str) -> None:output = _invoke(_config("main", WanVariantType.I2V_A14B, main_expert),_config("low", WanVariantType.I2V_A14B, low_expert),)- expected_low_key = "low" if expected_high_key == "main" else "main"- assert output.transformer.transformer.key == expected_high_key+ assert output.transformer.transformer.key == "main"assert output.transformer.transformer_low_noise is not None- assert output.transformer.transformer_low_noise.key == expected_low_key+ assert output.transformer.transformer_low_noise.key == "low"@pytest.mark.parametrize("low_variant", [WanVariantType.TI2V_5B, WanVariantType.T2V_A14B])@@ -196,17 +191,18 @@ def test_gguf_loader_rejects_the_same_model_in_both_transformer_slots() -> None:@pytest.mark.parametrize("main_expert,low_expert", [("low", "high"), ("low", "none"), ("none", "high")])-def test_gguf_loader_warns_when_it_swaps_the_wired_experts(main_expert: str, low_expert: str) -> None:- """The swap overrides explicit wiring on the strength of a filename tag, so a mistagged- file must not invert the two experts silently."""+def test_gguf_loader_warns_when_filename_tags_disagree_with_wiring(main_expert: str, low_expert: str) -> None:+ """A suspicious filename can produce a warning, but must not override explicit wiring."""invocation, context = _prepare(_config("main", WanVariantType.I2V_A14B, main_expert),_config("low", WanVariantType.I2V_A14B, low_expert),)output = invocation.invoke(context)- assert output.transformer.transformer.key == "low"- assert any("swapped" in warning for warning in _warnings(context))+ assert output.transformer.transformer.key == "main"+ assert output.transformer.transformer_low_noise is not None+ assert output.transformer.transformer_low_noise.key == "low"+ assert any("wiring" in warning.lower() for warning in _warnings(context))@pytest.mark.parametrize("main_expert,low_expert", [("high", "low"), ("high", "none"), ("none", "low")])