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
feat: Adding Support for SD.Next Quantization Engine (SDNQ) (Flux1&Flux2klein4B/9B&Z-Image) (#9228)
Alexander Eichhornf21bf4f3426e
diff --git a/docs/src/content/docs/configuration/fp8-storage.mdx b/docs/src/content/docs/configuration/fp8-storage.mdxindex 799821b079..29b6ae95f3 100644--- a/docs/src/content/docs/configuration/fp8-storage.mdx+++ b/docs/src/content/docs/configuration/fp8-storage.mdx@@ -11,7 +11,7 @@ FP8 Storage cuts a model's VRAM footprint roughly in half by keeping weights onIt pairs well with [Low-VRAM mode](/configuration/low-vram-mode/): low-VRAM mode streams layers between RAM and VRAM, while FP8 Storage shrinks the layers themselves.:::caution[For full precision models only]-FP8 Storage only applies to **full precision** checkpoints (FP16 / BF16 / FP32). It is **silently a no-op** for already-quantized formats — **GGUF**, **NF4**, and **int8** checkpoints carry their own storage precision and the loader returns a different module type that the FP8 layer cast does not touch. If your model is already quantized, the toggle has no effect; use the full-precision variant of the model if you want to enable FP8 Storage.+FP8 Storage only applies to **full precision** checkpoints (FP16 / BF16 / FP32). It is **silently a no-op** for already-quantized formats — **GGUF**, **NF4**, **int8**, and [**SDNQ**](/configuration/sdnq-quantization/) checkpoints carry their own storage precision and the loader returns a different module type that the FP8 layer cast does not touch. If your model is already quantized, the toggle has no effect; use the full-precision variant of the model if you want to enable FP8 Storage.:::## Requirementsdiff --git a/docs/src/content/docs/configuration/sdnq-quantization.mdx b/docs/src/content/docs/configuration/sdnq-quantization.mdxnew file mode 100644index 0000000000..ff19ee14e8--- /dev/null+++ b/docs/src/content/docs/configuration/sdnq-quantization.mdx@@ -0,0 +1,156 @@+---+title: SDNQ Quantization+sidebar:+ order: 4+---++import { Steps } from '@astrojs/starlight/components';++SDNQ ([SD.Next Quantization Engine](https://github.com/Disty0/sdnq)) is a quantization scheme that stores model weights at 4–5 bits with an optional low-rank SVD correction. InvokeAI loads SDNQ-quantized models as full HuggingFace diffusers pipelines and dequantizes weights on the fly during inference, with no extra Python package required.++## Supported models++| Model family | Status | Format(s) supported |+| ------------------ | ------ | ---------------------------------------------------- |+| **FLUX.1 schnell / dev** | ✅ | Diffusers pipeline (uint4 + SVD), single-file |+| **FLUX.2 Klein 4B / 9B** | ✅ | Diffusers pipeline (uint4 / int5 mixed, ± SVD), single-file |+| **Z-Image Turbo** | ✅ | Diffusers pipeline (uint4 + SVD), single-file |+| **T5 Encoder** | ✅ | Folder + standalone |+| **Qwen3 Encoder** | ✅ | Folder + standalone |+| **VAE (AutoencoderKL)** | ✅ | Folder |+| **SDXL / SD1 / SD2** | ❌ | Not yet — UNet pipeline conversion outstanding |++:::caution[SDNQ vs SVDQuant / Nunchaku]+SDNQ ("SD.Next Quantization") and SVDQuant ("[Nunchaku](https://github.com/nunchaku-ai/nunchaku)") both apply SVD low-rank correction to 4-bit weights, but they use **different on-disk formats** and **different inference engines**. A file like `svdq-int4-flux.1-schnell.safetensors` from `mit-han-lab` is a Nunchaku checkpoint and will *not* load through InvokeAI's SDNQ path — it has keys like `qweight`, `wscales`, `smooth`, `lora_up` rather than SDNQ's `weight`, `scale`, `zero_point`, `svd_up`. Look for the `Disty0/...-SDNQ-...` repo prefix on HuggingFace to be sure you're picking up the right format.+:::++## Memory footprint++Typical reductions vs. the bfloat16 baseline:++| Model | bfloat16 | SDNQ uint4 + SVD | Approx. VRAM at inference |+| --------------------------- | -------- | ---------------- | ------------------------- |+| FLUX.1 schnell | ~33 GB | ~15 GB | ~12 GB |+| FLUX.2 Klein 4B (dynamic) | ~8 GB | ~5 GB | ~5 GB |+| FLUX.2 Klein 9B (dynamic + SVD) | ~18 GB | ~13 GB | ~11 GB |+| Z-Image Turbo | ~12 GB | ~5 GB | ~5 GB |++The actual peak VRAM depends on resolution, batch size, attention backend, and whether [Low-VRAM mode](/configuration/low-vram-mode/) is enabled.++## Installing SDNQ models++The easiest way is via the **Starter Models** picker — search for "SDNQ":++<Steps>+1. Open the **Model Manager** → **Starter Models** tab.+2. Search for `SDNQ`.+3. Click **Install** on the variant you want (each entry shows the HuggingFace source).+</Steps>++To install a different SDNQ model from HuggingFace:++<Steps>+1. Open the **Model Manager** → **Add Model** → **HuggingFace** tab.+2. Enter the repo, e.g. `Disty0/FLUX.2-klein-9B-SDNQ-4bit-dynamic-svd-r32`.+3. Click **Install**. The whole pipeline folder downloads (transformer + text encoder + tokenizer + VAE).+</Steps>++:::tip+For very large SDNQ models, you can also pre-download with `huggingface-cli` and then point InvokeAI at the local folder via **Add Model** → **Folder**.+:::++InvokeAI auto-detects the SDNQ format from `transformer/quantization_config.json` (the `quant_method: "sdnq"` marker). Exports that ship no marker are still recognized, by the shape of the weights themselves — an SDNQ tensor stores a `<name>.weight` alongside a matching `<name>.scale`, and the pair is found even when sharding puts the two in different files. The Model Manager shows the format as **sdnq** in the model badge once installed.++The transformer also has to hold weights the SDNQ reader can actually open (`.safetensors`). A folder with a config and a marker but no readable weight file is rejected at install rather than accepted and then failing on the first generation.++## What gets quantized++Inside a typical SDNQ pipeline folder:++- **`transformer/`** — diffusion transformer weights (most of the savings come from here). Quantized to uint4 or, for dynamic-mixed exports, a per-layer mix of uint4 and int5.+- **`text_encoder/`** — for FLUX.1 this is T5 + CLIP (T5 is SDNQ'd, CLIP stays full precision); for FLUX.2 Klein and Z-Image, Qwen3 is SDNQ'd.+- **`vae/`** — left as bfloat16 in current Disty0 exports (the VAE is small enough that quantizing it isn't worth the quality risk).++Layers in the producer's `modules_to_not_convert` list (typically embeddings, final projection, layer norms) stay full precision in all cases.++## LoRA compatibility++LoRAs apply to SDNQ-quantized models via the **sidecar patching path**: instead of merging the LoRA delta into the quantized weight, InvokeAI keeps the LoRA as a separate residual that runs alongside each forward pass.++- ✅ Standard LoRA, LoKr, DoRA, FluxControl-LoRA, FullLayer patches all work.+- ⚠️ Inference is slightly slower per step than non-quantized LoRA application (the sidecar adds an extra matmul per patched layer), but the loss is small in practice.+- ❌ LoRA training against SDNQ-quantized weights is **not supported**.++If you stack many LoRAs on a heavily quantized model and notice quality drift, try lowering individual LoRA weights — the 4-bit base already eats some headroom for cumulative perturbations.++## Quality trade-offs++The dynamic mixed-precision FLUX.2 Klein exports (`Disty0/FLUX.2-klein-{4B,9B}-SDNQ-4bit-dynamic-...`) let SDNQ promote individual layers from uint4 to int5 if the layer's quantization error exceeds a per-group budget. In practice this keeps the most sensitive attention projections at int5 while everything else stays uint4, with no user-visible quality regression vs. bfloat16 in most prompts.++The static uint4 + SVD exports (`...-SDNQ-uint4-svd-r32`) are slightly more aggressive but use rank-32 SVD residuals to recover the lost precision. The SVD correction adds ~3 % of the original weight size back to the file but largely closes the quality gap.++You will most likely see SDNQ-specific quality issues at:++- **Very high CFG values** (> 8) on Klein 4B dynamic — the 4-bit attention saturates faster than bfloat16.+- **Long generations with heavy LoRA stacks** — cumulative quantization noise becomes visible after dozens of steps.++If you need higher quality and have the VRAM, the static `Disty0/FLUX.2-klein-9B-SDNQ-uint4-svd-r32` (FLUX.2 Klein 9B) is the most faithful SDNQ option InvokeAI currently supports. Only the FLUX.2 Klein 4B / 9B variants are supported — FLUX.2 dev is not yet implemented, so FLUX.2-dev SDNQ exports cannot be installed correctly.++## Comparison with other quantization formats++| Format | Size | VRAM at inference | LoRA support | Loading path |+| ----------------- | ----- | ----------------- | ------------ | ---------------------------------------- |+| **SDNQ uint4 + SVD** | ~50 % | ~50 % | ✅ sidecar | Full diffusers pipeline |+| **GGUF Q4_K_M** | ~30 % | ~30 % | ✅ sidecar | Single-file transformer + separate encoders/VAE |+| **BnB NF4** | ~50 % | ~50 % | ✅ sidecar | Single-file transformer + separate encoders/VAE |+| **FP8 storage** | ~50 % | ~50 % | ✅ direct | Any full-precision model (toggle in Model Manager) |++The headline differences:++- **SDNQ models are pipeline-shaped**: one install pulls everything you need (transformer + encoders + VAE). GGUF and BnB usually need you to also install a T5 / Qwen3 / VAE separately.+- **SDNQ has the cleanest dynamic-precision story**: GGUF picks one bit-width per file; SDNQ dynamic-mixed exports tune precision per layer.+- **GGUF is more memory-efficient** at the same nominal bit-width because it uses smaller groups. SDNQ trades that for the SVD correction option.++For low VRAM (~6–8 GB), GGUF Q4 is still the best fit. For 12–16 GB cards that can host a FLUX-class model, SDNQ is the simplest "install one thing, get a working pipeline" option.++## Using a pipeline without standalone components++A complete SDNQ pipeline supplies its own encoders and VAE, so you can leave the standalone model+pickers empty — the **T5 Encoder**, **CLIP Embed** and **VAE** fields for FLUX.1, and the equivalent+fields for FLUX.2 Klein and Z-Image. Select the pipeline as your main model and generate; Invoke+resolves each component from the install.++"Complete" means the install actually ships every component, not that its `model_index.json`+advertises them. Invoke checks each component folder at install time and records only the ones that+are really there, hold weights their loader can read, and whose own config declares the class the+index claims. So a partial or interrupted download is *not* treated as self-contained, and the+standalone pickers stay required — which is the behaviour you want, because the alternative is a+failure at generation time.++If you do select a standalone component, it wins over the bundled one. That is the way to override,+for example, an SDNQ pipeline's VAE with a full-precision one.++Models that are not pipeline-shaped — single-file SDNQ checkpoints, GGUF, BnB — have nothing to+resolve from and still require the standalone selections. Invoke names every missing component at+once rather than reporting them one at a time.++## Troubleshooting++### "Non-diffusers FLUX.2 Klein models require a standalone Qwen3 Encoder" (Invoke button greyed out)++The Klein SDNQ pipeline carries its own Qwen3 encoder, so this readiness gate shouldn't fire — if it does, the install most likely happened before SDNQ-pipeline support was wired up and the model is cached with the wrong format in the database. Delete the model from the Model Manager and re-install it; the second install will pick up the correct `sdnq_quantized` format with the submodels populated.++### Heavy high-frequency noise overlay on output++If the structure of your image is recognizable (rough subject + composition) but a colored static is layered over it, you've hit a quantization-loader bug. Open an issue with:++- The exact HuggingFace repo of the model.+- A side-by-side with a non-SDNQ variant of the same prompt (e.g. compare against GGUF Q4 of the same base model).++Historically this has been caused by missing key-permutation steps in the diffusers→BFL state-dict conversion (e.g. `scale`/`shift` halves swapped). It's not a sign that the file itself is broken.++### "no safetensors files found" or "size mismatch for weight"++You probably pointed InvokeAI at the wrong subfolder — SDNQ pipelines are installed as the **whole repo root** (the folder that contains `model_index.json`), not at `transformer/` directly. The Model Manager's "Add Folder" flow expects the pipeline root.++If the path is right, check that the quantized components actually ship `.safetensors`: Invoke's SDNQ reader only reads that format, so a `transformer/` or `text_encoder/` holding `.bin` or `.gguf` weights is not counted as present and the pipeline is reported as incomplete. Published SDNQ repos ship safetensors throughout; this normally only shows up on a hand-converted model.diff --git a/invokeai/app/invocations/flux2_denoise.py b/invokeai/app/invocations/flux2_denoise.pyindex 260fc535de..7a5ce158c9 100644--- a/invokeai/app/invocations/flux2_denoise.py+++ b/invokeai/app/invocations/flux2_denoise.py@@ -472,6 +472,7 @@ class Flux2DenoiseInvocation(BaseInvocation):ModelFormat.BnbQuantizedLlmInt8b,ModelFormat.BnbQuantizednf4b,ModelFormat.GGUFQuantized,+ ModelFormat.SDNQQuantized,]:model_is_quantized = Trueelse:diff --git a/invokeai/app/invocations/flux2_klein_model_loader.py b/invokeai/app/invocations/flux2_klein_model_loader.pyindex bb8d41b9df..3cb8363146 100644--- a/invokeai/app/invocations/flux2_klein_model_loader.py+++ b/invokeai/app/invocations/flux2_klein_model_loader.py@@ -19,6 +19,7 @@ from invokeai.app.invocations.model import (Qwen3EncoderField,TransformerField,VAEField,+ is_self_contained_sdnq_pipeline,)from invokeai.app.services.shared.invocation_context import InvocationContextfrom invokeai.backend.model_manager.configs.factory import AnyModelConfig@@ -63,7 +64,10 @@ class Flux2KleinModelLoaderOutput(BaseInvocationOutput):title="Main Model - Flux2 Klein",tags=["model", "flux", "klein", "qwen3"],category="model",- version="1.0.0",+ # 1.1.0: the Qwen3 Source input dropped its `ui_model_format=Diffusers` pin so SDNQ pipelines are+ # offered too, and the loader falls back to a self-contained main model for VAE / Qwen3. A node+ # serialized against 1.0.0 carries the old field contract, so the version has to move with it.+ version="1.1.0",classification=Classification.Prototype,)class Flux2KleinModelLoaderInvocation(BaseInvocation):@@ -108,14 +112,13 @@ class Flux2KleinModelLoaderInvocation(BaseInvocation):qwen3_source_model: Optional[ModelIdentifierField] = InputField(default=None,- description="Diffusers Flux2 Klein model to extract VAE and/or Qwen3 encoder from. "- "Use this if you don't have separate VAE/Qwen3 models. "+ description="Diffusers or SDNQ-pipeline Flux2 Klein model to extract VAE and/or Qwen3 "+ "encoder from. Use this if you don't have separate VAE/Qwen3 models. ""Ignored if both VAE and Qwen3 Encoder are provided separately.",input=Input.Direct,ui_model_base=BaseModelType.Flux2,ui_model_type=ModelType.Main,- ui_model_format=ModelFormat.Diffusers,- title="Qwen3 Source (Diffusers)",+ title="Qwen3 Source",)max_seq_len: Literal[256, 512] = InputField(@@ -128,9 +131,14 @@ class Flux2KleinModelLoaderInvocation(BaseInvocation):# Transformer always comes from the main modeltransformer = self.model.model_copy(update={"submodel_type": SubModelType.Transformer})- # Check if main model is Diffusers format (can extract VAE directly)+ # Check if main model is a pipeline-shaped config we can extract submodels from.+ # Plain diffusers pipelines satisfy this; so do SDNQ-quantized pipeline folders — but only+ # when they actually ship the VAE + Qwen3 (text_encoder + tokenizer) submodels. A partial+ # SDNQ pipeline exposing only the transformer must fall through to the standalone-encoder+ # branch, otherwise the loader would later request those submodels against fixed subfolders+ # that don't exist. Single-file SDNQ/GGUF checkpoints have no submodels and also fall through.main_config = context.models.get_config(self.model)- main_is_diffusers = main_config.format == ModelFormat.Diffusers+ main_is_diffusers = main_config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(main_config)# Determine VAE source# IMPORTANT: FLUX.2 Klein uses a 32-channel VAE (AutoencoderKLFlux2), not the 16-channel FLUX.1 VAE.@@ -187,20 +195,24 @@ class Flux2KleinModelLoaderInvocation(BaseInvocation):def _validate_diffusers_format(self, context: InvocationContext, model: ModelIdentifierField, model_name: str) -> AnyModelConfig:- """Validate that a model is a Diffusers-format pipeline and return its config.+ """Validate that a model exposes the diffusers-style submodel layout and return its config.Deliberately format-only, because this also gates the VAE-extraction path: the 32-channel``AutoencoderKLFlux2`` is shared between Klein and [dev], and the linear UI relies on that(``buildFLUXGraph`` falls back to *any* FLUX.2 diffusers pipeline when only the VAE isneeded). Variant gating belongs to the encoder path only — see ``_validate_encoder_source``.++ Plain diffusers pipelines qualify, as do SDNQ-quantized pipeline folders that ship the VAE ++ Qwen3 submodels; single-file SDNQ FLUX.2 checkpoints and partial pipelines (missing VAE /+ Qwen3 submodels) are rejected."""config = context.models.get_config(model)- if config.format != ModelFormat.Diffusers:- raise ValueError(- f"The {model_name} model must be a Diffusers format model. "- f"The selected model '{config.name}' is in {config.format.value} format."- )- return config+ if config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(config):+ return config+ raise ValueError(+ f"The {model_name} model must be a Diffusers-style FLUX.2 pipeline (with VAE / Qwen3 "+ f"submodels). The selected model '{config.name}' is in {config.format.value} format."+ )def _validate_encoder_source(self,diff --git a/invokeai/app/invocations/flux_denoise.py b/invokeai/app/invocations/flux_denoise.pyindex 07fb84b7cc..3f1c0682ea 100644--- a/invokeai/app/invocations/flux_denoise.py+++ b/invokeai/app/invocations/flux_denoise.py@@ -440,6 +440,7 @@ class FluxDenoiseInvocation(BaseInvocation):ModelFormat.BnbQuantizedLlmInt8b,ModelFormat.BnbQuantizednf4b,ModelFormat.GGUFQuantized,+ ModelFormat.SDNQQuantized,]:model_is_quantized = Trueelse:diff --git a/invokeai/app/invocations/flux_model_loader.py b/invokeai/app/invocations/flux_model_loader.pyindex c175ae7fed..df4be38173 100644--- a/invokeai/app/invocations/flux_model_loader.py+++ b/invokeai/app/invocations/flux_model_loader.py@@ -7,7 +7,14 @@ from invokeai.app.invocations.baseinvocation import (invocation_output,)from invokeai.app.invocations.fields import FieldDescriptions, InputField, OutputField-from invokeai.app.invocations.model import CLIPField, ModelIdentifierField, T5EncoderField, TransformerField, VAEField+from invokeai.app.invocations.model import (+ CLIPField,+ ModelIdentifierField,+ T5EncoderField,+ TransformerField,+ VAEField,+ is_self_contained_sdnq_flux1_pipeline,+)from invokeai.app.services.shared.invocation_context import InvocationContextfrom invokeai.app.util.t5_model_identifier import (preprocess_t5_encoder_model_identifier,@@ -15,6 +22,7 @@ from invokeai.app.util.t5_model_identifier import ()from invokeai.backend.flux.util import get_flux_max_seq_lengthfrom invokeai.backend.model_manager.configs.base import Checkpoint_Config_Base+from invokeai.backend.model_manager.configs.main import Main_SDNQ_Diffusers_FLUX_Configfrom invokeai.backend.model_manager.taxonomy import BaseModelType, ModelType, SubModelType@@ -37,7 +45,7 @@ class FluxModelLoaderOutput(BaseInvocationOutput):title="Main Model - FLUX",tags=["model", "flux"],category="model",- version="1.0.7",+ version="1.1.0",)class FluxModelLoaderInvocation(BaseInvocation):"""Loads a flux base model, outputting its submodels."""@@ -48,19 +56,26 @@ class FluxModelLoaderInvocation(BaseInvocation):ui_model_type=ModelType.Main,)- t5_encoder_model: ModelIdentifierField = InputField(+ # The three component inputs are optional: an SDNQ pipeline install ships its own T5, CLIP and+ # VAE, which is what the SDNQ docs promise ("one install pulls everything you need"). Requiring+ # them anyway forced users to install duplicates of components they already had. Single-file /+ # GGUF / BnB models still need them, and are told so explicitly below.+ t5_encoder_model: ModelIdentifierField | None = InputField(+ default=None,description=FieldDescriptions.t5_encoder,title="T5 Encoder",ui_model_type=ModelType.T5Encoder,)- clip_embed_model: ModelIdentifierField = InputField(+ clip_embed_model: ModelIdentifierField | None = InputField(+ default=None,description=FieldDescriptions.clip_embed_model,title="CLIP Embed",ui_model_type=ModelType.CLIPEmbed,)- vae_model: ModelIdentifierField = InputField(+ vae_model: ModelIdentifierField | None = InputField(+ default=None,description=FieldDescriptions.vae_model,title="VAE",ui_model_base=BaseModelType.Flux,@@ -68,21 +83,55 @@ class FluxModelLoaderInvocation(BaseInvocation):)def invoke(self, context: InvocationContext) -> FluxModelLoaderOutput:- for key in [self.model.key, self.t5_encoder_model.key, self.clip_embed_model.key, self.vae_model.key]:+ keys = [self.model.key] + [+ m.key for m in (self.t5_encoder_model, self.clip_embed_model, self.vae_model) if m is not None+ ]+ for key in keys:if not context.models.exists(key):raise ValueError(f"Unknown model: {key}")- transformer = self.model.model_copy(update={"submodel_type": SubModelType.Transformer})- vae = self.vae_model.model_copy(update={"submodel_type": SubModelType.VAE})-- tokenizer = self.clip_embed_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})- clip_encoder = self.clip_embed_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})+ main_config = context.models.get_config(self.model)+ self_contained = is_self_contained_sdnq_flux1_pipeline(main_config)++ def resolve(selected: ModelIdentifierField | None) -> ModelIdentifierField | None:+ """Explicit selection wins; otherwise the main model supplies the part if it can."""+ if selected is not None:+ return selected+ return self.model if self_contained else None++ t5_source = resolve(self.t5_encoder_model)+ clip_source = resolve(self.clip_embed_model)+ vae_source = resolve(self.vae_model)++ missing = [+ title+ for title, source in (("T5 Encoder", t5_source), ("CLIP Embed", clip_source), ("VAE", vae_source))+ if source is None+ ]+ if missing:+ raise ValueError(+ f"The selected FLUX model does not ship its own {', '.join(missing)}, so "+ f"{'it' if len(missing) == 1 else 'they'} must be selected explicitly. Only a complete "+ "SDNQ pipeline install (transformer + CLIP + T5 + VAE) can supply these itself."+ )- tokenizer2 = preprocess_t5_tokenizer_model_identifier(self.t5_encoder_model)- t5_encoder = preprocess_t5_encoder_model_identifier(self.t5_encoder_model)-- transformer_config = context.models.get_config(transformer)- assert isinstance(transformer_config, Checkpoint_Config_Base)+ transformer = self.model.model_copy(update={"submodel_type": SubModelType.Transformer})+ vae = vae_source.model_copy(update={"submodel_type": SubModelType.VAE})++ tokenizer = clip_source.model_copy(update={"submodel_type": SubModelType.Tokenizer})+ clip_encoder = clip_source.model_copy(update={"submodel_type": SubModelType.TextEncoder})++ if t5_source is self.model:+ # The pipeline's own T5 lives in the slots discovery recorded, not behind the standalone+ # T5 bundle layouts `preprocess_t5_*` exists to normalize.+ tokenizer2 = t5_source.model_copy(update={"submodel_type": SubModelType.Tokenizer2})+ t5_encoder = t5_source.model_copy(update={"submodel_type": SubModelType.TextEncoder2})+ else:+ tokenizer2 = preprocess_t5_tokenizer_model_identifier(t5_source)+ t5_encoder = preprocess_t5_encoder_model_identifier(t5_source)++ transformer_config = main_config+ assert isinstance(transformer_config, (Checkpoint_Config_Base, Main_SDNQ_Diffusers_FLUX_Config))return FluxModelLoaderOutput(transformer=TransformerField(transformer=transformer, loras=[]),diff --git a/invokeai/app/invocations/flux_text_encoder.py b/invokeai/app/invocations/flux_text_encoder.pyindex 0c5a38d58c..3572106bf3 100644--- a/invokeai/app/invocations/flux_text_encoder.py+++ b/invokeai/app/invocations/flux_text_encoder.py@@ -98,6 +98,7 @@ class FluxTextEncoderInvocation(BaseInvocation):ModelFormat.BnbQuantizedLlmInt8b,ModelFormat.BnbQuantizednf4b,ModelFormat.GGUFQuantized,+ ModelFormat.SDNQQuantized,]:model_is_quantized = Trueelse:@@ -157,6 +158,18 @@ class FluxTextEncoderInvocation(BaseInvocation):cached_weights=cached_weights,))+ elif clip_text_encoder_config.format in [ModelFormat.SDNQQuantized]:+ # SDNQ-quantized CLIP - apply LoRA as sidecar layers+ exit_stack.enter_context(+ LayerPatcher.apply_smart_model_patches(+ model=clip_text_encoder,+ patches=self._clip_lora_iterator(context),+ prefix=FLUX_LORA_CLIP_PREFIX,+ dtype=clip_text_encoder.dtype,+ cached_weights=cached_weights,+ force_sidecar_patching=True,+ )+ )else:# There are currently no supported CLIP quantized models. Add support here if needed.raise ValueError(f"Unsupported model format: {clip_text_encoder_config.format}")diff --git a/invokeai/app/invocations/flux_vae_decode.py b/invokeai/app/invocations/flux_vae_decode.pyindex f81e7cd715..8caa372847 100644--- a/invokeai/app/invocations/flux_vae_decode.py+++ b/invokeai/app/invocations/flux_vae_decode.py@@ -1,4 +1,5 @@import torch+from diffusers.models.autoencoders.autoencoder_kl import AutoencoderKLfrom einops import rearrangefrom PIL import Image@@ -40,18 +41,41 @@ class FluxVaeDecodeInvocation(BaseInvocation, WithMetadata, WithBoard):)def _vae_decode(self, vae_info: LoadedModel, latents: torch.Tensor) -> Image.Image:- assert isinstance(vae_info.model, AutoEncoder)- estimated_working_memory = estimate_vae_working_memory_flux(- operation="decode", image_tensor=latents, vae=vae_info.model- )+ assert isinstance(vae_info.model, (AutoEncoder, AutoencoderKL))++ # Only estimate working memory for BFL AutoEncoder (diffusers VAE handles this internally)+ if isinstance(vae_info.model, AutoEncoder):+ estimated_working_memory = estimate_vae_working_memory_flux(+ operation="decode", image_tensor=latents, vae=vae_info.model+ )+ else:+ estimated_working_memory = 0+with vae_info.model_on_device(working_mem_bytes=estimated_working_memory) as (_, vae):- assert isinstance(vae, AutoEncoder)+ assert isinstance(vae, (AutoEncoder, AutoencoderKL))vae_dtype = next(iter(vae.parameters())).dtype# Use the VAE's intended compute device (CUDA/MPS, or CPU if configured cpu_only). Do NOT infer it from# current param residency: partial loading may have temporarily offloaded all weights to RAM, which would# wrongly place the latents (and thus the whole decode) on the CPU (see #9373).latents = latents.to(device=vae_info.compute_device, dtype=vae_dtype)- img = vae.decode(latents)++ if isinstance(vae, AutoEncoder):+ # BFL AutoEncoder returns tensor directly+ img = vae.decode(latents)+ else:+ # Diffusers AutoencoderKL returns DecoderOutput with .sample attribute+ # Scale latents for diffusers VAE (FLUX uses shift_factor and scale_factor).+ # `shift_factor` is optional on AutoencoderKL: the FLUX VAE sets one, but a plain+ # SD-style config leaves it None, and `tensor + None` raises TypeError. Absent means+ # no shift — same handling as the Z-Image and PiD decode paths.+ scaling_factor = vae.config.scaling_factor+ shift_factor = getattr(vae.config, "shift_factor", None)++ latents = latents / scaling_factor+ if shift_factor is not None:+ latents = latents + shift_factor++ img = vae.decode(latents, return_dict=False)[0]img = img.clamp(-1, 1)img = rearrange(img[0], "c h w -> h w c") # noqa: F821diff --git a/invokeai/app/invocations/model.py b/invokeai/app/invocations/model.pyindex a1b8d1c5a9..394d1ff015 100644--- a/invokeai/app/invocations/model.py+++ b/invokeai/app/invocations/model.py@@ -13,7 +13,48 @@ from invokeai.app.invocations.fields import FieldDescriptions, ImageField, Inputfrom invokeai.app.services.shared.invocation_context import InvocationContextfrom invokeai.app.shared.models import FreeUConfigfrom invokeai.backend.model_manager.configs.factory import AnyModelConfig-from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelType, SubModelType+from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, SubModelType++# An SDNQ-quantized pipeline install (Z-Image / FLUX.2 Klein) is only self-contained when it ships+# every component its loader reads from a fixed subfolder: the transformer, the VAE and the Qwen3+# encoder (text_encoder + tokenizer). A truthy `submodels` dict is not sufficient — Main_SDNQ_Diffusers_*+# configs record whichever submodels they recognize from model_index.json, so a partial (or+# partially recognized) pipeline can expose only the transformer, and a malformed index can advertise+# the components while omitting the transformer every loader requests. Treating either as+# self-contained moves the failure from readiness/model-loader validation to runtime submodel loading.+_REQUIRED_PIPELINE_SUBMODELS = frozenset(+ {SubModelType.Transformer, SubModelType.VAE, SubModelType.TextEncoder, SubModelType.Tokenizer}+)+++def is_self_contained_sdnq_pipeline(config: AnyModelConfig) -> bool:+ """True if `config` is an SDNQ pipeline that ships its own transformer, VAE and Qwen3+ (text_encoder + tokenizer) submodels, so a single install can supply every component. Returns+ False for single-file / GGUF models and for partial pipelines missing any required submodel."""+ if getattr(config, "format", None) != ModelFormat.SDNQQuantized:+ return False+ submodels = getattr(config, "submodels", None) or {}+ return _REQUIRED_PIPELINE_SUBMODELS.issubset(submodels.keys())+++# FLUX.1 needs two text encoders, so its pipelines must additionally ship the T5 pair on top of the+# CLIP one above. A FLUX.2 / Z-Image pipeline is complete without them.+_REQUIRED_FLUX1_PIPELINE_SUBMODELS = _REQUIRED_PIPELINE_SUBMODELS | {+ SubModelType.TextEncoder2,+ SubModelType.Tokenizer2,+}+++def is_self_contained_sdnq_flux1_pipeline(config: AnyModelConfig) -> bool:+ """True if `config` is an SDNQ FLUX.1 pipeline that ships every component the graph needs:+ transformer, VAE, CLIP (text_encoder + tokenizer) and T5 (text_encoder_2 + tokenizer_2).++ Stricter than `is_self_contained_sdnq_pipeline`, which describes the single-encoder pipelines.+ A FLUX.1 folder missing the T5 pair still needs an external T5 selected."""+ if getattr(config, "format", None) != ModelFormat.SDNQQuantized:+ return False+ submodels = getattr(config, "submodels", None) or {}+ return _REQUIRED_FLUX1_PIPELINE_SUBMODELS.issubset(submodels.keys())class ModelIdentifierField(BaseModel):diff --git a/invokeai/app/invocations/z_image_denoise.py b/invokeai/app/invocations/z_image_denoise.pyindex ee742f351d..07658fe96e 100644--- a/invokeai/app/invocations/z_image_denoise.py+++ b/invokeai/app/invocations/z_image_denoise.py@@ -438,7 +438,7 @@ class ZImageDenoiseInvocation(BaseInvocation):# slower inference than direct patching, but is agnostic to the quantization format.if transformer_config.format in [ModelFormat.Diffusers, ModelFormat.Checkpoint]:model_is_quantized = False- elif transformer_config.format in [ModelFormat.GGUFQuantized]:+ elif transformer_config.format in [ModelFormat.GGUFQuantized, ModelFormat.SDNQQuantized]:model_is_quantized = Trueelse:raise ValueError(f"Unsupported Z-Image model format: {transformer_config.format}")diff --git a/invokeai/app/invocations/z_image_model_loader.py b/invokeai/app/invocations/z_image_model_loader.pyindex 4d746061dc..2901a2e2ac 100644--- a/invokeai/app/invocations/z_image_model_loader.py+++ b/invokeai/app/invocations/z_image_model_loader.py@@ -13,6 +13,7 @@ from invokeai.app.invocations.model import (Qwen3EncoderField,TransformerField,VAEField,+ is_self_contained_sdnq_pipeline,)from invokeai.app.services.shared.invocation_context import InvocationContextfrom invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, SubModelType@@ -32,7 +33,10 @@ class ZImageModelLoaderOutput(BaseInvocationOutput):title="Main Model - Z-Image",tags=["model", "z-image"],category="model",- version="3.0.0",+ # 3.1.0: the Qwen3 Source input dropped its `ui_model_format=Diffusers` pin so SDNQ pipelines are+ # offered too, and the loader falls back to a self-contained main model for VAE / Qwen3. A node+ # serialized against 3.0.0 carries the old field contract, so the version has to move with it.+ version="3.1.0",classification=Classification.Prototype,)class ZImageModelLoaderInvocation(BaseInvocation):@@ -73,20 +77,30 @@ class ZImageModelLoaderInvocation(BaseInvocation):qwen3_source_model: Optional[ModelIdentifierField] = InputField(default=None,- description="Diffusers Z-Image model to extract VAE and/or Qwen3 encoder from. "+ description="Z-Image pipeline model to extract VAE and/or Qwen3 encoder from. ""Use this if you don't have separate VAE/Qwen3 models. ""Ignored if both VAE and Qwen3 Encoder are provided separately.",input=Input.Direct,ui_model_base=BaseModelType.ZImage,ui_model_type=ModelType.Main,- ui_model_format=ModelFormat.Diffusers,- title="Qwen3 Source (Diffusers)",+ # No ui_model_format hint: both plain Diffusers pipelines and SDNQ-quantized ZImagePipeline+ # folders (which ship VAE/Qwen3 submodels) are valid sources. _validate_diffusers_format+ # accepts both, so pinning the format here would wrongly filter SDNQ pipelines out of the+ # generic node/workflow model pickers.+ title="Qwen3 Source",)def invoke(self, context: InvocationContext) -> ZImageModelLoaderOutput:# Transformer always comes from the main modeltransformer = self.model.model_copy(update={"submodel_type": SubModelType.Transformer})+ # SDNQ Z-Image pipeline installs are self-contained: a single install ships the transformer,+ # Qwen3 encoder and VAE as submodels of the main model. When the user hasn't selected a+ # standalone VAE / Qwen3 Encoder or a separate Qwen3 Source, fall back to the main model+ # itself for those submodels. This lets a freshly installed SDNQ Z-Image pipeline generate+ # without the user having to manually re-select the same model as a component source.+ self_contained_source = self._get_self_contained_source(context)+# Determine VAE sourceif self.vae_model is not None:# Use standalone FLUX VAE@@ -95,6 +109,9 @@ class ZImageModelLoaderInvocation(BaseInvocation):# Extract from Diffusers Z-Image modelself._validate_diffusers_format(context, self.qwen3_source_model, "Qwen3 Source")vae = self.qwen3_source_model.model_copy(update={"submodel_type": SubModelType.VAE})+ elif self_contained_source is not None:+ # Extract from the self-contained SDNQ main model+ vae = self_contained_source.model_copy(update={"submodel_type": SubModelType.VAE})else:raise ValueError("No VAE source provided. Either set 'VAE' to a FLUX VAE model, "@@ -111,6 +128,10 @@ class ZImageModelLoaderInvocation(BaseInvocation):self._validate_diffusers_format(context, self.qwen3_source_model, "Qwen3 Source")qwen3_tokenizer = self.qwen3_source_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})qwen3_encoder = self.qwen3_source_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})+ elif self_contained_source is not None:+ # Extract from the self-contained SDNQ main model+ qwen3_tokenizer = self_contained_source.model_copy(update={"submodel_type": SubModelType.Tokenizer})+ qwen3_encoder = self_contained_source.model_copy(update={"submodel_type": SubModelType.TextEncoder})else:raise ValueError("No Qwen3 Encoder source provided. Either set 'Qwen3 Encoder' to a standalone model, "@@ -123,13 +144,34 @@ class ZImageModelLoaderInvocation(BaseInvocation):vae=VAEField(vae=vae),)+ def _get_self_contained_source(self, context: InvocationContext) -> Optional[ModelIdentifierField]:+ """Return the main model as a submodel source when it is a self-contained pipeline that+ ships its own VAE and Qwen3 submodels.++ A truthy ``submodels`` dict is not sufficient: Main_SDNQ_Diffusers_ZImage_Config builds+ whatever submodels it recognizes from model_index.json, so a partial (or partially+ recognized) pipeline can expose e.g. only the transformer. The loader then loads the VAE /+ Qwen3 encoder / tokenizer from fixed ``vae`` / ``text_encoder`` / ``tokenizer`` subfolders, so+ we only treat the main model as self-contained when all of those submodels are present.+ Otherwise we fall through and require an explicit VAE / Qwen3 source."""+ config = context.models.get_config(self.model)+ if is_self_contained_sdnq_pipeline(config):+ return self.model+ return None+def _validate_diffusers_format(self, context: InvocationContext, model: ModelIdentifierField, model_name: str) -> None:- """Validate that a model is in Diffusers format."""+ """Validate that a model exposes the diffusers-style submodel layout (transformer / vae /+ text_encoder / tokenizer subfolders). Plain diffusers Z-Image pipelines satisfy this;+ SDNQ-quantized ZImagePipeline folders do too, but only when they ship the VAE + Qwen3+ submodels. Single-file SDNQ Z-Image checkpoints and partial pipelines are rejected."""config = context.models.get_config(model)- if config.format != ModelFormat.Diffusers:- raise ValueError(- f"The {model_name} model must be a Diffusers format Z-Image model. "- f"The selected model '{config.name}' is in {config.format.value} format."- )+ if config.format == ModelFormat.Diffusers:+ return+ if is_self_contained_sdnq_pipeline(config):+ return+ raise ValueError(+ f"The {model_name} model must be a Diffusers-style Z-Image pipeline (with VAE / Qwen3 "+ f"submodels). The selected model '{config.name}' is in {config.format.value} format."+ )diff --git a/invokeai/app/util/t5_model_identifier.py b/invokeai/app/util/t5_model_identifier.pyindex a0d999920c..4d0c2a9c99 100644--- a/invokeai/app/util/t5_model_identifier.py+++ b/invokeai/app/util/t5_model_identifier.py@@ -8,6 +8,8 @@ def preprocess_t5_encoder_model_identifier(model_identifier: ModelIdentifierFiel"""if model_identifier.base == BaseModelType.Any:return model_identifier.model_copy(update={"submodel_type": SubModelType.TextEncoder2})+ elif model_identifier.base == BaseModelType.Flux:+ return model_identifier.model_copy(update={"submodel_type": SubModelType.TextEncoder2})elif model_identifier.base == BaseModelType.StableDiffusion3:return model_identifier.model_copy(update={"submodel_type": SubModelType.TextEncoder3})else:@@ -20,6 +22,8 @@ def preprocess_t5_tokenizer_model_identifier(model_identifier: ModelIdentifierFi"""if model_identifier.base == BaseModelType.Any:return model_identifier.model_copy(update={"submodel_type": SubModelType.Tokenizer2})+ elif model_identifier.base == BaseModelType.Flux:+ return model_identifier.model_copy(update={"submodel_type": SubModelType.Tokenizer2})elif model_identifier.base == BaseModelType.StableDiffusion3:return model_identifier.model_copy(update={"submodel_type": SubModelType.Tokenizer3})else:diff --git a/invokeai/backend/model_manager/configs/factory.py b/invokeai/backend/model_manager/configs/factory.pyindex 1535cf5737..09857eb433 100644--- a/invokeai/backend/model_manager/configs/factory.py+++ b/invokeai/backend/model_manager/configs/factory.py@@ -99,6 +99,12 @@ from invokeai.backend.model_manager.configs.main import (Main_GGUF_QwenImage_Config,Main_GGUF_Wan_Config,Main_GGUF_ZImage_Config,+ Main_SDNQ_Diffusers_Flux2_Config,+ Main_SDNQ_Diffusers_FLUX_Config,+ Main_SDNQ_Diffusers_ZImage_Config,+ Main_SDNQ_Flux2_Config,+ Main_SDNQ_FLUX_Config,+ Main_SDNQ_ZImage_Config,MainModelDefaultSettings,)from invokeai.backend.model_manager.configs.mistral_encoder import (@@ -117,6 +123,8 @@ from invokeai.backend.model_manager.configs.qwen3_encoder import (Qwen3Encoder_Checkpoint_Config,Qwen3Encoder_GGUF_Config,Qwen3Encoder_Qwen3Encoder_Config,+ Qwen3Encoder_SDNQ_Config,+ Qwen3Encoder_SDNQ_Folder_Config,)from invokeai.backend.model_manager.configs.qwen3_vl_encoder import (Qwen3VLEncoder_Checkpoint_Config,@@ -135,6 +143,7 @@ from invokeai.backend.model_manager.configs.t2i_adapter import (from invokeai.backend.model_manager.configs.t5_encoder import (T5Encoder_BnBLLMint8_Config,T5Encoder_GGUF_Config,+ T5Encoder_SDNQ_Config,T5Encoder_T5Encoder_Config,)from invokeai.backend.model_manager.configs.text_llm import TextLLM_Diffusers_Config@@ -290,6 +299,16 @@ AnyModelConfig = Annotated[Annotated[Main_GGUF_Wan_Config, Main_GGUF_Wan_Config.get_tag()],Annotated[Main_GGUF_ZImage_Config, Main_GGUF_ZImage_Config.get_tag()],Annotated[Main_GGUF_Krea2_Config, Main_GGUF_Krea2_Config.get_tag()],+ # IMPORTANT: FLUX.2 must be listed BEFORE FLUX.1 here. An ambiguous SDNQ transformer+ # checkpoint (prefixed FLUX.2 keys) can look like a FLUX.1 main model, so FLUX.2 must get+ # first refusal. Main_SDNQ_FLUX_Config additionally rejects FLUX.2 state dicts to keep the+ # two mutually exclusive regardless of iteration order.+ Annotated[Main_SDNQ_Flux2_Config, Main_SDNQ_Flux2_Config.get_tag()],+ Annotated[Main_SDNQ_Diffusers_Flux2_Config, Main_SDNQ_Diffusers_Flux2_Config.get_tag()],+ Annotated[Main_SDNQ_FLUX_Config, Main_SDNQ_FLUX_Config.get_tag()],+ Annotated[Main_SDNQ_Diffusers_FLUX_Config, Main_SDNQ_Diffusers_FLUX_Config.get_tag()],+ Annotated[Main_SDNQ_ZImage_Config, Main_SDNQ_ZImage_Config.get_tag()],+ Annotated[Main_SDNQ_Diffusers_ZImage_Config, Main_SDNQ_Diffusers_ZImage_Config.get_tag()],# VAE - checkpoint formatAnnotated[VAE_Checkpoint_SD1_Config, VAE_Checkpoint_SD1_Config.get_tag()],Annotated[VAE_Checkpoint_SD2_Config, VAE_Checkpoint_SD2_Config.get_tag()],@@ -362,6 +381,7 @@ AnyModelConfig = Annotated[# T5 Encoder - all formatsAnnotated[T5Encoder_T5Encoder_Config, T5Encoder_T5Encoder_Config.get_tag()],Annotated[T5Encoder_BnBLLMint8_Config, T5Encoder_BnBLLMint8_Config.get_tag()],+ Annotated[T5Encoder_SDNQ_Config, T5Encoder_SDNQ_Config.get_tag()],Annotated[T5Encoder_GGUF_Config, T5Encoder_GGUF_Config.get_tag()],# Qwen3-VL Encoder (Qwen3-VL multimodal encoder for Krea-2) - checked BEFORE the text-only Qwen3# encoder so single-file VL checkpoints (which also carry generic model.layers.* keys) are not@@ -372,6 +392,8 @@ AnyModelConfig = Annotated[Annotated[Qwen3Encoder_Qwen3Encoder_Config, Qwen3Encoder_Qwen3Encoder_Config.get_tag()],Annotated[Qwen3Encoder_Checkpoint_Config, Qwen3Encoder_Checkpoint_Config.get_tag()],Annotated[Qwen3Encoder_GGUF_Config, Qwen3Encoder_GGUF_Config.get_tag()],+ Annotated[Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Config.get_tag()],+ Annotated[Qwen3Encoder_SDNQ_Folder_Config, Qwen3Encoder_SDNQ_Folder_Config.get_tag()],# Mistral Encoder (used by FLUX.2 [dev])Annotated[MistralEncoder_Diffusers_Config, MistralEncoder_Diffusers_Config.get_tag()],Annotated[MistralEncoder_Checkpoint_Config, MistralEncoder_Checkpoint_Config.get_tag()],diff --git a/invokeai/backend/model_manager/configs/main.py b/invokeai/backend/model_manager/configs/main.pyindex 4b66248599..73b68f23fb 100644--- a/invokeai/backend/model_manager/configs/main.py+++ b/invokeai/backend/model_manager/configs/main.py@@ -12,7 +12,10 @@ from invokeai.backend.model_manager.configs.base import (SubmodelDefinition,)from invokeai.backend.model_manager.configs.clip_embed import get_clip_variant_type_from_config-from invokeai.backend.model_manager.configs.flux2_variant import flux2_variant_from_context_dim+from invokeai.backend.model_manager.configs.flux2_variant import (+ flux2_variant_from_context_dim,+ flux2_variant_from_hidden_size,+)from invokeai.backend.model_manager.configs.identification_utils import (NotAMatchError,common_config_paths,@@ -23,6 +26,7 @@ from invokeai.backend.model_manager.configs.identification_utils import (raise_if_not_file,state_dict_has_any_keys_exact,)+from invokeai.backend.model_manager.configs.qwen3_encoder import _SDNQ_LOADABLE_QWEN_ARCHITECTURESfrom invokeai.backend.model_manager.model_on_disk import ModelOnDiskfrom invokeai.backend.model_manager.taxonomy import (BaseModelType,@@ -30,6 +34,7 @@ from invokeai.backend.model_manager.taxonomy import (FluxVariantType,Krea2VariantType,ModelFormat,+ ModelRepoVariant,ModelType,ModelVariantType,QwenImageVariantType,@@ -39,6 +44,8 @@ from invokeai.backend.model_manager.taxonomy import (ZImageVariantType,)from invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.detection import is_sdnq_folder+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensorfrom invokeai.backend.stable_diffusion.schedulers.schedulers import SCHEDULER_NAME_VALUESDEFAULTS_PRECISION = Literal["fp16", "fp32"]@@ -169,6 +176,25 @@ def _has_ggml_tensors(state_dict: dict[str | int, Any]) -> bool:return any(isinstance(v, GGMLTensor) for v in state_dict.values())+def _has_sdnq_tensors(state_dict: dict[str | int, Any]) -> bool:+ """Check if state dict contains SDNQTensor instances."""+ return any(isinstance(v, SDNQTensor) for v in state_dict.values())+++def _has_sdnq_keys(state_dict: dict[str | int, Any]) -> bool:+ """Check if state dict has SDNQ-style keys (weight + scale pairs).++ SDNQ quantized models store weights with associated scale tensors.+ """+ keys = {k for k in state_dict.keys() if isinstance(k, str)}+ for key in keys:+ if key.endswith(".weight"):+ base = key[:-7]+ if f"{base}.scale" in keys:+ return True+ return False++def _has_main_keys(state_dict: dict[str | int, Any]) -> bool:for key in state_dict.keys():if isinstance(key, int):@@ -455,6 +481,20 @@ def _is_flux2_model(state_dict: dict[str | int, Any]) -> bool:return False+def _has_flux2_diffusers_transformer_keys(state_dict: dict[str | int, Any]) -> bool:+ """Check for the bare diffusers-style FLUX.2 transformer layout.++ A FLUX.2 single-file SDNQ checkpoint can ship its keys in the bare diffusers layout+ (``transformer_blocks.*``, ``context_embedder.*``) rather than the BFL / ComfyUI layout that+ ``_has_main_keys`` recognizes. The FLUX.2 single-file loader looks for exactly these keys, so we+ must treat their presence as "looks like a main model" for identification purposes.+ """+ for key in state_dict.keys():+ if isinstance(key, str) and (key.startswith("transformer_blocks.") or key.startswith("context_embedder.")):+ return True+ return False++def _filename_suggests_base(name: str) -> bool:"""Check if a model name/filename suggests it is a Base (undistilled) variant.@@ -909,6 +949,10 @@ class Main_Diffusers_FLUX_Config(Diffusers_Config_Base, Main_Config_Base, Config},)+ # Reject SDNQ-quantized pipelines so Main_SDNQ_Diffusers_FLUX_Config matches instead.+ if (mod.path / "transformer").is_dir() and _is_sdnq_folder(mod.path / "transformer"):+ raise NotAMatchError("transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_FLUX_Config")+variant = override_fields.pop("variant", None) or cls._get_variant_or_raise(mod)repo_variant = override_fields.pop("repo_variant", None) or cls._get_repo_variant_or_raise(mod)@@ -980,6 +1024,13 @@ class Main_Diffusers_Flux2_Config(Diffusers_Config_Base, Main_Config_Base, Confi},)+ # Reject SDNQ-quantized pipelines so the SDNQ-specific config matches them instead.+ # Without this both configs accept the same folder and identification can latch onto+ # the wrong one (the plain diffusers loader would then mis-read packed uint8 weights+ # as bf16 and crash with size-mismatch errors at first inference).+ if (mod.path / "transformer").is_dir() and _is_sdnq_folder(mod.path / "transformer"):+ raise NotAMatchError("transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_Flux2_Config")+variant = override_fields.pop("variant", None) or cls._get_variant_or_raise(mod)repo_variant = override_fields.pop("repo_variant", None) or cls._get_repo_variant_or_raise(mod)@@ -1319,6 +1370,14 @@ class Main_Diffusers_ZImage_Config(Diffusers_Config_Base, Main_Config_Base, Conf},)+ # Reject SDNQ-quantized pipelines so Main_SDNQ_Diffusers_ZImage_Config matches them instead.+ # Without this both configs accept the same ZImagePipeline folder and identification can+ # latch onto the plain diffusers one (which would then mis-read packed uint8 weights as bf16+ # and crash at inference). It also breaks the self-contained SDNQ path, since a pipeline+ # mis-identified as plain diffusers would force the user to select separate VAE/Qwen3 sources.+ if (mod.path / "transformer").is_dir() and _is_sdnq_folder(mod.path / "transformer"):+ raise NotAMatchError("transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_ZImage_Config")+variant = override_fields.pop("variant", None) or cls._get_variant_or_raise(mod)repo_variant = override_fields.pop("repo_variant", None) or cls._get_repo_variant_or_raise(mod)@@ -2013,6 +2072,794 @@ class Main_Checkpoint_Anima_Config(Checkpoint_Config_Base, Main_Config_Base, Conraise NotAMatchError("state dict does not look like an Anima model")+class Main_SDNQ_FLUX_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized FLUX transformer models."""++ base: Literal[BaseModelType.Flux] = Field(default=BaseModelType.Flux)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)++ variant: FluxVariantType = Field()++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_file(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_main_model(mod)++ cls._validate_is_not_flux2(mod)++ cls._validate_looks_like_sdnq_quantized(mod)++ variant = override_fields.get("variant") or cls._get_variant_or_raise(mod)++ return cls(**override_fields, variant=variant)++ @classmethod+ def _get_variant_or_raise(cls, mod: ModelOnDisk) -> FluxVariantType:+ state_dict = mod.load_state_dict()+ variant = _get_flux_variant(state_dict)++ if variant is None:+ raise NotAMatchError("unable to determine model variant from state dict")++ return variant++ @classmethod+ def _validate_looks_like_main_model(cls, mod: ModelOnDisk) -> None:+ has_main_model_keys = _has_main_keys(mod.load_state_dict())+ if not has_main_model_keys:+ raise NotAMatchError("state dict does not look like a main model")++ @classmethod+ def _validate_is_not_flux2(cls, mod: ModelOnDisk) -> None:+ """Reject FLUX.2 SDNQ checkpoints so they route to Main_SDNQ_Flux2_Config instead.++ This config only checks for generic main-model keys plus SDNQ keys, so without this guard a+ prefixed FLUX.2 SDNQ state dict could be accepted as base=flux and later loaded by the+ FLUX.1 loader.+ """+ state_dict = mod.load_state_dict()+ if _is_flux2_model(state_dict):+ raise NotAMatchError("model is a FLUX.2 model, not FLUX.1; use Main_SDNQ_Flux2_Config")++ @classmethod+ def _validate_looks_like_sdnq_quantized(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _has_sdnq_keys(state_dict) and not _has_sdnq_tensors(state_dict):+ raise NotAMatchError("state dict does not look like SDNQ quantized")+++class Main_SDNQ_Flux2_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized FLUX.2 transformer models (e.g. Klein 4B / 9B)."""++ base: Literal[BaseModelType.Flux2] = Field(default=BaseModelType.Flux2)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)++ variant: Flux2VariantType = Field()++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_file(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_main_model(mod)++ cls._validate_is_flux2(mod)++ cls._validate_looks_like_sdnq_quantized(mod)++ variant = override_fields.pop("variant", None) or cls._get_variant_or_raise(mod)++ return cls(**override_fields, variant=variant)++ @classmethod+ def _validate_looks_like_main_model(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ # Only the bare diffusers layout (transformer_blocks. / context_embedder.) is accepted: the+ # single-file SDNQ FLUX.2 loader consumes those keys directly and neither strips the+ # model.diffusion_model. prefix nor converts BFL double_blocks. keys. Accepting a BFL /+ # ComfyUI checkpoint here (via _has_main_keys) would classify a checkpoint the loader then+ # fails to load with missing/unexpected keys, so we reject it during identification instead.+ if _has_flux2_diffusers_transformer_keys(state_dict):+ return+ raise NotAMatchError(+ "state dict is not in the bare diffusers layout the single-file SDNQ FLUX.2 loader supports"+ )++ @classmethod+ def _validate_is_flux2(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _is_flux2_model(state_dict):+ raise NotAMatchError("state dict does not look like a FLUX.2 model")++ @classmethod+ def _validate_looks_like_sdnq_quantized(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _has_sdnq_keys(state_dict) and not _has_sdnq_tensors(state_dict):+ raise NotAMatchError("state dict does not look like SDNQ quantized")++ @classmethod+ def _get_variant_or_raise(cls, mod: ModelOnDisk) -> Flux2VariantType:+ state_dict = mod.load_state_dict()+ variant = _get_flux2_variant(state_dict)++ if variant is None:+ raise NotAMatchError("unable to determine FLUX.2 model variant from state dict")++ if variant == Flux2VariantType.Klein9B and _filename_suggests_base(mod.name):+ return Flux2VariantType.Klein9BBase+ if variant == Flux2VariantType.Klein4B and _filename_suggests_base(mod.name):+ return Flux2VariantType.Klein4BBase++ return variant+++class Main_SDNQ_ZImage_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized Z-Image transformer models."""++ base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)+ variant: ZImageVariantType = Field()++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_file(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_z_image_model(mod)++ cls._validate_looks_like_sdnq_quantized(mod)++ variant = override_fields.pop("variant", None) or ZImageVariantType.Turbo++ return cls(**override_fields, variant=variant)++ @classmethod+ def _validate_looks_like_z_image_model(cls, mod: ModelOnDisk) -> None:+ has_z_image_keys = _has_z_image_keys(mod.load_state_dict())+ if not has_z_image_keys:+ raise NotAMatchError("state dict does not look like a Z-Image model")++ @classmethod+ def _validate_looks_like_sdnq_quantized(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _has_sdnq_keys(state_dict) and not _has_sdnq_tensors(state_dict):+ raise NotAMatchError("state dict does not look like SDNQ quantized")+++# Tokenizer class names a Qwen3-encoder pipeline can advertise in model_index.json. Qwen models+# (incl. Qwen3) use the Qwen2 tokenizer classes, in slow and fast variants.+_QWEN_TOKENIZER_CLASS_NAMES = {"Qwen2Tokenizer", "Qwen2TokenizerFast"}++# Text-encoder class names the SDNQ pipeline loaders can actually instantiate. They build a text-only+# Qwen3ForCausalLM for the discovered text_encoder/ folder, so they can only load a Qwen3 model — not+# a Qwen2 causal LM (missing Qwen3 q/k-norm params) and not the multimodal Qwen2VLForConditionalGeneration+# (visual tower). Recording any of those as a self-contained TextEncoder would mark the pipeline+# complete even though the loader would fail, so discovery narrows to the loadable Qwen3 set.+_SDNQ_PIPELINE_TEXT_ENCODER_CLASS_NAMES = _SDNQ_LOADABLE_QWEN_ARCHITECTURES+++# Files a pipeline component folder must actually ship to be loadable. Weight-bearing components+# (transformer / text_encoder / vae) are loaded with a `from_pretrained`-style call that needs both a+# config and at least one weight file; the tokenizer folder carries no weights, only its vocab/config.+_COMPONENT_CONFIG_FILENAMES = ("config.json", "model_index.json")+_COMPONENT_WEIGHT_SUFFIXES = (".safetensors", ".bin", ".pt", ".pth", ".ckpt", ".gguf")+# ...but a *quantized* component is read by `sdnq_sd_loader`, which globs `*.safetensors` and raises+# when it finds none. Anything else in an SDNQ folder is not a weight that component can be loaded+# from, so accepting it would record a submodel the loader is guaranteed to choke on.+_SDNQ_COMPONENT_WEIGHT_SUFFIXES = (".safetensors",)+# Submodel slots that ship vocab/config only. They need no weight file, and nothing can be+# mis-instantiated against them, so they are also exempt from the declared-class requirement.+_WEIGHTLESS_SUBMODEL_TYPES = frozenset({SubModelType.Tokenizer, SubModelType.Tokenizer2})++# FLUX.1 SDNQ pipeline components, keyed by the class name `model_index.json` advertises. The value+# is the slot it fills, the model type recorded for it, and the class names the component's own config+# may declare — the tokenizers list both spellings transformers writes.+# Slots whose SDNQ loader calls `sdnq_sd_loader` unconditionally, so the component must ship+# safetensors whatever its folder declares. FLUX.2 and Z-Image build their transformer and Qwen3+# text encoder that way; FLUX.1 does so only for the transformer, because its CLIP / T5 / VAE+# branch on `_is_sdnq_folder` and fall back to `from_pretrained`.+# The transformer is read with `sdnq_sd_loader` in every SDNQ pipeline, which is why it is also the+# slot identification validates before accepting the folder as one.+_SDNQ_TRANSFORMER_ONLY = frozenset({SubModelType.Transformer})+_SDNQ_PIPELINE_ALWAYS_SDNQ_LOADED = _SDNQ_TRANSFORMER_ONLY | {SubModelType.TextEncoder}+_SDNQ_FLUX1_ALWAYS_SDNQ_LOADED = _SDNQ_TRANSFORMER_ONLY++_SDNQ_FLUX1_COMPONENT_BY_CLASS_NAME: dict[str, tuple[SubModelType, ModelType, set[str]]] = {+ "FluxTransformer2DModel": (SubModelType.Transformer, ModelType.Main, {"FluxTransformer2DModel"}),+ "CLIPTextModel": (SubModelType.TextEncoder, ModelType.CLIPEmbed, {"CLIPTextModel"}),+ "T5EncoderModel": (SubModelType.TextEncoder2, ModelType.T5Encoder, {"T5EncoderModel"}),+ "AutoencoderKL": (SubModelType.VAE, ModelType.VAE, {"AutoencoderKL"}),+ "CLIPTokenizer": (SubModelType.Tokenizer, ModelType.CLIPEmbed, {"CLIPTokenizer", "CLIPTokenizerFast"}),+ "T5TokenizerFast": (SubModelType.Tokenizer2, ModelType.T5Encoder, {"T5Tokenizer", "T5TokenizerFast"}),+ "T5Tokenizer": (SubModelType.Tokenizer2, ModelType.T5Encoder, {"T5Tokenizer", "T5TokenizerFast"}),+}+_TOKENIZER_FILENAMES = (+ "tokenizer.json",+ "tokenizer_config.json",+ "tokenizer.model",+ "vocab.json",+ "merges.txt",+ "spiece.model",+)+++# Class names that legitimately identify each component of an SDNQ pipeline, used both to map a+# `model_index.json` entry onto a submodel type and to check the component's own config agrees.+# `AutoencoderKL` and `AutoencoderKLFlux2` are interchangeable spellings of the VAE slot.+_SDNQ_FLUX2_TRANSFORMER_CLASS_NAMES = {"Flux2Transformer2DModel"}+_SDNQ_ZIMAGE_TRANSFORMER_CLASS_NAMES = {"ZImageTransformer2DModel"}+_SDNQ_VAE_CLASS_NAMES = {"AutoencoderKLFlux2", "AutoencoderKL"}++# Keys a component config uses to name its own class. Transformers models use `architectures`,+# diffusers models `_class_name`, and tokenizers `tokenizer_class`.+_COMPONENT_CLASS_CONFIG_FILENAMES = ("config.json", "model_index.json", "tokenizer_config.json")+++def _sdnq_component_declared_classes(component_path: Path) -> set[str]:+ """Class names the component's *own* config files declare, if any."""+ import json++ declared: set[str] = set()+ for filename in _COMPONENT_CLASS_CONFIG_FILENAMES:+ config_path = component_path / filename+ if not config_path.is_file():+ continue+ try:+ with open(config_path, "r", encoding="utf-8") as f:+ config = json.load(f)+ except (json.JSONDecodeError, OSError):+ continue+ if not isinstance(config, dict):+ continue+ architectures = config.get("architectures")+ if isinstance(architectures, list):+ declared.update(name for name in architectures if isinstance(name, str))+ for key in ("_class_name", "tokenizer_class"):+ name = config.get(key)+ if isinstance(name, str):+ declared.add(name)+ return declared+++def _sdnq_component_matches_advertised_class(+ component_path: Path, accepted_class_names: set[str], *, require_declaration: bool+) -> bool:+ """True if the component's own config agrees with the class `model_index.json` advertises for it.++ `model_index.json` records what a pipeline *claims* each component is, and that claim is what+ selects the loader — but nothing forces it to be true. A folder can advertise `Qwen3ForCausalLM`+ for `text_encoder/` and ship a Qwen2 or multimodal Qwen2-VL model there; the folder is populated,+ so a file-presence check passes and the pipeline is recorded as self-contained. The mismatch then+ only surfaces at generation time, when the loader builds a Qwen3ForCausalLM against a state dict+ that cannot satisfy it.++ With `require_declaration`, a component that declares *nothing* is rejected too, not just one that+ contradicts. Silence is not evidence: "some config.json plus some weight file" is exactly the+ shape an unrelated model has, so accepting it re-opens the hole for every component whose config+ happens to omit the key. `save_pretrained` writes `_class_name` (diffusers) or `architectures`+ (transformers) for anything it saves, so a weight-bearing component that names no class is not a+ normally-produced one. Set it for those; the tokenizer stays lenient because it carries no weights+ (nothing can be mis-instantiated against it) and `tokenizer_class` is less consistently written.++ Rejecting here is not fatal to the install: the component is left unrecorded, the pipeline is+ simply not self-contained, and the user wires that component up explicitly — which is the correct+ outcome for a folder we cannot confirm.+ """+ declared = _sdnq_component_declared_classes(component_path)+ if not declared:+ return not require_declaration+ return bool(declared & accepted_class_names)+++def _sdnq_component_dir_is_populated(+ component_path: Path,+ submodel_type: SubModelType,+ always_sdnq_loaded: frozenset[SubModelType] = frozenset(),+) -> bool:+ """True if `component_path` holds the files the component's loader needs.++ An existing-but-empty folder is not enough: an interrupted download leaves the component+ directories created but empty (or holding only a partial file), and recording such a component as+ a submodel makes is_self_contained_sdnq_pipeline() report the pipeline as complete. Readiness then+ permits generation and the invocations select the main model as the component source, and the+ failure only surfaces when the loader tries to read the empty vae/ text_encoder/ tokenizer/ folder.++ "Files its loader needs" is per component, not one list for all of them. `sdnq_sd_loader` globs+ `*.safetensors` and raises if it finds none, so a `.gguf` or `.bin` in a component it reads is+ not a usable weight however well-formed the folder otherwise looks. A component loaded with+ `from_pretrained` instead — typically the VAE, which SDNQ exports leave in bfloat16 — may+ legitimately ship any of the formats diffusers reads.++ Which of the two applies is a property of the *loader*, not of the folder. `always_sdnq_loaded`+ names the slots whose loader calls `sdnq_sd_loader` unconditionally: FLUX.2 and Z-Image do that+ for the transformer and text encoder, FLUX.1 only for the transformer (its CLIP / T5 / VAE+ branch on the folder marker). Relying on `quantization_config.json` alone was not enough — a+ component carrying SDNQ weight/scale keys but no marker file reads as unquantized, so a `.bin`+ passed discovery and then failed in the loader that was always going to use `sdnq_sd_loader`.+ """+ if not component_path.is_dir():+ return False++ # Both tokenizer slots are weightless — FLUX.1 pipelines carry a CLIP tokenizer plus a T5+ # `tokenizer_2`, and requiring weights of either would reject every real one.+ if submodel_type in _WEIGHTLESS_SUBMODEL_TYPES:+ return any((component_path / name).is_file() for name in _TOKENIZER_FILENAMES)++ read_by_sdnq_loader = submodel_type in always_sdnq_loaded or _is_sdnq_folder(component_path)+ accepted_suffixes = _SDNQ_COMPONENT_WEIGHT_SUFFIXES if read_by_sdnq_loader else _COMPONENT_WEIGHT_SUFFIXES+ has_config = any((component_path / name).is_file() for name in _COMPONENT_CONFIG_FILENAMES)+ has_weights = any(entry.is_file() and entry.suffix in accepted_suffixes for entry in component_path.iterdir())+ return has_config and has_weights+++class Main_SDNQ_Diffusers_Flux2_Config(Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized FLUX.2 models in diffusers format+ (Flux2KleinPipeline / Flux2Pipeline folder with transformer/, text_encoder/, vae/, ...)."""++ base: Literal[BaseModelType.Flux2] = Field(default=BaseModelType.Flux2)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)++ variant: Flux2VariantType = Field()+ repo_variant: ModelRepoVariant = Field(default=ModelRepoVariant.Default)+ submodels: dict[SubModelType, SubmodelDefinition] | None = Field(+ description="Loadable submodels in this model",+ default=None,+ )++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_dir(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_flux2_diffusers(mod)++ cls._validate_has_sdnq_transformer(mod)++ variant = override_fields.get("variant") or cls._get_variant_or_raise(mod)+ repo_variant = override_fields.get("repo_variant") or cls._get_repo_variant(mod)+ # Submodels are always rediscovered from disk, never replayed from a serialized config. A+ # persisted map records what existed at install time, so a component deleted since would+ # still be reported present and the pipeline still "self-contained" — and the failure would+ # surface only when a loader opens a folder that is gone. The filesystem is the authority.+ override_fields = {k: v for k, v in override_fields.items() if k != "submodels"}+ submodels = cls._get_submodels(mod)++ return cls(**override_fields, variant=variant, repo_variant=repo_variant, submodels=submodels)++ @classmethod+ def _validate_looks_like_flux2_diffusers(cls, mod: ModelOnDisk) -> None:+ raise_for_class_name(+ common_config_paths(mod.path),+ {+ "Flux2Pipeline",+ "Flux2KleinPipeline",+ "Flux2Transformer2DModel",+ },+ )++ @classmethod+ def _validate_has_sdnq_transformer(cls, mod: ModelOnDisk) -> None:+ transformer_path = mod.path / "transformer"+ if not transformer_path.is_dir():+ raise NotAMatchError("no transformer subfolder found")++ if not _is_sdnq_folder(transformer_path):+ raise NotAMatchError("transformer is not SDNQ quantized")++ # ...and it must actually be loadable. A marker (or SDNQ-shaped config) over a folder with no+ # weight file the loader can read is not a pipeline: discovery would leave `Transformer` out+ # of `submodels` while this check still said "yes, SDNQ pipeline", so the model installed and+ # only failed when a loader opened the transformer path at generation time. Same predicate+ # discovery uses, so identification and discovery cannot disagree about the transformer.+ if not _sdnq_component_dir_is_populated(transformer_path, SubModelType.Transformer, _SDNQ_TRANSFORMER_ONLY):+ raise NotAMatchError("transformer folder holds no weights its loader can read")++ @classmethod+ def _get_variant_or_raise(cls, mod: ModelOnDisk) -> Flux2VariantType:+ """Determine the Flux2 variant from the transformer config + filename heuristic."""+ transformer_config = get_config_dict_or_raise(mod.path / "transformer" / "config.json")++ # Read the geometry through `flux2_variant.py`, the single source of truth the checkpoint,+ # diffusers and LoRA paths already use. Hand-rolling the comparison here is what made every+ # SDNQ pipeline a Klein: [dev]'s 15360 / 6144 matched no branch and fell into the `else`,+ # so a [dev] pipeline was silently identified as Klein4B rather than as itself.+ joint_attention_dim = transformer_config.get("joint_attention_dim")+ hidden_size = transformer_config.get("attention_head_dim", 128) * transformer_config.get(+ "num_attention_heads", 24+ )+ variant = (+ (flux2_variant_from_context_dim(joint_attention_dim) if joint_attention_dim is not None else None)+ or flux2_variant_from_hidden_size(hidden_size)+ or Flux2VariantType.Klein4B+ )++ # Base variants are architecturally identical to their distilled counterpart, so only the+ # name separates them. [dev] has no base counterpart and is left alone.+ if _filename_suggests_base(mod.name):+ if variant == Flux2VariantType.Klein9B:+ return Flux2VariantType.Klein9BBase+ if variant == Flux2VariantType.Klein4B:+ return Flux2VariantType.Klein4BBase+ return variant++ @classmethod+ def _get_repo_variant(cls, mod: ModelOnDisk) -> ModelRepoVariant:+ weight_files = list(mod.path.glob("**/*.safetensors"))+ weight_files.extend(list(mod.path.glob("**/*.bin")))+ for x in weight_files:+ if ".fp16" in x.suffixes:+ return ModelRepoVariant.FP16+ if "openvino_model" in x.name:+ return ModelRepoVariant.OpenVINO+ if "flax_model" in x.name:+ return ModelRepoVariant.Flax+ if x.suffix == ".onnx":+ return ModelRepoVariant.ONNX+ return ModelRepoVariant.Default++ @classmethod+ def _get_submodels(cls, mod: ModelOnDisk) -> dict[SubModelType, SubmodelDefinition]:+ config = get_config_dict_or_raise(common_config_paths(mod.path))++ submodels: dict[SubModelType, SubmodelDefinition] = {}++ for key, value in config.items():+ if key.startswith("_") or not (isinstance(value, list) and len(value) == 2):+ continue++ _library_name, class_name = value++ if class_name is None:+ continue++ match class_name:+ case "Flux2Transformer2DModel":+ submodel_type, model_type = SubModelType.Transformer, ModelType.Main+ accepted_class_names = _SDNQ_FLUX2_TRANSFORMER_CLASS_NAMES+ case name if name in _SDNQ_PIPELINE_TEXT_ENCODER_CLASS_NAMES:+ submodel_type, model_type = SubModelType.TextEncoder, ModelType.Qwen3Encoder+ accepted_class_names = _SDNQ_PIPELINE_TEXT_ENCODER_CLASS_NAMES+ case name if name in _QWEN_TOKENIZER_CLASS_NAMES:+ submodel_type, model_type = SubModelType.Tokenizer, ModelType.Qwen3Encoder+ accepted_class_names = _QWEN_TOKENIZER_CLASS_NAMES+ case "AutoencoderKLFlux2" | "AutoencoderKL":+ submodel_type, model_type = SubModelType.VAE, ModelType.VAE+ accepted_class_names = _SDNQ_VAE_CLASS_NAMES+ case _:+ continue++ # model_index.json only advertises which components a pipeline *should* have; a partial or+ # interrupted download can retain the original index while its component folders are+ # missing or still empty. Record a submodel only when the folder actually holds the files+ # its loader needs, otherwise a partial pipeline is treated as self-contained+ # (is_self_contained_sdnq_pipeline) and the loaders later request fixed vae/ text_encoder/+ # tokenizer/ subfolders that have nothing to load.+ component_path = mod.path / key+ if not _sdnq_component_dir_is_populated(component_path, submodel_type, _SDNQ_PIPELINE_ALWAYS_SDNQ_LOADED):+ continue++ # Populated is not the same as correct: the index's class name is a claim about the+ # folder, not a fact. Require the component's own config to agree before recording it.+ if not _sdnq_component_matches_advertised_class(+ component_path,+ accepted_class_names,+ require_declaration=submodel_type not in _WEIGHTLESS_SUBMODEL_TYPES,+ ):+ continue++ submodels[submodel_type] = SubmodelDefinition(+ path_or_prefix=component_path.resolve().as_posix(),+ model_type=model_type,+ variant=None,+ )++ return submodels+++class Main_SDNQ_Diffusers_ZImage_Config(Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized Z-Image models in diffusers format (full ZImagePipeline folder)."""++ base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)+ variant: ZImageVariantType = Field()++ repo_variant: ModelRepoVariant = Field(default=ModelRepoVariant.Default)+ submodels: dict[SubModelType, SubmodelDefinition] | None = Field(+ description="Loadable submodels in this model",+ default=None,+ )++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_dir(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_z_image_diffusers(mod)++ cls._validate_has_sdnq_transformer(mod)++ variant = override_fields.get("variant") or cls._get_variant_or_default(mod)++ repo_variant = override_fields.get("repo_variant") or cls._get_repo_variant(mod)++ # Submodels are always rediscovered from disk, never replayed from a serialized config. A+ # persisted map records what existed at install time, so a component deleted since would+ # still be reported present and the pipeline still "self-contained" — and the failure would+ # surface only when a loader opens a folder that is gone. The filesystem is the authority.+ override_fields = {k: v for k, v in override_fields.items() if k != "submodels"}+ submodels = cls._get_submodels(mod)++ return cls(**override_fields, variant=variant, repo_variant=repo_variant, submodels=submodels)++ @classmethod+ def _get_variant_or_default(cls, mod: ModelOnDisk) -> ZImageVariantType:+ """Determine Z-Image variant from the scheduler config (same heuristic as the unquantized diffusers config).++ Turbo (distilled) uses shift = 3.0, ZBase (undistilled) uses shift = 6.0.+ """+ try:+ scheduler_config = get_config_dict_or_raise(mod.path / "scheduler" / "scheduler_config.json")+ shift = scheduler_config.get("shift", 3.0)+ except NotAMatchError:+ return ZImageVariantType.Turbo+ return ZImageVariantType.ZBase if shift >= 5.0 else ZImageVariantType.Turbo++ @classmethod+ def _validate_looks_like_z_image_diffusers(cls, mod: ModelOnDisk) -> None:+ raise_for_class_name(+ common_config_paths(mod.path),+ {+ "ZImagePipeline",+ "ZImageTransformer2DModel",+ },+ )++ @classmethod+ def _validate_has_sdnq_transformer(cls, mod: ModelOnDisk) -> None:+ transformer_path = mod.path / "transformer"+ if not transformer_path.is_dir():+ raise NotAMatchError("no transformer subfolder found")++ if not _is_sdnq_folder(transformer_path):+ raise NotAMatchError("transformer is not SDNQ quantized")++ # ...and it must actually be loadable. A marker (or SDNQ-shaped config) over a folder with no+ # weight file the loader can read is not a pipeline: discovery would leave `Transformer` out+ # of `submodels` while this check still said "yes, SDNQ pipeline", so the model installed and+ # only failed when a loader opened the transformer path at generation time. Same predicate+ # discovery uses, so identification and discovery cannot disagree about the transformer.+ if not _sdnq_component_dir_is_populated(transformer_path, SubModelType.Transformer, _SDNQ_TRANSFORMER_ONLY):+ raise NotAMatchError("transformer folder holds no weights its loader can read")++ @classmethod+ def _get_repo_variant(cls, mod: ModelOnDisk) -> ModelRepoVariant:+ weight_files = list(mod.path.glob("**/*.safetensors"))+ weight_files.extend(list(mod.path.glob("**/*.bin")))+ for x in weight_files:+ if ".fp16" in x.suffixes:+ return ModelRepoVariant.FP16+ if "openvino_model" in x.name:+ return ModelRepoVariant.OpenVINO+ if "flax_model" in x.name:+ return ModelRepoVariant.Flax+ if x.suffix == ".onnx":+ return ModelRepoVariant.ONNX+ return ModelRepoVariant.Default++ @classmethod+ def _get_submodels(cls, mod: ModelOnDisk) -> dict[SubModelType, SubmodelDefinition]:+ config = get_config_dict_or_raise(common_config_paths(mod.path))++ submodels: dict[SubModelType, SubmodelDefinition] = {}++ for key, value in config.items():+ if key.startswith("_") or not (isinstance(value, list) and len(value) == 2):+ continue++ _library_name, class_name = value++ if class_name is None:+ continue++ match class_name:+ case "ZImageTransformer2DModel":+ submodel_type, model_type = SubModelType.Transformer, ModelType.Main+ accepted_class_names = _SDNQ_ZIMAGE_TRANSFORMER_CLASS_NAMES+ case name if name in _SDNQ_PIPELINE_TEXT_ENCODER_CLASS_NAMES:+ submodel_type, model_type = SubModelType.TextEncoder, ModelType.Qwen3Encoder+ accepted_class_names = _SDNQ_PIPELINE_TEXT_ENCODER_CLASS_NAMES+ case name if name in _QWEN_TOKENIZER_CLASS_NAMES:+ submodel_type, model_type = SubModelType.Tokenizer, ModelType.Qwen3Encoder+ accepted_class_names = _QWEN_TOKENIZER_CLASS_NAMES+ case "AutoencoderKL":+ submodel_type, model_type = SubModelType.VAE, ModelType.VAE+ accepted_class_names = _SDNQ_VAE_CLASS_NAMES+ case _:+ continue++ # See the FLUX.2 _get_submodels note: only record a component whose folder actually holds+ # the files its loader needs, so a partial download with a complete model_index.json isn't+ # mis-classified as a self-contained SDNQ pipeline.+ component_path = mod.path / key+ if not _sdnq_component_dir_is_populated(component_path, submodel_type, _SDNQ_PIPELINE_ALWAYS_SDNQ_LOADED):+ continue++ # ...and whose own config agrees with the class the index advertises for it.+ if not _sdnq_component_matches_advertised_class(+ component_path,+ accepted_class_names,+ require_declaration=submodel_type not in _WEIGHTLESS_SUBMODEL_TYPES,+ ):+ continue++ submodels[submodel_type] = SubmodelDefinition(+ path_or_prefix=component_path.resolve().as_posix(),+ model_type=model_type,+ variant=None,+ )++ return submodels+++def _is_sdnq_folder(folder_path: Path) -> bool:+ """Check if a folder contains SDNQ-quantized model weights.++ Delegates to the shared detector so identification and the loaders cannot disagree about a+ markerless export — see `invokeai.backend.quantization.sdnq.detection`.+ """+ return is_sdnq_folder(folder_path)+++class Main_SDNQ_Diffusers_FLUX_Config(Main_Config_Base, Config_Base):+ """Model config for SDNQ-quantized FLUX models in diffusers format (folder with transformer, text_encoder, etc.)."""++ base: Literal[BaseModelType.Flux] = Field(default=BaseModelType.Flux)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)++ variant: FluxVariantType = Field()+ repo_variant: ModelRepoVariant = Field(default=ModelRepoVariant.Default)+ submodels: dict[SubModelType, SubmodelDefinition] | None = Field(+ description="Loadable submodels in this model",+ default=None,+ )++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_dir(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_flux_diffusers(mod)++ cls._validate_has_sdnq_transformer(mod)++ variant = override_fields.get("variant") or cls._get_variant_or_raise(mod)++ repo_variant = override_fields.get("repo_variant") or cls._get_repo_variant(mod)++ # Submodels are always rediscovered from disk, never replayed from a serialized config. A+ # persisted map records what existed at install time, so a component deleted since would+ # still be reported present and the pipeline still "self-contained" — and the failure would+ # surface only when a loader opens a folder that is gone. The filesystem is the authority.+ override_fields = {k: v for k, v in override_fields.items() if k != "submodels"}+ submodels = cls._get_submodels(mod)++ return cls(**override_fields, variant=variant, repo_variant=repo_variant, submodels=submodels)++ @classmethod+ def _validate_looks_like_flux_diffusers(cls, mod: ModelOnDisk) -> None:+ """Check if this looks like a Flux diffusers model by checking for FluxPipeline or FluxTransformer2DModel."""+ raise_for_class_name(+ common_config_paths(mod.path),+ {+ "FluxPipeline",+ "FluxTransformer2DModel",+ },+ )++ @classmethod+ def _validate_has_sdnq_transformer(cls, mod: ModelOnDisk) -> None:+ """Check if the transformer subfolder contains SDNQ quantization."""+ transformer_path = mod.path / "transformer"+ if not transformer_path.is_dir():+ raise NotAMatchError("no transformer subfolder found")++ if not _is_sdnq_folder(transformer_path):+ raise NotAMatchError("transformer is not SDNQ quantized")++ # ...and it must actually be loadable. A marker (or SDNQ-shaped config) over a folder with no+ # weight file the loader can read is not a pipeline: discovery would leave `Transformer` out+ # of `submodels` while this check still said "yes, SDNQ pipeline", so the model installed and+ # only failed when a loader opened the transformer path at generation time. Same predicate+ # discovery uses, so identification and discovery cannot disagree about the transformer.+ if not _sdnq_component_dir_is_populated(transformer_path, SubModelType.Transformer, _SDNQ_TRANSFORMER_ONLY):+ raise NotAMatchError("transformer folder holds no weights its loader can read")++ @classmethod+ def _get_variant_or_raise(cls, mod: ModelOnDisk) -> FluxVariantType:+ """Determine the Flux variant from the transformer config."""+ transformer_config = get_config_dict_or_raise(mod.path / "transformer" / "config.json")++ # Check for guidance_embeds to determine if it's Dev or Schnell+ guidance_embeds = transformer_config.get("guidance_embeds", False)+ in_channels = transformer_config.get("in_channels", 64)++ if guidance_embeds and in_channels == 384:+ return FluxVariantType.DevFill+ elif guidance_embeds:+ return FluxVariantType.Dev+ else:+ return FluxVariantType.Schnell++ @classmethod+ def _get_repo_variant(cls, mod: ModelOnDisk) -> ModelRepoVariant:+ """Determine the repo variant from the model files."""+ weight_files = list(mod.path.glob("**/*.safetensors"))+ weight_files.extend(list(mod.path.glob("**/*.bin")))+ for x in weight_files:+ if ".fp16" in x.suffixes:+ return ModelRepoVariant.FP16+ if "openvino_model" in x.name:+ return ModelRepoVariant.OpenVINO+ if "flax_model" in x.name:+ return ModelRepoVariant.Flax+ if x.suffix == ".onnx":+ return ModelRepoVariant.ONNX+ return ModelRepoVariant.Default++ @classmethod+ def _get_submodels(cls, mod: ModelOnDisk) -> dict[SubModelType, SubmodelDefinition]:+ """Extract submodels from model_index.json for Flux SDNQ diffusers format."""+ config = get_config_dict_or_raise(common_config_paths(mod.path))++ submodels: dict[SubModelType, SubmodelDefinition] = {}++ for key, value in config.items():+ # Skip metadata fields and invalid entries+ if key.startswith("_") or not (isinstance(value, list) and len(value) == 2):+ continue++ _library_name, class_name = value++ # Skip null entries+ if class_name is None:+ continue++ resolved = _SDNQ_FLUX1_COMPONENT_BY_CLASS_NAME.get(class_name)+ if resolved is None:+ continue+ submodel_type, model_type, accepted_class_names = resolved++ # Same two guards as the FLUX.2 / Z-Image pipelines: the index advertises what a pipeline+ # *should* have, so a partial download keeps a complete index over missing or empty+ # folders, and the advertised class is a claim about the folder rather than a fact.+ # Without these, a half-downloaded pipeline looks complete until generation time.+ component_path = mod.path / key+ if not _sdnq_component_dir_is_populated(component_path, submodel_type, _SDNQ_FLUX1_ALWAYS_SDNQ_LOADED):+ continue+ if not _sdnq_component_matches_advertised_class(+ component_path,+ accepted_class_names,+ require_declaration=submodel_type not in _WEIGHTLESS_SUBMODEL_TYPES,+ ):+ continue++ submodels[submodel_type] = SubmodelDefinition(+ path_or_prefix=component_path.resolve().as_posix(),+ model_type=model_type,+ variant=None,+ )++ return submodels++class Main_Diffusers_ErnieImage_Config(Diffusers_Config_Base, Main_Config_Base, Config_Base):"""Model config for ERNIE-Image diffusers models (ERNIE-Image, ERNIE-Image-Turbo)."""@@ -2021,6 +2868,7 @@ class Main_Diffusers_ErnieImage_Config(Diffusers_Config_Base, Main_Config_Base,@classmethoddef from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:raise_if_not_dir(mod)+raise_for_override_fields(cls, override_fields)raise_for_class_name(diff --git a/invokeai/backend/model_manager/configs/qwen3_encoder.py b/invokeai/backend/model_manager/configs/qwen3_encoder.pyindex 05435eda03..1cd98729b8 100644--- a/invokeai/backend/model_manager/configs/qwen3_encoder.py+++ b/invokeai/backend/model_manager/configs/qwen3_encoder.py@@ -14,6 +14,7 @@ from invokeai.backend.model_manager.configs.identification_utils import (from invokeai.backend.model_manager.model_on_disk import ModelOnDiskfrom invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, Qwen3VariantTypefrom invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensordef _has_qwen3_keys(state_dict: dict[str | int, Any]) -> bool:@@ -46,6 +47,22 @@ def _has_ggml_tensors(state_dict: dict[str | int, Any]) -> bool:return any(isinstance(v, GGMLTensor) for v in state_dict.values())+def _has_sdnq_tensors(state_dict: dict[str | int, Any]) -> bool:+ """Check if state dict contains SDNQTensor instances."""+ return any(isinstance(v, SDNQTensor) for v in state_dict.values())+++def _has_sdnq_keys(state_dict: dict[str | int, Any]) -> bool:+ """Check if state dict has SDNQ-style keys (weight + scale pairs)."""+ keys = {k for k in state_dict.keys() if isinstance(k, str)}+ for key in keys:+ if key.endswith(".weight"):+ base = key[:-7]+ if f"{base}.scale" in keys:+ return True+ return False++def _has_t5_encoder_keys(state_dict: dict[str | int, Any]) -> bool:"""Check if state dict looks like a llama.cpp T5 encoder.@@ -95,6 +112,25 @@ def _has_qwen_vl_visual_tower(state_dict: dict[str | int, Any]) -> bool:return False+def _has_qwen3_specific_keys(state_dict: dict[str | int, Any]) -> bool:+ """Check for Qwen3-only QK-normalization weights (``q_norm``/``k_norm`` per attention block).++ Qwen3 adds an RMSNorm on the query and key projections that Qwen2 does not have. A Qwen2+ causal LM otherwise satisfies the generic ``_has_qwen3_keys`` heuristic (same ``model.layers.*``+ / ``model.embed_tokens.weight`` layout), so this is the discriminator that keeps a Qwen2 file+ from being accepted as a Qwen3 encoder the loader would fail to build. Covers both the+ PyTorch/diffusers naming and the llama.cpp/GGUF naming.+ """+ for key in state_dict.keys():+ if not isinstance(key, str):+ continue+ if ".self_attn.q_norm." in key or ".self_attn.k_norm." in key:+ return True+ if ".attn_q_norm." in key or ".attn_k_norm." in key: # llama.cpp / GGUF layout+ return True+ return False++def _get_qwen3_variant_from_state_dict(state_dict: dict[str | int, Any]) -> Optional[Qwen3VariantType]:"""Determine Qwen3 variant (0.6B, 4B, or 8B) from state dict based on hidden_size.@@ -221,6 +257,22 @@ class Qwen3Encoder_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):raise NotAMatchError("state dict looks like GGUF quantized")+# Transformers architectures the unquantized Qwen3 encoder config accepts.+_QWEN3_ENCODER_ARCHITECTURES = {+ "Qwen2VLForConditionalGeneration",+ "Qwen2ForCausalLM",+ "Qwen3ForCausalLM",+}++# Architectures the SDNQ Qwen encoder loaders can actually instantiate. Both the standalone+# Qwen3EncoderSDNQLoader and the FLUX.2 / Z-Image pipeline loaders reconstruct a text-only+# Qwen3Config + Qwen3ForCausalLM from the state dict, so they can only load a Qwen3 model: a Qwen2+# state dict lacks Qwen3-specific parameters (q/k normalization), and a Qwen-VL state dict also+# carries visual-tower weights. Accepting those classes during identification produces folders the+# loader's strict incomplete-load guard would reject, so the SDNQ paths must narrow to this set.+_SDNQ_LOADABLE_QWEN_ARCHITECTURES = {"Qwen3ForCausalLM"}++class Qwen3Encoder_Qwen3Encoder_Config(Config_Base):"""Configuration for Qwen3 Encoder models in a diffusers-like format.@@ -274,20 +326,40 @@ class Qwen3Encoder_Qwen3Encoder_Config(Config_Base):)# Qwen3 uses Qwen2VLForConditionalGeneration or similar- raise_for_class_name(- expected_config_path,- {- "Qwen2VLForConditionalGeneration",- "Qwen2ForCausalLM",- "Qwen3ForCausalLM",- },- )+ raise_for_class_name(expected_config_path, _QWEN3_ENCODER_ARCHITECTURES)++ # Reject SDNQ-quantized encoders so Qwen3Encoder_SDNQ_Folder_Config matches them instead.+ # A real SDNQ Qwen3 encoder has the same Qwen3 config class name as an unquantized one, so+ # without this guard both configs accept the folder — and since they share the Qwen3Encoder+ # type, the factory tiebreak is non-deterministic. If it picked this (unquantized) config,+ # the non-SDNQ loader would then mis-read the packed uint8 weights.+ cls._reject_if_sdnq_quantized(mod)# Determine variant from config.json hidden_sizevariant = cls._get_variant_from_config(expected_config_path)return cls(variant=variant, **override_fields)+ @classmethod+ def _reject_if_sdnq_quantized(cls, mod: ModelOnDisk) -> None:+ # Primary signal: quantization_config.json with quant_method="sdnq" (at root or in+ # text_encoder/). Fallback: SDNQ-style weight+scale key pairs in the state dict. This mirrors+ # the detection in Qwen3Encoder_SDNQ_Folder_Config so the two stay mutually exclusive.+ for folder in (mod.path, mod.path / "text_encoder"):+ quant_config_path = folder / "quantization_config.json"+ if not quant_config_path.exists():+ continue+ try:+ with open(quant_config_path, "r", encoding="utf-8") as f:+ quant_config = json.load(f)+ except (json.JSONDecodeError, OSError):+ continue+ if quant_config.get("quant_method") == "sdnq":+ raise NotAMatchError("folder is SDNQ-quantized; use Qwen3Encoder_SDNQ_Folder_Config")++ if _has_sdnq_keys(mod.load_state_dict()):+ raise NotAMatchError("state dict looks SDNQ-quantized; use Qwen3Encoder_SDNQ_Folder_Config")+@classmethoddef _get_variant_from_config(cls, config_path) -> Qwen3VariantType:"""Get variant from config.json based on hidden_size, or raise NotAMatch if unknown."""@@ -377,3 +449,212 @@ class Qwen3Encoder_GGUF_Config(Checkpoint_Config_Base, Config_Base):has_ggml = _has_ggml_tensors(mod.load_state_dict())if not has_ggml:raise NotAMatchError("state dict does not look like GGUF quantized")+++class Qwen3Encoder_SDNQ_Config(Checkpoint_Config_Base, Config_Base):+ """Configuration for SDNQ-quantized Qwen3 Encoder models (single file)."""++ base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)+ type: Literal[ModelType.Qwen3Encoder] = Field(default=ModelType.Qwen3Encoder)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)+ cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")+ variant: Qwen3VariantType = Field(description="Qwen3 model size variant (4B or 8B)")++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_file(mod)++ raise_for_override_fields(cls, override_fields)++ cls._validate_looks_like_qwen3_model(mod)++ cls._validate_looks_like_sdnq_quantized(mod)++ variant = cls._get_variant_or_default(mod)++ return cls(variant=variant, **override_fields)++ @classmethod+ def _get_variant_or_default(cls, mod: ModelOnDisk) -> Qwen3VariantType:+ """Get variant from state dict, defaulting to 4B if unknown."""+ state_dict = mod.load_state_dict()+ variant = _get_qwen3_variant_from_state_dict(state_dict)+ return variant if variant is not None else Qwen3VariantType.Qwen3_4B++ @classmethod+ def _validate_looks_like_qwen3_model(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _has_qwen3_keys(state_dict):+ raise NotAMatchError("state dict does not look like a Qwen3 model")+ # The SDNQ Qwen3 encoder loader always builds a text-only Qwen3ForCausalLM, so identification+ # must reject anything it cannot load. _has_qwen3_keys is generic across Qwen2/Qwen3/Qwen-VL:+ # - a Qwen-VL file bundles a visual tower (unexpected weights), and+ # - a Qwen2 causal LM lacks the Qwen3 QK-norm params (missing weights).+ # Mirror the folder config's architecture guard using the single file's state-dict keys.+ if _has_qwen_vl_visual_tower(state_dict):+ raise NotAMatchError(+ "state dict bundles a Qwen-VL visual tower; this is a Qwen-VL encoder, not a text-only Qwen3 encoder"+ )+ if not _has_qwen3_specific_keys(state_dict):+ raise NotAMatchError(+ "state dict lacks Qwen3 QK-normalization (q_norm/k_norm) weights; looks like a Qwen2 model, "+ "which the SDNQ Qwen3 encoder loader cannot build"+ )++ @classmethod+ def _validate_looks_like_sdnq_quantized(cls, mod: ModelOnDisk) -> None:+ state_dict = mod.load_state_dict()+ if not _has_sdnq_tensors(state_dict) and not _has_sdnq_keys(state_dict):+ raise NotAMatchError("state dict does not look like SDNQ quantized")+++class Qwen3Encoder_SDNQ_Folder_Config(Config_Base):+ """Configuration for folder-based SDNQ-quantized Qwen3 Encoder models.++ Used for SDNQ bundles where the text_encoder is a folder containing+ quantization_config.json and safetensors files with SDNQ keys.+ """++ base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)+ type: Literal[ModelType.Qwen3Encoder] = Field(default=ModelType.Qwen3Encoder)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)+ cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")+ variant: Qwen3VariantType = Field(description="Qwen3 model size variant (4B or 8B)")++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_dir(mod)++ raise_for_override_fields(cls, override_fields)++ matched = False++ # Check for quantization_config.json with quant_method="sdnq"+ quant_config_path = mod.path / "quantization_config.json"+ if quant_config_path.exists():+ with open(quant_config_path, "r", encoding="utf-8") as f:+ quant_config = json.load(f)+ if quant_config.get("quant_method") == "sdnq":+ matched = True++ # Fallback: check if safetensors files have SDNQ-style keys+ if not matched:+ safetensors_files = list(mod.path.glob("*.safetensors"))+ if safetensors_files:+ state_dict = mod.load_state_dict()+ if _has_sdnq_keys(state_dict):+ matched = True++ if not matched:+ raise NotAMatchError("directory does not look like an SDNQ-quantized Qwen3 encoder")++ # A root config.json next to tokenizer files is a complete causal LM (TextLLM), not a Qwen3+ # *encoder* subfolder. Mirror the guard in Qwen3Encoder_Qwen3Encoder_Config so an SDNQ+ # causal-LM download is left to the TextLLM path instead of being stored as qwen3_encoder.+ cls._reject_if_complete_causal_lm(mod)++ # Being SDNQ-quantized is not enough: an SDNQ transformer, VAE or other component folder+ # also has a quantization_config.json with quant_method="sdnq". Without verifying the folder+ # is actually a Qwen3 encoder, such a folder would be stored as type=qwen3_encoder and only+ # blow up later in the loader when Qwen-specific weights are missing. Require either a Qwen3+ # architecture in the (text_encoder/)config.json or Qwen3-specific state-dict keys.+ cls._validate_is_qwen3_encoder(mod)++ variant = cls._get_variant_from_dir(mod)+ return cls(variant=variant, **override_fields)++ @classmethod+ def _reject_if_complete_causal_lm(cls, mod: ModelOnDisk) -> None:+ # Only applies to the root-config layout: an encoder subfolder (text_encoder/config.json) is+ # unambiguous. When config.json sits at the root next to tokenizer files, this is a complete+ # causal LM, not a Qwen3 encoder subfolder (matches Qwen3Encoder_Qwen3Encoder_Config).+ if (mod.path / "text_encoder" / "config.json").exists():+ return+ if not (mod.path / "config.json").exists():+ return+ tokenizer_files = ("tokenizer.json", "tokenizer.model", "tokenizer_config.json")+ if any((mod.path / f).exists() for f in tokenizer_files):+ raise NotAMatchError(+ "directory looks like a complete causal LM (config.json and tokenizer files at root), "+ "not a standalone Qwen3 encoder"+ )++ @classmethod+ def _validate_is_qwen3_encoder(cls, mod: ModelOnDisk) -> None:+ # Strongest signal: a transformers-style config.json naming the architecture. The SDNQ+ # encoder loader can only build Qwen3ForCausalLM, so we accept only that class here. Crucially,+ # when a config.json declares a *different* architecture (e.g. Qwen2ForCausalLM or the+ # multimodal Qwen2VLForConditionalGeneration), we reject rather than falling through to the+ # key heuristic: the loader would fail on the missing Qwen3 params / extra visual-tower+ # weights, so identification must not accept a folder it cannot load.+ for cfg_path in (mod.path / "config.json", mod.path / "text_encoder" / "config.json"):+ if not cfg_path.exists():+ continue+ try:+ with open(cfg_path, "r", encoding="utf-8") as f:+ cfg = json.load(f)+ except (json.JSONDecodeError, OSError):+ continue+ names: set[str] = set(cfg.get("architectures") or [])+ class_name = cfg.get("_class_name")+ if isinstance(class_name, str):+ names.add(class_name)+ if not names:+ continue+ if names & _SDNQ_LOADABLE_QWEN_ARCHITECTURES:+ return+ raise NotAMatchError(+ f"architecture {sorted(names)} is not loadable by the SDNQ Qwen3 encoder loader "+ "(only Qwen3ForCausalLM is supported)"+ )++ # Fallback for folders without a usable config.json architecture: check the state dict. The+ # generic Qwen keys (model.layers. / model.embed_tokens.weight) are NOT enough — Qwen2 and+ # Qwen2-VL folders carry exactly the same ones, and the loader reconstructs a text-only+ # Qwen3ForCausalLM that fails on Qwen2's missing q/k-norm params and on Qwen-VL's visual+ # tower. Mirror the single-file path: reject a bundled visual tower and require the+ # Qwen3-only q/k-norm weights. An SDNQ transformer/VAE folder has transformer_blocks. /+ # decoder. keys instead and is rejected by both checks. Loading the state dict can raise for+ # sharded folders (multiple weight files), so treat that as "no usable signal" rather than+ # letting it abort identification.+ try:+ state_dict = mod.load_state_dict()+ except Exception:+ state_dict = {}++ if _has_qwen_vl_visual_tower(state_dict):+ raise NotAMatchError(+ "state dict bundles a Qwen-VL visual tower; this is a Qwen-VL encoder, not a text-only Qwen3 encoder"+ )+ if _has_qwen3_specific_keys(state_dict):+ return++ raise NotAMatchError(+ "directory does not look like a Qwen3 encoder (no Qwen3 config class, and no Qwen3-only "+ "q_norm/k_norm keys in the state dict)"+ )++ @classmethod+ def _get_variant_from_dir(cls, mod: ModelOnDisk) -> Qwen3VariantType:+ """Determine variant from config.json hidden_size, defaulting to 4B."""+ QWEN3_06B_HIDDEN_SIZE = 1024+ QWEN3_4B_HIDDEN_SIZE = 2560+ QWEN3_8B_HIDDEN_SIZE = 4096++ for cfg_path in (mod.path / "config.json", mod.path / "text_encoder" / "config.json"):+ if not cfg_path.exists():+ continue+ try:+ with open(cfg_path, "r", encoding="utf-8") as f:+ cfg = json.load(f)+ except (json.JSONDecodeError, OSError):+ continue+ hidden_size = cfg.get("hidden_size")+ if hidden_size == QWEN3_8B_HIDDEN_SIZE:+ return Qwen3VariantType.Qwen3_8B+ if hidden_size == QWEN3_4B_HIDDEN_SIZE:+ return Qwen3VariantType.Qwen3_4B+ if hidden_size == QWEN3_06B_HIDDEN_SIZE:+ return Qwen3VariantType.Qwen3_06B+ break+ return Qwen3VariantType.Qwen3_4Bdiff --git a/invokeai/backend/model_manager/configs/t5_encoder.py b/invokeai/backend/model_manager/configs/t5_encoder.pyindex 227ab488c3..9e0d73d8bf 100644--- a/invokeai/backend/model_manager/configs/t5_encoder.py+++ b/invokeai/backend/model_manager/configs/t5_encoder.py@@ -1,4 +1,6 @@-from typing import Any, Literal, Self+import json+from pathlib import Path+from typing import Any, Literal, Optional, Selffrom pydantic import Field@@ -15,6 +17,16 @@ from invokeai.backend.model_manager.configs.identification_utils import (from invokeai.backend.model_manager.model_on_disk import ModelOnDiskfrom invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelTypefrom invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.detection import folder_has_sdnq_keys+++def _safetensors_dir_has_sdnq_keys(directory) -> bool:+ """Return True if the safetensors in ``directory`` look SDNQ-quantized (weight + matching scale).++ Thin alias over the shared detector's key check — the pair is resolved across the union of all+ shards, since sharding routinely separates a weight from its scale.+ """+ return folder_has_sdnq_keys(directory)class T5Encoder_T5Encoder_Config(Config_Base):@@ -85,6 +97,102 @@ class T5Encoder_BnBLLMint8_Config(Config_Base):raise NotAMatchError("state dict does not look like bnb quantized llm_int8")+class T5Encoder_SDNQ_Config(Config_Base):+ """Configuration for SDNQ-quantized T5 Encoder models.++ Matches two layouts:++ 1. **Standalone T5 bundle**: ``mod.path`` is the pipeline-style root, with+ ``text_encoder_2/`` (and usually ``tokenizer_2/``) as subfolders.+ 2. **Inline submodel**: ``mod.path`` *is* the ``text_encoder_2`` folder itself —+ this is how a parent FluxPipeline / similar config registers its T5 submodel+ (``submodels[TextEncoder2].path_or_prefix`` points straight at the folder).++ In both cases, the SDNQ-quantized state lives next to a ``config.json`` declaring+ ``T5EncoderModel`` and is signalled either by ``quantization_config.json`` with+ ``quant_method == "sdnq"`` or by SDNQ-style ``weight`` + ``scale`` key pairs.+ """++ base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)+ type: Literal[ModelType.T5Encoder] = Field(default=ModelType.T5Encoder)+ format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)+ cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")++ @classmethod+ def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:+ raise_if_not_dir(mod)++ raise_for_override_fields(cls, override_fields)++ te_dir = cls._locate_text_encoder_dir(mod)+ raise_for_class_name(te_dir / "config.json", "T5EncoderModel")++ cls._raise_if_not_sdnq_quantized(te_dir)++ # Every FLUX workflow requests a Tokenizer2 alongside the encoder, and the loader can only load+ # it from a `tokenizer_2/` folder. Reject an install that has no resolvable tokenizer (e.g. a+ # bare inline `text_encoder_2` folder with no sibling `tokenizer_2/`) at identification time so+ # it never registers as a selectable T5 that then fails mid-workflow on the missing tokenizer.+ if cls.resolve_tokenizer_dir(mod.path) is None:+ raise NotAMatchError("no tokenizer_2 folder resolvable for this SDNQ T5 encoder layout")++ return cls(**override_fields)++ @staticmethod+ def resolve_text_encoder_dir(path: Path) -> Optional[Path]:+ """Return the directory holding T5's config.json + safetensors, or None.++ Two layouts: a standalone bundle (``path`` is the pipeline root, T5 under ``text_encoder_2/``)+ or an inline submodel (``path`` *is* the ``text_encoder_2`` folder).+ """+ nested = path / "text_encoder_2"+ if (nested / "config.json").exists():+ return nested+ if (path / "config.json").exists():+ return path+ return None++ @staticmethod+ def resolve_tokenizer_dir(path: Path) -> Optional[Path]:+ """Return the ``tokenizer_2/`` directory for either layout, or None if it doesn't exist.++ In the standalone-bundle layout ``tokenizer_2/`` is a child of the pipeline root; in the+ inline layout (``path`` is the ``text_encoder_2`` folder) it's a *sibling* of that folder.+ The encoder loader picks the encoder dir by the same layout test, so the tokenizer must too —+ using ``path / "tokenizer_2"`` unconditionally is wrong for the inline case.+ """+ if (path / "text_encoder_2" / "config.json").exists():+ candidate = path / "tokenizer_2"+ else:+ candidate = path.parent / "tokenizer_2"+ return candidate if candidate.exists() else None++ @classmethod+ def _locate_text_encoder_dir(cls, mod: ModelOnDisk):+ """Return the directory that actually holds T5's config.json + safetensors."""+ te_dir = cls.resolve_text_encoder_dir(mod.path)+ if te_dir is None:+ raise NotAMatchError("no text_encoder_2/config.json or config.json at model root")+ return te_dir++ @classmethod+ def _raise_if_not_sdnq_quantized(cls, te_dir) -> None:+ quant_config_path = te_dir / "quantization_config.json"+ if quant_config_path.exists():+ try:+ with open(quant_config_path, "r", encoding="utf-8") as f:+ quant_config = json.load(f)+ except (OSError, ValueError):+ quant_config = {}+ if quant_config.get("quant_method") == "sdnq":+ return++ if _safetensors_dir_has_sdnq_keys(te_dir):+ return++ raise NotAMatchError("text_encoder_2 does not look like an SDNQ-quantized T5 encoder")++class T5Encoder_GGUF_Config(Checkpoint_Config_Base, Config_Base):"""Configuration for GGUF-quantized T5 text encoder models in a single .gguf file.diff --git a/invokeai/backend/model_manager/load/load_default.py b/invokeai/backend/model_manager/load/load_default.pyindex ca8ba6d5ab..70035de26b 100644--- a/invokeai/backend/model_manager/load/load_default.py+++ b/invokeai/backend/model_manager/load/load_default.py@@ -30,6 +30,41 @@ from invokeai.backend.model_manager.taxonomy import (from invokeai.backend.util.devices import TorchDevicefrom invokeai.backend.util.fp8 import FP8_COMPUTE_DTYPE_ATTR, set_fp8_compute_dtype++def put_in_eval_mode(model: AnyModel) -> AnyModel:+ """Put a freshly constructed model into inference mode.++ Applied once here rather than in each loader, because it is the loaders that keep getting this+ wrong and there are dozens of them. `from_pretrained` calls `.eval()` on what it returns, but a+ great many loaders build the module themselves — `accelerate.init_empty_weights()` plus+ `load_state_dict()` — which leaves `training` True. Anything dropout- or batchnorm-sensitive in+ such a tree then behaves as if it were training, silently, during inference.++ `_load_model` is the single construction choke point every loader passes through, so covering it+ here also covers loaders that do not exist yet. `.eval()` is idempotent, so the loaders that+ already call it are unaffected. Non-module returns (tokenizers, schedulers, IP-Adapter wrappers,+ pipelines) pass through untouched.+ """+ if isinstance(model, torch.nn.Module):+ model.eval()+ return model+++def resolve_submodel_path(config: AnyModelConfig, submodel_type: SubModelType, fallback: Path) -> Path:+ """Where a pipeline component actually lives, preferring what identification recorded.++ `model_index.json` names its components with arbitrary keys, and discovery stores the key it saw+ in `submodels[...].path_or_prefix`. Reconstructing `model_path / "<slot name>"` at load time+ instead assumes the key always equals the slot name, so a pipeline that calls its CLIP encoder+ something else passes discovery and is then loaded from a directory that does not exist.++ `fallback` is used when the config carries no such entry — configs persisted before submodel+ discovery existed, and the layouts where the component folder *is* the model path.+ """+ discovered = (getattr(config, "submodels", None) or {}).get(submodel_type)+ return Path(discovered.path_or_prefix) if discovered else fallback++# Layer classes that benefit from FP8 storage. Mirrors diffusers'# `_GO_LC_SUPPORTED_PYTORCH_LAYERS` so the plain-nn.Module fallback path makes the same# precision/quality trade-offs as the ModelMixin path. Notably excludes norm and embedding@@ -180,7 +215,7 @@ class ModelLoader(ModelLoaderBase):self._ram_cache.make_room(self.get_size_fs(config, Path(config.path), submodel_type))ram_after_room = MemorySnapshot.capture().process_ram if log_mem else 0with skip_torch_weight_init():- loaded_model = self._load_model(config, submodel_type)+ loaded_model = put_in_eval_mode(self._load_model(config, submodel_type))if log_mem:ram_peak = MemorySnapshot.capture().process_ramself._logger.info(@@ -223,9 +258,25 @@ class ModelLoader(ModelLoaderBase):self, config: AnyModelConfig, model_path: Path, submodel_type: Optional[SubModelType] = None) -> int:"""Get the size of the model on disk."""+ # Size the folder the model will actually be loaded from. This has to track+ # `resolve_submodel_path`, or a pipeline whose index calls its CLIP encoder `clip_encoder`+ # gets sized at the non-existent `text_encoder/` — 0 bytes — and `make_room()` reserves+ # nothing before a multi-GB component is read. The conventional case is unchanged: only a+ # component recorded somewhere other than its slot name takes the branch below.+ subfolder = submodel_type.value if submodel_type else None+ if submodel_type is not None:+ conventional = model_path / submodel_type.value+ resolved = resolve_submodel_path(config, submodel_type, conventional)+ if resolved != conventional:+ try:+ subfolder = resolved.relative_to(model_path).as_posix()+ except ValueError:+ # Recorded outside this model's directory — size that directory directly.+ model_path, subfolder = resolved, None+return calc_model_size_by_fs(model_path=model_path,- subfolder=submodel_type.value if submodel_type else None,+ subfolder=subfolder,variant=config.repo_variant if isinstance(config, Diffusers_Config_Base) else None,)diff --git a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.pyindex eac3549b5a..a6ecf84dde 100644--- a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py+++ b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py@@ -8,6 +8,7 @@ from invokeai.backend.model_manager.load.model_cache.torch_module_autocast.custoadd_nullable_tensors,)from invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensorclass CustomConv2d(torch.nn.Conv2d, CustomModuleMixin):@@ -17,7 +18,7 @@ class CustomConv2d(torch.nn.Conv2d, CustomModuleMixin):tensor is not Noneand input.is_floating_point()and tensor.is_floating_point()- and not isinstance(tensor, GGMLTensor)+ and not isinstance(tensor, (GGMLTensor, SDNQTensor))and tensor.dtype != input.dtype):tensor = tensor.to(dtype=input.dtype)@@ -57,13 +58,13 @@ class CustomConv2d(torch.nn.Conv2d, CustomModuleMixin):elif input.is_floating_point() and ((self.weight.is_floating_point()- and not isinstance(self.weight, GGMLTensor)+ and not isinstance(self.weight, (GGMLTensor, SDNQTensor))and self.weight.dtype != input.dtype)or (self.bias is not Noneand self.bias.is_floating_point()- and not isinstance(self.bias, GGMLTensor)+ and not isinstance(self.bias, (GGMLTensor, SDNQTensor))and self.bias.dtype != input.dtype)):diff --git a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.pyindex 0f538caa5a..efc2d3738c 100644--- a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py+++ b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py@@ -11,6 +11,7 @@ from invokeai.backend.model_manager.load.model_cache.torch_module_autocast.custofrom invokeai.backend.patches.layers.param_shape_utils import get_param_shapefrom invokeai.backend.quantization.bnb_llm_int8 import InvokeLinear8bitLtfrom invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensorclass CustomInvokeLinear8bitLt(InvokeLinear8bitLt, CustomModuleMixin):@@ -20,7 +21,7 @@ class CustomInvokeLinear8bitLt(InvokeLinear8bitLt, CustomModuleMixin):tensor is not Noneand input.is_floating_point()and tensor.is_floating_point()- and not isinstance(tensor, GGMLTensor)+ and not isinstance(tensor, (GGMLTensor, SDNQTensor))and tensor.dtype != input.dtype):tensor = tensor.to(dtype=input.dtype)diff --git a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.pyindex 75328441e2..5baa0bb7d1 100644--- a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py+++ b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py@@ -13,6 +13,7 @@ from invokeai.backend.model_manager.load.model_cache.torch_module_autocast.custofrom invokeai.backend.patches.layers.param_shape_utils import get_param_shapefrom invokeai.backend.quantization.bnb_nf4 import InvokeLinearNF4from invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensorclass CustomInvokeLinearNF4(InvokeLinearNF4, CustomModuleMixin):@@ -22,7 +23,7 @@ class CustomInvokeLinearNF4(InvokeLinearNF4, CustomModuleMixin):tensor is not Noneand input.is_floating_point()and tensor.is_floating_point()- and not isinstance(tensor, GGMLTensor)+ and not isinstance(tensor, (GGMLTensor, SDNQTensor))and tensor.dtype != input.dtype):tensor = tensor.to(dtype=input.dtype)diff --git a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.pyindex 77227583cd..451c5a9c86 100644--- a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py+++ b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py@@ -10,6 +10,7 @@ from invokeai.backend.patches.layers.base_layer_patch import BaseLayerPatchfrom invokeai.backend.patches.layers.flux_control_lora_layer import FluxControlLoRALayerfrom invokeai.backend.patches.layers.lora_layer import LoRALayerfrom invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensordef linear_lora_forward(input: torch.Tensor, lora_layer: LoRALayer, lora_weight: float) -> torch.Tensor:@@ -82,7 +83,7 @@ class CustomLinear(torch.nn.Linear, CustomModuleMixin):tensor is not Noneand input.is_floating_point()and tensor.is_floating_point()- and not isinstance(tensor, GGMLTensor)+ and not isinstance(tensor, (GGMLTensor, SDNQTensor))and tensor.dtype != input.dtype):tensor = tensor.to(dtype=input.dtype)@@ -111,7 +112,7 @@ class CustomLinear(torch.nn.Linear, CustomModuleMixin):or (self.bias is not Noneand self.bias.is_floating_point()- and not isinstance(self.bias, GGMLTensor)+ and not isinstance(self.bias, (GGMLTensor, SDNQTensor))and self.bias.dtype != input.dtype)):diff --git a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.pyindex 08ad15c4b6..9411b0d5b2 100644--- a/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py+++ b/invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py@@ -5,6 +5,7 @@ import torchfrom invokeai.backend.patches.layers.base_layer_patch import BaseLayerPatchfrom invokeai.backend.patches.layers.param_shape_utils import get_param_shapefrom invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensorclass CustomModuleMixin:@@ -58,6 +59,8 @@ class CustomModuleMixin:# Move to device and dequantize here. Doing it in the patch layer can result in redundant casts /# dequantizations.orig_params[param_name] = param.to(device=device).get_dequantized_tensor()+ elif type(param) is SDNQTensor:+ orig_params[param_name] = param.to(device=device).get_dequantized_tensor()else:orig_params[param_name] = torch.empty(get_param_shape(param), device="meta")diff --git a/invokeai/backend/model_manager/load/model_loaders/flux.py b/invokeai/backend/model_manager/load/model_loaders/flux.pyindex bea68c56fd..8ad9459735 100644--- a/invokeai/backend/model_manager/load/model_loaders/flux.py+++ b/invokeai/backend/model_manager/load/model_loaders/flux.py@@ -6,6 +6,7 @@ from typing import Any, Optionalimport accelerateimport torch+from diffusers import AutoencoderKLfrom safetensors.torch import load_filefrom transformers import (AutoConfig,@@ -49,14 +50,19 @@ from invokeai.backend.model_manager.configs.main import (Main_Checkpoint_FLUX_Config,Main_GGUF_Flux2_Config,Main_GGUF_FLUX_Config,+ Main_SDNQ_Diffusers_Flux2_Config,+ Main_SDNQ_Diffusers_FLUX_Config,+ Main_SDNQ_Flux2_Config,+ Main_SDNQ_FLUX_Config,)from invokeai.backend.model_manager.configs.t5_encoder import (T5Encoder_BnBLLMint8_Config,T5Encoder_GGUF_Config,+ T5Encoder_SDNQ_Config,T5Encoder_T5Encoder_Config,)from invokeai.backend.model_manager.configs.vae import VAE_Checkpoint_Config_Base, VAE_Checkpoint_Flux2_Config-from invokeai.backend.model_manager.load.load_default import ModelLoader+from invokeai.backend.model_manager.load.load_default import ModelLoader, resolve_submodel_pathfrom invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistryfrom invokeai.backend.model_manager.load.model_loaders.flux2_state_dict_utils import (convert_flux2_bfl_to_diffusers,@@ -76,8 +82,14 @@ from invokeai.backend.model_manager.util.model_util import ()from invokeai.backend.quantization.gguf.loaders import gguf_sd_loaderfrom invokeai.backend.quantization.gguf.utils import TORCH_COMPATIBLE_QTYPES+from invokeai.backend.quantization.sdnq.detection import is_sdnq_folder+from invokeai.backend.quantization.sdnq.loaders import raise_on_incomplete_sdnq_load, sdnq_sd_loader+from invokeai.backend.util.logging import InvokeAILoggerfrom invokeai.backend.util.silence_warnings import SilenceWarnings+logger = InvokeAILogger.get_logger(__name__)++try:from invokeai.backend.quantization.bnb_llm_int8 import quantize_model_llm_int8from invokeai.backend.quantization.bnb_nf4 import quantize_model_nf4@@ -350,6 +362,59 @@ class T5EncoderCheckpointModel(ModelLoader):)[email protected](base=BaseModelType.Any, type=ModelType.T5Encoder, format=ModelFormat.SDNQQuantized)+class T5EncoderSDNQLoader(ModelLoader):+ """Class to load SDNQ-quantized T5 Encoder models."""++ def _load_model(+ self,+ config: AnyModelConfig,+ submodel_type: Optional[SubModelType] = None,+ ) -> AnyModel:+ if not isinstance(config, T5Encoder_SDNQ_Config):+ raise ValueError("Only T5Encoder_SDNQ_Config models are supported here.")++ match submodel_type:+ case SubModelType.Tokenizer2 | SubModelType.Tokenizer3:+ # tokenizer_2/ is a child of the pipeline root in the standalone layout but a sibling+ # of the text_encoder_2 folder in the inline layout — resolve it the same way the+ # encoder dir is resolved (identification already rejects installs where it's absent).+ tokenizer_dir = T5Encoder_SDNQ_Config.resolve_tokenizer_dir(Path(config.path))+ if tokenizer_dir is None:+ raise ValueError(f"No tokenizer_2 folder found for SDNQ T5 encoder at {config.path}")+ return T5Tokenizer.from_pretrained(tokenizer_dir, max_length=512, local_files_only=True)+ case SubModelType.TextEncoder2 | SubModelType.TextEncoder3:+ return self._load_text_encoder(config)++ raise ValueError(+ f"Only Tokenizer and TextEncoder submodels are currently supported. Received: {submodel_type.value if submodel_type else 'None'}"+ )++ def _load_text_encoder(self, config: T5Encoder_SDNQ_Config) -> AnyModel:+ # Two layouts: either config.path is the pipeline root (T5 lives under text_encoder_2/),+ # or config.path is the text_encoder_2 folder itself (FluxPipeline submodel case).+ te_dir = T5Encoder_SDNQ_Config.resolve_text_encoder_dir(Path(config.path))+ if te_dir is None:+ raise ValueError(f"No T5 encoder config.json found for SDNQ T5 encoder at {config.path}")++ model_config = AutoConfig.from_pretrained(te_dir, local_files_only=True)+ with accelerate.init_empty_weights():+ model = AutoModelForTextEncoding.from_config(model_config)++ sd = sdnq_sd_loader(te_dir, compute_dtype=torch.bfloat16)++ # T5's embed_tokens and shared point to the same parameter; the SDNQ state dict only carries+ # one of them, so encoder.embed_tokens.weight is expected to be missing (re-tied below). Use+ # the explicit helper rather than assert, which `python -O` strips (silent partial loads).+ missing_keys, unexpected_keys = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load(+ "SDNQ T5 encoder", missing_keys, unexpected_keys, allowed_missing={"encoder.embed_tokens.weight"}+ )+ if "encoder.embed_tokens.weight" in missing_keys:+ model.encoder.embed_tokens.weight = model.shared.weight+ return model++@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.T5Encoder, format=ModelFormat.GGUFQuantized)class T5EncoderGGUFModel(ModelLoader):"""Class to load GGUF-quantized T5 text encoders (single .gguf file, llama.cpp naming).@@ -1084,6 +1149,177 @@ class Flux2CheckpointModel(ModelLoader):return sd[email protected](base=BaseModelType.Flux2, type=ModelType.Main, format=ModelFormat.SDNQQuantized)+class Flux2SDNQCheckpointModel(ModelLoader):+ """Class to load SDNQ-quantized FLUX.2 transformer models (e.g. Klein 4B / 9B).++ The checkpoint is expected to be in diffusers layout (i.e. the same key naming as+ Flux2Transformer2DModel.state_dict()), since SDNQ tooling typically operates on+ diffusers state dicts. BFL-layout SDNQ FLUX.2 checkpoints are not supported here.+ """++ def _load_model(+ self,+ config: AnyModelConfig,+ submodel_type: Optional[SubModelType] = None,+ ) -> AnyModel:+ if not isinstance(config, (Main_SDNQ_Flux2_Config, Main_SDNQ_Diffusers_Flux2_Config)):+ raise ValueError(+ "Only Main_SDNQ_Flux2_Config or Main_SDNQ_Diffusers_Flux2_Config models are supported here."+ )++ # Single-file SDNQ FLUX.2 checkpoints only ship the transformer.+ if isinstance(config, Main_SDNQ_Flux2_Config):+ if submodel_type == SubModelType.Transformer:+ return self._load_from_singlefile(config)+ raise ValueError(+ f"Single-file SDNQ FLUX.2 checkpoints only provide the Transformer submodel. "+ f"Received: {submodel_type.value if submodel_type else 'None'}"+ )++ # Full Flux2 pipeline folder — dispatch each submodel from its own subfolder.+ match submodel_type:+ case SubModelType.Transformer:+ return self._load_transformer_from_folder(config)+ case SubModelType.TextEncoder:+ return self._load_text_encoder(config)+ case SubModelType.Tokenizer:+ return self._load_tokenizer(config)+ case SubModelType.VAE:+ return self._load_vae(config)++ raise ValueError(+ f"Unsupported submodel type for SDNQ FLUX.2 pipeline: {submodel_type.value if submodel_type else 'None'}"+ )++ def _load_transformer_from_folder(self, config: Main_SDNQ_Diffusers_Flux2_Config) -> AnyModel:+ from diffusers import Flux2Transformer2DModel++ model_path = Path(config.path)+ transformer_path = resolve_submodel_path(+ config,+ SubModelType.Transformer,+ model_path / "transformer" if (model_path / "transformer").is_dir() else model_path,+ )++ with accelerate.init_empty_weights():+ model = Flux2Transformer2DModel.from_config(+ Flux2Transformer2DModel.load_config(transformer_path, local_files_only=True)+ )++ sd = sdnq_sd_loader(transformer_path, compute_dtype=torch.bfloat16)+ # The FLUX.2 transformer has no tied weights, so we expect a complete state dict — a missing+ # key means a required parameter is left on the meta device and would fail later.+ missing, unexpected = model.load_state_dict(sd, assign=True, strict=False)+ raise_on_incomplete_sdnq_load("SDNQ FLUX.2 transformer", missing, unexpected)+ return model++ def _load_text_encoder(self, config: Main_SDNQ_Diffusers_Flux2_Config) -> AnyModel:+ from transformers import AutoConfig, Qwen3ForCausalLM++ te_dir = resolve_submodel_path(config, SubModelType.TextEncoder, Path(config.path) / "text_encoder")+ te_config = AutoConfig.from_pretrained(te_dir, local_files_only=True)+ with accelerate.init_empty_weights():+ model = Qwen3ForCausalLM(te_config)++ sd = sdnq_sd_loader(te_dir, compute_dtype=torch.bfloat16)+ missing, unexpected = model.load_state_dict(sd, assign=True, strict=False)+ if unexpected:+ raise ValueError(f"Unexpected keys loading SDNQ Qwen3 text encoder: {unexpected}")+ if missing and missing != ["lm_head.weight"]:+ raise ValueError(f"Unexpected missing keys loading SDNQ Qwen3 text encoder: {missing}")+ if missing == ["lm_head.weight"]:+ model.lm_head.weight = model.model.embed_tokens.weight+ return model++ def _load_tokenizer(self, config: Main_SDNQ_Diffusers_Flux2_Config) -> AnyModel:+ from transformers import AutoTokenizer++ tok_dir = resolve_submodel_path(config, SubModelType.Tokenizer, Path(config.path) / "tokenizer")+ return AutoTokenizer.from_pretrained(tok_dir, local_files_only=True)++ def _load_vae(self, config: Main_SDNQ_Diffusers_Flux2_Config) -> AnyModel:+ # FLUX.2 Klein uses AutoencoderKLFlux2 (not the generic AutoencoderKL). Both ship as+ # plain bf16 in this pipeline (the VAE itself isn't SDNQ-quantized).+ from diffusers import AutoencoderKL, AutoencoderKLFlux2++ vae_dir = resolve_submodel_path(config, SubModelType.VAE, Path(config.path) / "vae")+ # Pick the right class based on what the on-disk config.json declares.+ try:+ cls_name = AutoencoderKL.load_config(vae_dir, local_files_only=True).get("_class_name", "")+ except Exception:+ cls_name = ""+ if cls_name == "AutoencoderKLFlux2":+ return AutoencoderKLFlux2.from_pretrained(vae_dir, local_files_only=True)+ return AutoencoderKL.from_pretrained(vae_dir, local_files_only=True)++ def _load_from_singlefile(self, config: Main_SDNQ_Flux2_Config) -> AnyModel:+ from diffusers import Flux2Transformer2DModel++ model_path = Path(config.path)++ sd = sdnq_sd_loader(model_path, compute_dtype=torch.bfloat16)++ # Detect architecture from state dict shapes. SDNQTensor.shape returns the+ # *dequantized* shape, so this works identically to the fp16 path.+ double_block_indices = [+ int(k.split(".")[1]) for k in sd.keys() if isinstance(k, str) and k.startswith("transformer_blocks.")+ ]+ single_block_indices = [+ int(k.split(".")[1]) for k in sd.keys() if isinstance(k, str) and k.startswith("single_transformer_blocks.")+ ]+ num_layers = max(double_block_indices) + 1 if double_block_indices else 5+ num_single_layers = max(single_block_indices) + 1 if single_block_indices else 20++ context_embedder_weight = sd.get("context_embedder.weight")+ if context_embedder_weight is not None:+ hidden_size = context_embedder_weight.shape[0]+ joint_attention_dim = context_embedder_weight.shape[1]+ else:+ hidden_size = 3072+ joint_attention_dim = 7680++ x_embedder_weight = sd.get("x_embedder.weight")+ in_channels = x_embedder_weight.shape[1] if x_embedder_weight is not None else 128++ attention_head_dim = 128+ num_attention_heads = hidden_size // attention_head_dim++ has_guidance = "time_guidance_embed.guidance_embedder.linear_1.weight" in sd++ with SilenceWarnings():+ with accelerate.init_empty_weights():+ model = Flux2Transformer2DModel(+ in_channels=in_channels,+ out_channels=in_channels,+ num_layers=num_layers,+ num_single_layers=num_single_layers,+ attention_head_dim=attention_head_dim,+ num_attention_heads=num_attention_heads,+ joint_attention_dim=joint_attention_dim,+ patch_size=1,+ )++ # Klein variants ship without guidance embeddings — zero-fill from the timestep+ # embedder dimensions so load_state_dict has a tensor for those slots.+ if not has_guidance:+ timestep_linear1 = sd.get("time_guidance_embed.timestep_embedder.linear_1.weight")+ if timestep_linear1 is not None:+ out_features, in_features = timestep_linear1.shape[0], timestep_linear1.shape[1]+ sd["time_guidance_embed.guidance_embedder.linear_1.weight"] = torch.zeros(+ out_features, in_features, dtype=torch.bfloat16+ )+ timestep_linear2 = sd.get("time_guidance_embed.timestep_embedder.linear_2.weight")+ if timestep_linear2 is not None:+ out2, in2 = timestep_linear2.shape[0], timestep_linear2.shape[1]+ sd["time_guidance_embed.guidance_embedder.linear_2.weight"] = torch.zeros(+ out2, in2, dtype=torch.bfloat16+ )++ model.load_state_dict(sd, assign=True)+ return model++@ModelLoaderRegistry.register(base=BaseModelType.Flux2, type=ModelType.Main, format=ModelFormat.GGUFQuantized)class Flux2GGUFCheckpointModel(ModelLoader):"""Class to load GGUF-quantized FLUX.2 transformer models."""@@ -1322,3 +1558,390 @@ class FluxReduxModelLoader(ModelLoader):model.load_state_dict(sd, assign=True)model.to(dtype=torch.bfloat16)return model+++# Re-exported from the shared detector: the loader's dispatch and identification must agree about+# what counts as an SDNQ folder, including markerless exports.+_is_sdnq_folder = is_sdnq_folder++[email protected](base=BaseModelType.Flux, type=ModelType.Main, format=ModelFormat.SDNQQuantized)+class FluxSDNQDiffusersModel(ModelLoader):+ """Class to load SDNQ-quantized Flux models in diffusers format."""++ def _load_model(+ self,+ config: AnyModelConfig,+ submodel_type: Optional[SubModelType] = None,+ ) -> AnyModel:+ logger.debug(+ "[SDNQ] FluxSDNQDiffusersModel._load_model called with config=%s, submodel=%s",+ type(config).__name__,+ submodel_type,+ )+ # Handle single-file SDNQ checkpoint (Main_SDNQ_FLUX_Config)+ if isinstance(config, Main_SDNQ_FLUX_Config):+ if submodel_type == SubModelType.Transformer:+ return self._load_sdnq_transformer_checkpoint(config)+ raise ValueError(+ f"Only Transformer submodels are supported for checkpoint format. Received: {submodel_type}"+ )++ # Handle diffusers-format SDNQ model (Main_SDNQ_Diffusers_FLUX_Config)+ if not isinstance(config, Main_SDNQ_Diffusers_FLUX_Config):+ raise ValueError(f"Expected Main_SDNQ_Diffusers_FLUX_Config, got {type(config).__name__}")++ if submodel_type is None:+ raise ValueError("A submodel type must be provided when loading main pipelines.")++ # Prefer the path discovery actually found. `model_index.json` names its components with+ # arbitrary keys, and identification records the key it saw — but reconstructing+ # `model_path / submodel_type.value` here assumes the key always equals the slot name. A+ # pipeline whose index calls its CLIP encoder something else is then discovered fine and+ # loaded from a folder that does not exist. Fall back to the conventional name when a config+ # predates submodel discovery.+ model_path = Path(config.path)+ submodel_path = resolve_submodel_path(config, submodel_type, model_path / submodel_type.value)++ # These branches build their modules by hand (`init_empty_weights` + `load_state_dict`)+ # rather than through `from_pretrained`, so they arrive in training mode — `put_in_eval_mode`+ # in `load_default._load_and_cache` is what puts every loaded model into inference mode.+ match submodel_type:+ case SubModelType.Transformer:+ return self._load_sdnq_transformer(submodel_path, config)+ case SubModelType.TextEncoder:+ return self._load_text_encoder(submodel_path)+ case SubModelType.TextEncoder2:+ return self._load_text_encoder_2(submodel_path)+ case SubModelType.Tokenizer:+ return CLIPTokenizer.from_pretrained(submodel_path, local_files_only=True)+ case SubModelType.Tokenizer2:+ return T5Tokenizer.from_pretrained(submodel_path, max_length=512, local_files_only=True)+ case SubModelType.VAE:+ return self._load_vae(submodel_path)+ case _:+ raise ValueError(f"Unsupported submodel type: {submodel_type}")++ def _load_sdnq_transformer_checkpoint(self, config: Main_SDNQ_FLUX_Config) -> AnyModel:+ """Load SDNQ transformer from single-file checkpoint."""+ model_path = Path(config.path)++ with accelerate.init_empty_weights():+ model = Flux(get_flux_transformers_params(config.variant))++ sd = sdnq_sd_loader(model_path, compute_dtype=torch.bfloat16)++ # Handle ComfyUI bundle format+ if "model.diffusion_model.double_blocks.0.img_attn.norm.key_norm.scale" in sd:+ sd = convert_bundle_to_flux_transformer_checkpoint(sd)++ model.load_state_dict(sd, assign=True)+ return model++ def _load_sdnq_transformer(self, transformer_path: Path, config: Main_SDNQ_Diffusers_FLUX_Config) -> AnyModel:+ """Load SDNQ-quantized transformer from diffusers folder."""+ logger.debug("[SDNQ] _load_sdnq_transformer called for %s", transformer_path)+ with accelerate.init_empty_weights():+ model = Flux(get_flux_transformers_params(config.variant))++ sd = sdnq_sd_loader(transformer_path, compute_dtype=torch.bfloat16)++ # Convert from diffusers format to BFL format+ sd = self._convert_diffusers_sd_to_bfl(sd)++ model.load_state_dict(sd, assign=True)+ return model++ def _convert_diffusers_sd_to_bfl(self, sd: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:+ """Convert a Flux transformer state dict from diffusers format to BFL format.++ Note: For SDNQTensor objects, Q/K/V tensors are dequantized before fusion since+ torch.cat doesn't work with quantized tensors. Other layers retain quantization.+ """+ from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor++ # Helper to dequantize SDNQTensor or return as-is+ def maybe_dequantize(t: torch.Tensor) -> torch.Tensor:+ if isinstance(t, SDNQTensor):+ return t.get_dequantized_tensor()+ return t++ # Helper to fuse weights, handling SDNQTensor+ def fuse_weights(*tensors: torch.Tensor) -> torch.Tensor:+ dequantized = [maybe_dequantize(t) for t in tensors]+ return torch.cat(dequantized, dim=0)++ def _swap_scale_shift_halves(t: torch.Tensor) -> torch.Tensor:+ """Swap the (scale, shift) halves along dim 0 to (shift, scale).++ diffusers' AdaLayerNormContinuous packs (scale, shift); BFL's LastLayer expects+ (shift, scale). Same memory, different interpretation — without this swap the final+ normalisation modulation is permuted and the output is high-frequency noise.+ """+ t = maybe_dequantize(t)+ if t.dim() < 1 or t.shape[0] % 2 != 0:+ return t+ scale, shift = t.chunk(2, dim=0)+ return torch.cat([shift, scale], dim=0)++ # Make a shallow copy so we can pop keys+ sd = sd.copy()+ new_sd: dict[str, torch.Tensor] = {}++ # Basic 1-to-1 key conversions+ basic_key_map = {+ # txt_in keys+ "context_embedder.bias": "txt_in.bias",+ "context_embedder.weight": "txt_in.weight",+ # guidance_in MLPEmbedder keys+ "time_text_embed.guidance_embedder.linear_1.bias": "guidance_in.in_layer.bias",+ "time_text_embed.guidance_embedder.linear_1.weight": "guidance_in.in_layer.weight",+ "time_text_embed.guidance_embedder.linear_2.bias": "guidance_in.out_layer.bias",+ "time_text_embed.guidance_embedder.linear_2.weight": "guidance_in.out_layer.weight",+ # vector_in MLPEmbedder keys+ "time_text_embed.text_embedder.linear_1.bias": "vector_in.in_layer.bias",+ "time_text_embed.text_embedder.linear_1.weight": "vector_in.in_layer.weight",+ "time_text_embed.text_embedder.linear_2.bias": "vector_in.out_layer.bias",+ "time_text_embed.text_embedder.linear_2.weight": "vector_in.out_layer.weight",+ # time_in MLPEmbedder keys+ "time_text_embed.timestep_embedder.linear_1.bias": "time_in.in_layer.bias",+ "time_text_embed.timestep_embedder.linear_1.weight": "time_in.in_layer.weight",+ "time_text_embed.timestep_embedder.linear_2.bias": "time_in.out_layer.bias",+ "time_text_embed.timestep_embedder.linear_2.weight": "time_in.out_layer.weight",+ # img_in keys+ "x_embedder.bias": "img_in.bias",+ "x_embedder.weight": "img_in.weight",+ # final_layer keys+ "proj_out.bias": "final_layer.linear.bias",+ "proj_out.weight": "final_layer.linear.weight",+ # norm_out.linear is the final AdaLayerNormContinuous. diffusers packs the linear+ # output as (scale, shift); BFL's LastLayer packs as (shift, scale). Swap the+ # halves of the weight and bias to keep the math correct.+ "norm_out.linear.bias": "final_layer.adaLN_modulation.1.bias",+ "norm_out.linear.weight": "final_layer.adaLN_modulation.1.weight",+ }+ # Keys whose first-axis halves (scale, shift) must be swapped to (shift, scale) for BFL.+ SWAP_SCALE_SHIFT_KEYS = {+ "norm_out.linear.bias",+ "norm_out.linear.weight",+ }+ for old_key, new_key in basic_key_map.items():+ v = sd.pop(old_key, None)+ if v is not None:+ if old_key in SWAP_SCALE_SHIFT_KEYS:+ v = _swap_scale_shift_halves(v)+ new_sd[new_key] = v++ # Handle the double_blocks (19 blocks for FLUX)+ block_index = 0+ while f"transformer_blocks.{block_index}.attn.add_q_proj.bias" in sd:+ from_prefix = f"transformer_blocks.{block_index}"+ to_prefix = f"double_blocks.{block_index}"++ # txt_attn.qkv (fuse add_q, add_k, add_v)+ new_sd[f"{to_prefix}.txt_attn.qkv.bias"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.add_q_proj.bias"),+ sd.pop(f"{from_prefix}.attn.add_k_proj.bias"),+ sd.pop(f"{from_prefix}.attn.add_v_proj.bias"),+ )+ new_sd[f"{to_prefix}.txt_attn.qkv.weight"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.add_q_proj.weight"),+ sd.pop(f"{from_prefix}.attn.add_k_proj.weight"),+ sd.pop(f"{from_prefix}.attn.add_v_proj.weight"),+ )++ # img_attn.qkv (fuse to_q, to_k, to_v)+ new_sd[f"{to_prefix}.img_attn.qkv.bias"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.to_q.bias"),+ sd.pop(f"{from_prefix}.attn.to_k.bias"),+ sd.pop(f"{from_prefix}.attn.to_v.bias"),+ )+ new_sd[f"{to_prefix}.img_attn.qkv.weight"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.to_q.weight"),+ sd.pop(f"{from_prefix}.attn.to_k.weight"),+ sd.pop(f"{from_prefix}.attn.to_v.weight"),+ )++ # 1-to-1 key mappings for double block+ double_block_key_map = {+ # img_attn+ "attn.norm_k.weight": "img_attn.norm.key_norm.scale",+ "attn.norm_q.weight": "img_attn.norm.query_norm.scale",+ "attn.to_out.0.weight": "img_attn.proj.weight",+ "attn.to_out.0.bias": "img_attn.proj.bias",+ # img_mlp+ "ff.net.0.proj.weight": "img_mlp.0.weight",+ "ff.net.0.proj.bias": "img_mlp.0.bias",+ "ff.net.2.weight": "img_mlp.2.weight",+ "ff.net.2.bias": "img_mlp.2.bias",+ # img_mod+ "norm1.linear.weight": "img_mod.lin.weight",+ "norm1.linear.bias": "img_mod.lin.bias",+ # txt_attn+ "attn.norm_added_q.weight": "txt_attn.norm.query_norm.scale",+ "attn.norm_added_k.weight": "txt_attn.norm.key_norm.scale",+ "attn.to_add_out.weight": "txt_attn.proj.weight",+ "attn.to_add_out.bias": "txt_attn.proj.bias",+ # txt_mlp+ "ff_context.net.0.proj.weight": "txt_mlp.0.weight",+ "ff_context.net.0.proj.bias": "txt_mlp.0.bias",+ "ff_context.net.2.weight": "txt_mlp.2.weight",+ "ff_context.net.2.bias": "txt_mlp.2.bias",+ # txt_mod+ "norm1_context.linear.weight": "txt_mod.lin.weight",+ "norm1_context.linear.bias": "txt_mod.lin.bias",+ }+ for from_key, to_key in double_block_key_map.items():+ v = sd.pop(f"{from_prefix}.{from_key}", None)+ if v is not None:+ new_sd[f"{to_prefix}.{to_key}"] = v++ block_index += 1++ # Handle the single_blocks (38 blocks for FLUX)+ block_index = 0+ while f"single_transformer_blocks.{block_index}.attn.to_q.bias" in sd:+ from_prefix = f"single_transformer_blocks.{block_index}"+ to_prefix = f"single_blocks.{block_index}"++ # linear1 (fuse to_q, to_k, to_v, proj_mlp)+ new_sd[f"{to_prefix}.linear1.bias"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.to_q.bias"),+ sd.pop(f"{from_prefix}.attn.to_k.bias"),+ sd.pop(f"{from_prefix}.attn.to_v.bias"),+ sd.pop(f"{from_prefix}.proj_mlp.bias"),+ )+ new_sd[f"{to_prefix}.linear1.weight"] = fuse_weights(+ sd.pop(f"{from_prefix}.attn.to_q.weight"),+ sd.pop(f"{from_prefix}.attn.to_k.weight"),+ sd.pop(f"{from_prefix}.attn.to_v.weight"),+ sd.pop(f"{from_prefix}.proj_mlp.weight"),+ )++ # 1-to-1 key mappings for single block+ single_block_key_map = {+ # linear2+ "proj_out.weight": "linear2.weight",+ "proj_out.bias": "linear2.bias",+ # modulation+ "norm.linear.weight": "modulation.lin.weight",+ "norm.linear.bias": "modulation.lin.bias",+ # norm+ "attn.norm_k.weight": "norm.key_norm.scale",+ "attn.norm_q.weight": "norm.query_norm.scale",+ }+ for from_key, to_key in single_block_key_map.items():+ v = sd.pop(f"{from_prefix}.{from_key}", None)+ if v is not None:+ new_sd[f"{to_prefix}.{to_key}"] = v++ block_index += 1++ # Any remaining keys that weren't converted - just pass through+ for k, v in sd.items():+ if k not in new_sd:+ new_sd[k] = v++ return new_sd++ def _load_text_encoder(self, text_encoder_path: Path) -> AnyModel:+ """Load text encoder (CLIP) - SDNQ or normal."""+ if _is_sdnq_folder(text_encoder_path):+ # SDNQ CLIP - need custom loading+ return self._load_sdnq_clip(text_encoder_path)+ # Normal CLIP+ return CLIPTextModel.from_pretrained(text_encoder_path, local_files_only=True)++ def _load_text_encoder_2(self, text_encoder_path: Path) -> AnyModel:+ """Load text encoder 2 (T5) - SDNQ or normal."""+ if _is_sdnq_folder(text_encoder_path):+ # SDNQ T5 - need custom loading+ return self._load_sdnq_t5(text_encoder_path)+ # Normal T5+ return T5EncoderModel.from_pretrained(+ text_encoder_path,+ torch_dtype="auto",+ low_cpu_mem_usage=True,+ local_files_only=True,+ )++ def _load_sdnq_clip(self, clip_path: Path) -> AnyModel:+ """Load SDNQ-quantized CLIP text encoder."""+ from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor++ # Load SDNQ state dict+ sd = sdnq_sd_loader(clip_path, compute_dtype=torch.bfloat16)++ # Load config and create model+ model_config = AutoConfig.from_pretrained(clip_path, local_files_only=True)+ with accelerate.init_empty_weights():+ model = CLIPTextModel(model_config)++ # position_ids is a non-persistent buffer that may be absent from the checkpoint.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load(+ "SDNQ CLIP text encoder", missing, unexpected, allowed_missing={"text_model.embeddings.position_ids"}+ )++ # Dequantize embedding layer+ if hasattr(model, "text_model") and hasattr(model.text_model, "embeddings"):+ embed_weight = model.text_model.embeddings.token_embedding.weight+ if isinstance(embed_weight, SDNQTensor):+ dequantized = embed_weight.get_dequantized_tensor()+ model.text_model.embeddings.token_embedding.weight = torch.nn.Parameter(+ dequantized, requires_grad=False+ )++ return model++ def _load_sdnq_t5(self, t5_path: Path) -> AnyModel:+ """Load SDNQ-quantized T5 text encoder."""+ from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor++ # Load SDNQ state dict+ sd = sdnq_sd_loader(t5_path, compute_dtype=torch.bfloat16)++ # Load config and create model+ model_config = AutoConfig.from_pretrained(t5_path, local_files_only=True)+ with accelerate.init_empty_weights():+ model = AutoModelForTextEncoding.from_config(model_config)++ # T5 ties encoder.embed_tokens to shared; the checkpoint only ships `shared.weight` and the+ # tie is re-established below, so encoder.embed_tokens.weight is expected to be missing.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load(+ "SDNQ T5 text encoder", missing, unexpected, allowed_missing={"encoder.embed_tokens.weight"}+ )++ # Dequantize shared embedding+ if hasattr(model, "shared") and isinstance(model.shared.weight, SDNQTensor):+ dequantized = model.shared.weight.get_dequantized_tensor()+ model.shared.weight = torch.nn.Parameter(dequantized, requires_grad=False)++ # Re-tie weights after dequantization+ if hasattr(model, "encoder") and hasattr(model.encoder, "embed_tokens"):+ if model.encoder.embed_tokens.weight is not model.shared.weight:+ model.encoder.embed_tokens.weight = model.shared.weight++ return model++ def _load_vae(self, vae_path: Path) -> AnyModel:+ """Load VAE - SDNQ or normal."""+ if _is_sdnq_folder(vae_path):+ return self._load_sdnq_vae(vae_path)+ # Normal VAE+ return AutoencoderKL.from_pretrained(vae_path, local_files_only=True)++ def _load_sdnq_vae(self, vae_path: Path) -> AnyModel:+ """Load SDNQ-quantized VAE."""+ # Load SDNQ state dict+ sd = sdnq_sd_loader(vae_path, compute_dtype=torch.bfloat16)++ # Load config and create model+ with accelerate.init_empty_weights():+ model = AutoencoderKL.from_config(AutoencoderKL.load_config(vae_path, local_files_only=True))++ # AutoencoderKL has no tied weights, so a complete state dict is expected.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load("SDNQ VAE", missing, unexpected)+ return modeldiff --git a/invokeai/backend/model_manager/load/model_loaders/vae.py b/invokeai/backend/model_manager/load/model_loaders/vae.pyindex e96fac447e..51497e725a 100644--- a/invokeai/backend/model_manager/load/model_loaders/vae.py+++ b/invokeai/backend/model_manager/load/model_loaders/vae.py@@ -1,8 +1,10 @@# Copyright (c) 2024, Lincoln D. Stein and the InvokeAI Development Team"""Class for VAE model loading in InvokeAI."""+from pathlib import Pathfrom typing import Optional+import acceleratefrom diffusers.models.autoencoders.autoencoder_kl import AutoencoderKLfrom invokeai.backend.model_manager.configs.factory import AnyModelConfig@@ -22,6 +24,18 @@ from invokeai.backend.model_manager.taxonomy import (ModelType,SubModelType,)+from invokeai.backend.quantization.sdnq.detection import is_sdnq_folder+from invokeai.backend.quantization.sdnq.loaders import raise_on_incomplete_sdnq_load, sdnq_sd_loader+++def _is_sdnq_vae_folder(path: Path) -> bool:+ """Check if a VAE folder contains SDNQ-quantized weights.++ Shared detector: marker file first, then the weight/scale key pair unioned across shards, so a+ sharded or markerless export is recognized the same way identification recognizes it.+ """+ return is_sdnq_folder(path)+# Architectural defaults for the Wan 2.2-VAE (TI2V-5B). Verbatim from the# vae/config.json shipped with Wan-AI/Wan2.2-TI2V-5B-Diffusers — only the@@ -182,8 +196,14 @@ class VAELoader(GenericDiffusersLoader):config.path,torch_dtype=self._torch_dtype,)- else:- return super()._load_model(config, submodel_type)++ model_path = Path(config.path)++ # Check if this is an SDNQ-quantized VAE folder+ if model_path.is_dir() and _is_sdnq_vae_folder(model_path):+ return self._load_sdnq_vae(model_path)++ return super()._load_model(config, submodel_type)def _load_wan_vae(self, config: VAE_Checkpoint_Wan_Config) -> AnyModel:"""Load a Wan 2.2 VAE from a single safetensors file.@@ -285,3 +305,28 @@ class VAELoader(GenericDiffusersLoader):model.load_state_dict(sd, strict=True, assign=True)model.eval()return model++ # NOTE: keep the `.eval()` at the end of this method in step with `_load_qwen_image_vae` above —+ # both build the module by hand instead of via `from_pretrained`, which would have done it.+ def _load_sdnq_vae(self, model_path: Path) -> AnyModel:+ """Load SDNQ-quantized VAE with on-the-fly dequantization."""+ # Find the safetensors source. Prefer a single canonical file; otherwise hand the whole+ # directory to sdnq_sd_loader, which merges arbitrarily named / sharded safetensors files.+ model_file = model_path / "diffusion_pytorch_model.safetensors"+ if not model_file.exists():+ model_file = model_path / "model.safetensors"+ source = model_file if model_file.exists() else model_path++ # Load SDNQ state dict+ sd = sdnq_sd_loader(source, compute_dtype=self._torch_dtype)++ # Create empty model from config+ with accelerate.init_empty_weights():+ model = AutoencoderKL.from_config(AutoencoderKL.load_config(model_path, local_files_only=True))++ # Load state dict with SDNQTensor objects. AutoencoderKL has no tied weights, so a complete+ # state dict is expected — a missing key would leave a required parameter on the meta device.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load("SDNQ VAE", missing, unexpected)+ model.eval()+ return modeldiff --git a/invokeai/backend/model_manager/load/model_loaders/z_image.py b/invokeai/backend/model_manager/load/model_loaders/z_image.pyindex 8e26b8f7e1..534db4e8bd 100644--- a/invokeai/backend/model_manager/load/model_loaders/z_image.py+++ b/invokeai/backend/model_manager/load/model_loaders/z_image.py@@ -11,13 +11,20 @@ from transformers import AutoTokenizer, Qwen3ForCausalLMfrom invokeai.backend.model_manager.configs.base import Checkpoint_Config_Base, Diffusers_Config_Basefrom invokeai.backend.model_manager.configs.controlnet import ControlNet_Checkpoint_ZImage_Configfrom invokeai.backend.model_manager.configs.factory import AnyModelConfig-from invokeai.backend.model_manager.configs.main import Main_Checkpoint_ZImage_Config, Main_GGUF_ZImage_Config+from invokeai.backend.model_manager.configs.main import (+ Main_Checkpoint_ZImage_Config,+ Main_GGUF_ZImage_Config,+ Main_SDNQ_Diffusers_ZImage_Config,+ Main_SDNQ_ZImage_Config,+)from invokeai.backend.model_manager.configs.qwen3_encoder import (Qwen3Encoder_Checkpoint_Config,Qwen3Encoder_GGUF_Config,Qwen3Encoder_Qwen3Encoder_Config,+ Qwen3Encoder_SDNQ_Config,+ Qwen3Encoder_SDNQ_Folder_Config,)-from invokeai.backend.model_manager.load.load_default import ModelLoader+from invokeai.backend.model_manager.load.load_default import ModelLoader, resolve_submodel_pathfrom invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistryfrom invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoaderfrom invokeai.backend.model_manager.taxonomy import (@@ -28,6 +35,8 @@ from invokeai.backend.model_manager.taxonomy import (SubModelType,)from invokeai.backend.quantization.gguf.loaders import gguf_sd_loader+from invokeai.backend.quantization.sdnq.detection import is_sdnq_folder+from invokeai.backend.quantization.sdnq.loaders import raise_on_incomplete_sdnq_load, sdnq_sd_loaderfrom invokeai.backend.qwen3.qwen3_tokenizer import load_bundled_qwen3_tokenizerfrom invokeai.backend.util.devices import TorchDevice@@ -142,17 +151,25 @@ class ZImageDiffusersModel(GenericDiffusersLoader):raise Exception("A submodel type must be provided when loading main pipelines.")model_path = Path(config.path)+ submodel_path = resolve_submodel_path(config, submodel_type, model_path / submodel_type.value)++ # Check if submodel folder has SDNQ quantization - if so, use SDNQ loader+ if self._is_sdnq_folder(submodel_path):+ if submodel_type == SubModelType.TextEncoder:+ return self._load_sdnq_text_encoder(submodel_path)+ elif submodel_type == SubModelType.Transformer:+ return self._load_sdnq_transformer(submodel_path)+load_class = self.get_hf_load_class(model_path, submodel_type)repo_variant = config.repo_variant if isinstance(config, Diffusers_Config_Base) else Nonevariant = repo_variant.value if repo_variant else None- model_path = model_path / submodel_type.value# Z-Image prefers bfloat16, but use safe dtype based on target device capabilities.target_device = TorchDevice.choose_torch_device()dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)try:result: AnyModel = load_class.from_pretrained(- model_path,+ submodel_path,torch_dtype=dtype,variant=variant,)@@ -160,13 +177,189 @@ class ZImageDiffusersModel(GenericDiffusersLoader):if variant and "no file named" in str(e): # try without the variant, just in case user's preferences changed- result = load_class.from_pretrained(model_path, torch_dtype=dtype)+ result = load_class.from_pretrained(submodel_path, torch_dtype=dtype)else:raise eresult = self._apply_fp8_layerwise_casting(result, config, submodel_type)return result+ def _is_sdnq_folder(self, folder_path: Path) -> bool:+ """Check if a folder contains SDNQ-quantized model weights.++ Shared detector, so this dispatch agrees with identification about markerless exports.+ """+ return is_sdnq_folder(folder_path)++ def _load_sdnq_text_encoder(self, text_encoder_path: Path) -> AnyModel:+ """Load SDNQ-quantized text encoder from folder."""+ from transformers import Qwen3Config, Qwen3ForCausalLM++ from invokeai.backend.quantization.sdnq.loaders import sdnq_sd_loader+ from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+ from invokeai.backend.util.logging import InvokeAILogger++ logger = InvokeAILogger.get_logger(self.__class__.__name__)+ logger.info(f"Loading SDNQ-quantized text encoder from {text_encoder_path}")++ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ # Load the SDNQ state dict+ sd = sdnq_sd_loader(text_encoder_path, compute_dtype=compute_dtype)++ # Determine Qwen model configuration from state dict+ layer_count = 0+ for key in sd.keys():+ if isinstance(key, str) and key.startswith("model.layers."):+ parts = key.split(".")+ if len(parts) > 2:+ try:+ layer_idx = int(parts[2])+ layer_count = max(layer_count, layer_idx + 1)+ except ValueError:+ pass++ # Get hidden size from embed_tokens weight shape+ embed_weight = sd.get("model.embed_tokens.weight")+ if embed_weight is None:+ raise ValueError("Could not find model.embed_tokens.weight in state dict")++ embed_shape = embed_weight.shape if hasattr(embed_weight, "shape") else embed_weight.tensor_shape+ hidden_size = embed_shape[1]+ vocab_size = embed_shape[0]++ # Detect attention configuration from layer 0 weights+ q_proj_weight = sd.get("model.layers.0.self_attn.q_proj.weight")+ k_proj_weight = sd.get("model.layers.0.self_attn.k_proj.weight")+ gate_proj_weight = sd.get("model.layers.0.mlp.gate_proj.weight")++ if q_proj_weight is None or k_proj_weight is None or gate_proj_weight is None:+ raise ValueError("Could not find attention/mlp weights in state dict")++ q_shape = q_proj_weight.shape if hasattr(q_proj_weight, "shape") else q_proj_weight.tensor_shape+ k_shape = k_proj_weight.shape if hasattr(k_proj_weight, "shape") else k_proj_weight.tensor_shape+ gate_shape = gate_proj_weight.shape if hasattr(gate_proj_weight, "shape") else gate_proj_weight.tensor_shape++ head_dim = 128+ num_attention_heads = q_shape[0] // head_dim+ num_kv_heads = k_shape[0] // head_dim+ intermediate_size = gate_shape[0]++ logger.info(+ f"Qwen3 SDNQ config: layers={layer_count}, hidden={hidden_size}, "+ f"heads={num_attention_heads}, kv_heads={num_kv_heads}"+ )++ qwen_config = Qwen3Config(+ vocab_size=vocab_size,+ hidden_size=hidden_size,+ intermediate_size=intermediate_size,+ num_hidden_layers=layer_count,+ num_attention_heads=num_attention_heads,+ num_key_value_heads=num_kv_heads,+ head_dim=head_dim,+ max_position_embeddings=40960,+ rms_norm_eps=1e-6,+ tie_word_embeddings=True,+ rope_theta=1000000.0,+ use_sliding_window=False,+ attention_bias=False,+ attention_dropout=0.0,+ torch_dtype=compute_dtype,+ )++ with accelerate.init_empty_weights():+ model = Qwen3ForCausalLM(qwen_config)++ # lm_head is tied to embed_tokens (re-shared below), so it is expected to be missing.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load(+ "SDNQ Z-Image Qwen3 text encoder", missing, unexpected, allowed_missing={"lm_head.weight"}+ )++ # Dequantize embed_tokens weight for embedding lookups+ embed_tokens_weight = model.model.embed_tokens.weight+ if isinstance(embed_tokens_weight, SDNQTensor):+ dequantized = embed_tokens_weight.get_dequantized_tensor()+ model.model.embed_tokens.weight = torch.nn.Parameter(dequantized, requires_grad=False)+ logger.info("Dequantized embed_tokens weight for embedding lookups")++ # Handle tied weights+ if qwen_config.tie_word_embeddings:+ if model.lm_head.weight.is_meta:+ model.lm_head.weight = model.model.embed_tokens.weight+ else:+ model.tie_weights()++ # Re-initialize meta tensor buffers+ for name, buffer in list(model.named_buffers()):+ if buffer.is_meta:+ parts = name.rsplit(".", 1)+ if len(parts) == 2:+ parent = model.get_submodule(parts[0])+ buffer_name = parts[1]+ else:+ parent = model+ buffer_name = name++ if buffer_name == "inv_freq":+ base = qwen_config.rope_theta+ inv_freq = 1.0 / (base ** (torch.arange(0, head_dim, 2, dtype=torch.float32) / head_dim))+ parent.register_buffer(buffer_name, inv_freq.to(dtype=compute_dtype), persistent=False)++ # Fail fast if any required parameter is still on the meta device (e.g. a partial export).+ # This mirrors the standalone SDNQ Qwen3 encoder loader's final guard.+ meta_params = [name for name, p in model.named_parameters() if p.is_meta]+ if meta_params:+ raise RuntimeError(f"SDNQ Z-Image Qwen3 text encoder has parameters left on meta: {meta_params}")++ return model++ def _load_sdnq_transformer(self, transformer_path: Path) -> AnyModel:+ """Load SDNQ-quantized transformer from folder."""+ from diffusers import ZImageTransformer2DModel++ from invokeai.backend.quantization.sdnq.loaders import sdnq_sd_loader+ from invokeai.backend.util.logging import InvokeAILogger++ logger = InvokeAILogger.get_logger(self.__class__.__name__)+ logger.info(f"Loading SDNQ-quantized transformer from {transformer_path}")++ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ # Load the SDNQ state dict+ sd = sdnq_sd_loader(transformer_path, compute_dtype=compute_dtype)++ # Check if conversion is needed (original format vs diffusers format)+ needs_conversion = any(k.startswith("x_embedder.") for k in sd.keys() if isinstance(k, str))+ if needs_conversion:+ sd = _convert_z_image_gguf_to_diffusers(sd)++ # Create an empty model with the default Z-Image config+ with accelerate.init_empty_weights():+ model = ZImageTransformer2DModel(+ all_patch_size=(2,),+ all_f_patch_size=(1,),+ in_channels=16,+ dim=3840,+ n_layers=30,+ n_refiner_layers=2,+ n_heads=30,+ n_kv_heads=30,+ norm_eps=1e-05,+ qk_norm=True,+ cap_feat_dim=2560,+ rope_theta=256.0,+ t_scale=1000.0,+ axes_dims=[32, 48, 48],+ axes_lens=[1024, 512, 512],+ )++ model.load_state_dict(sd, assign=True)+ return model+@ModelLoaderRegistry.register(base=BaseModelType.ZImage, type=ModelType.Main, format=ModelFormat.Checkpoint)class ZImageCheckpointModel(ModelLoader):@@ -376,6 +569,178 @@ class ZImageGGUFCheckpointModel(ModelLoader):return model[email protected](base=BaseModelType.ZImage, type=ModelType.Main, format=ModelFormat.SDNQQuantized)+class ZImageSDNQCheckpointModel(ModelLoader):+ """Class to load SDNQ-quantized Z-Image transformer models.++ Handles both single-file SDNQ checkpoints (``Main_SDNQ_ZImage_Config``) and full+ diffusers-pipeline folders (``Main_SDNQ_Diffusers_ZImage_Config``), where the+ quantized weights live under ``transformer/`` alongside a ``config.json`` that+ describes the architecture.+ """++ def _load_model(+ self,+ config: AnyModelConfig,+ submodel_type: Optional[SubModelType] = None,+ ) -> AnyModel:+ if not isinstance(config, (Main_SDNQ_ZImage_Config, Main_SDNQ_Diffusers_ZImage_Config)):+ raise ValueError(+ "Only Main_SDNQ_ZImage_Config or Main_SDNQ_Diffusers_ZImage_Config models are supported here."+ )++ # Single-file SDNQ checkpoints only carry the transformer.+ if isinstance(config, Main_SDNQ_ZImage_Config):+ if submodel_type == SubModelType.Transformer:+ return self._load_from_singlefile(config)+ raise ValueError(+ f"Single-file SDNQ Z-Image checkpoints only provide the Transformer submodel. "+ f"Received: {submodel_type.value if submodel_type else 'None'}"+ )++ # Full ZImagePipeline folder — dispatch each submodel out of its own subfolder so the+ # model can be used as a 'Qwen3 & VAE source model' for other Z-Image runs.+ match submodel_type:+ case SubModelType.Transformer:+ return self._load_from_diffusers_folder(config)+ case SubModelType.TextEncoder:+ return self._load_text_encoder(config)+ case SubModelType.Tokenizer:+ return self._load_tokenizer(config)+ case SubModelType.VAE:+ return self._load_vae(config)++ raise ValueError(+ f"Unsupported submodel type for SDNQ ZImagePipeline: {submodel_type.value if submodel_type else 'None'}"+ )++ def _load_text_encoder(self, config: Main_SDNQ_Diffusers_ZImage_Config) -> AnyModel:+ from transformers import AutoConfig, Qwen3ForCausalLM++ te_dir = resolve_submodel_path(config, SubModelType.TextEncoder, Path(config.path) / "text_encoder")+ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ te_config = AutoConfig.from_pretrained(te_dir, local_files_only=True)+ with accelerate.init_empty_weights():+ model = Qwen3ForCausalLM(te_config)++ sd = sdnq_sd_loader(te_dir, compute_dtype=compute_dtype)+ # Qwen3ForCausalLM may share lm_head.weight with model.embed_tokens.weight; missing keys+ # for that tie are expected and handled by re-sharing post-load.+ missing, unexpected = model.load_state_dict(sd, assign=True, strict=False)+ if unexpected:+ raise ValueError(f"Unexpected keys loading SDNQ Qwen3 text encoder: {unexpected}")+ if missing and missing != ["lm_head.weight"]:+ raise ValueError(f"Unexpected missing keys loading SDNQ Qwen3 text encoder: {missing}")+ if missing == ["lm_head.weight"]:+ model.lm_head.weight = model.model.embed_tokens.weight+ return model++ def _load_tokenizer(self, config: Main_SDNQ_Diffusers_ZImage_Config) -> AnyModel:+ tok_dir = resolve_submodel_path(config, SubModelType.Tokenizer, Path(config.path) / "tokenizer")+ return AutoTokenizer.from_pretrained(tok_dir, local_files_only=True)++ def _load_vae(self, config: Main_SDNQ_Diffusers_ZImage_Config) -> AnyModel:+ from diffusers import AutoencoderKL++ vae_dir = resolve_submodel_path(config, SubModelType.VAE, Path(config.path) / "vae")+ return AutoencoderKL.from_pretrained(vae_dir, local_files_only=True)++ def _load_from_singlefile(+ self,+ config: Main_SDNQ_ZImage_Config,+ ) -> AnyModel:+ from diffusers import ZImageTransformer2DModel++ model_path = Path(config.path)++ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ sd = sdnq_sd_loader(model_path, compute_dtype=compute_dtype)++ # Some Z-Image SDNQ models may have keys prefixed with "diffusion_model." or+ # "model.diffusion_model." (ComfyUI-style format). Check if we need to strip this prefix.+ prefix_to_strip = None+ for prefix in ["model.diffusion_model.", "diffusion_model."]:+ if any(k.startswith(prefix) for k in sd.keys() if isinstance(k, str)):+ prefix_to_strip = prefix+ break++ if prefix_to_strip:+ stripped_sd = {}+ for key, value in sd.items():+ if isinstance(key, str) and key.startswith(prefix_to_strip):+ stripped_sd[key[len(prefix_to_strip) :]] = value+ else:+ stripped_sd[key] = value+ sd = stripped_sd++ # Check if conversion is needed (original format vs diffusers format)+ needs_conversion = any(k.startswith("x_embedder.") for k in sd.keys() if isinstance(k, str))+ if needs_conversion:+ sd = _convert_z_image_gguf_to_diffusers(sd)++ # Create an empty model with the default Z-Image config+ with accelerate.init_empty_weights():+ model = ZImageTransformer2DModel(+ all_patch_size=(2,),+ all_f_patch_size=(1,),+ in_channels=16,+ dim=3840,+ n_layers=30,+ n_refiner_layers=2,+ n_heads=30,+ n_kv_heads=30,+ norm_eps=1e-05,+ qk_norm=True,+ cap_feat_dim=2560,+ rope_theta=256.0,+ t_scale=1000.0,+ axes_dims=[32, 48, 48],+ axes_lens=[1024, 512, 512],+ )++ model.load_state_dict(sd, assign=True)+ return model++ def _load_from_diffusers_folder(+ self,+ config: Main_SDNQ_Diffusers_ZImage_Config,+ ) -> AnyModel:+ from diffusers import ZImageTransformer2DModel++ # When ZImagePipeline is registered with submodels, the transformer submodel's path points+ # into transformer/ directly. The pipeline-level Main config has its own path at the root.+ # Either way, locate the transformer/config.json + safetensors.+ model_path = Path(config.path)+ transformer_path = resolve_submodel_path(+ config,+ SubModelType.Transformer,+ model_path / "transformer" if (model_path / "transformer").is_dir() else model_path,+ )++ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ # Build the empty model from the on-disk architecture description so we honor non-default+ # axes_lens / dim / etc. that the single-file path hardcodes.+ with accelerate.init_empty_weights():+ model = ZImageTransformer2DModel.from_config(+ ZImageTransformer2DModel.load_config(transformer_path, local_files_only=True)+ )++ sd = sdnq_sd_loader(transformer_path, compute_dtype=compute_dtype)+ # Diffusers-format Z-Image keys already match ZImageTransformer2DModel.state_dict(),+ # so no BFL→diffusers conversion is needed here. The transformer has no tied/shared weights,+ # so we expect a complete state dict — any missing key would leave a required parameter on a+ # meta tensor and fail later during device movement or inference. Fail fast here instead.+ missing, unexpected = model.load_state_dict(sd, assign=True, strict=False)+ raise_on_incomplete_sdnq_load("SDNQ Z-Image transformer", missing, unexpected)+ return model++@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder)class Qwen3EncoderLoader(ModelLoader):"""Class to load standalone Qwen3 Encoder models for Z-Image (directory format)."""@@ -1081,3 +1446,180 @@ class Qwen3EncoderGGUFLoader(ModelLoader):new_sd[key] = valuereturn new_sd++[email protected](base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.SDNQQuantized)+class Qwen3EncoderSDNQLoader(ModelLoader):+ """Class to load SDNQ-quantized Qwen3 Encoder models for Z-Image."""++ # Default HuggingFace model to load tokenizer from when using SDNQ Qwen3 encoder+ DEFAULT_TOKENIZER_SOURCE = "Qwen/Qwen3-4B"++ def _load_model(+ self,+ config: AnyModelConfig,+ submodel_type: Optional[SubModelType] = None,+ ) -> AnyModel:+ if not isinstance(config, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)):+ raise ValueError(+ "Only Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config models are supported here."+ )++ match submodel_type:+ case SubModelType.TextEncoder:+ return self._load_from_sdnq(config)+ case SubModelType.Tokenizer:+ return self._load_tokenizer_with_offline_fallback()++ submodel_str = submodel_type.value if submodel_type else "None"+ raise ValueError(f"Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_str}")++ def _load_tokenizer_with_offline_fallback(self) -> AnyModel:+ """Load tokenizer with local_files_only fallback for offline support."""+ try:+ return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE, local_files_only=True)+ except OSError:+ return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE)++ def _load_from_sdnq(+ self,+ config: AnyModelConfig,+ ) -> AnyModel:+ from transformers import Qwen3Config, Qwen3ForCausalLM++ from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+ from invokeai.backend.util.logging import InvokeAILogger++ logger = InvokeAILogger.get_logger(self.__class__.__name__)++ if not isinstance(config, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)):+ raise TypeError(+ f"Expected Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config, got {type(config).__name__}."+ )+ model_path = Path(config.path)++ # Determine safe dtype based on target device capabilities+ target_device = TorchDevice.choose_torch_device()+ compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)++ # Load the SDNQ state dict - this returns SDNQTensor wrappers (on CPU)+ sd = sdnq_sd_loader(model_path, compute_dtype=compute_dtype)++ # Determine Qwen model configuration from state dict+ layer_count = 0+ for key in sd.keys():+ if isinstance(key, str) and key.startswith("model.layers."):+ parts = key.split(".")+ if len(parts) > 2:+ try:+ layer_idx = int(parts[2])+ layer_count = max(layer_count, layer_idx + 1)+ except ValueError:+ pass++ # Get hidden size from embed_tokens weight shape+ embed_weight = sd.get("model.embed_tokens.weight")+ if embed_weight is None:+ raise ValueError("Could not find model.embed_tokens.weight in state dict")++ embed_shape = embed_weight.shape if hasattr(embed_weight, "shape") else embed_weight.tensor_shape+ if len(embed_shape) != 2:+ raise ValueError(f"Expected 2D embed_tokens weight tensor, got shape {embed_shape}.")+ hidden_size = embed_shape[1]+ vocab_size = embed_shape[0]++ # Detect attention configuration from layer 0 weights+ q_proj_weight = sd.get("model.layers.0.self_attn.q_proj.weight")+ k_proj_weight = sd.get("model.layers.0.self_attn.k_proj.weight")+ gate_proj_weight = sd.get("model.layers.0.mlp.gate_proj.weight")++ if q_proj_weight is None or k_proj_weight is None or gate_proj_weight is None:+ raise ValueError("Could not find attention/mlp weights in state dict to determine configuration")++ q_shape = q_proj_weight.shape if hasattr(q_proj_weight, "shape") else q_proj_weight.tensor_shape+ k_shape = k_proj_weight.shape if hasattr(k_proj_weight, "shape") else k_proj_weight.tensor_shape+ gate_shape = gate_proj_weight.shape if hasattr(gate_proj_weight, "shape") else gate_proj_weight.tensor_shape++ head_dim = 128 # Standard head dimension for Qwen3 models+ num_attention_heads = q_shape[0] // head_dim+ num_kv_heads = k_shape[0] // head_dim+ intermediate_size = gate_shape[0]++ logger.info(+ f"Qwen3 SDNQ Encoder config detected: layers={layer_count}, hidden={hidden_size}, "+ f"heads={num_attention_heads}, kv_heads={num_kv_heads}, intermediate={intermediate_size}, "+ f"head_dim={head_dim}"+ )++ # Create Qwen3 config+ qwen_config = Qwen3Config(+ vocab_size=vocab_size,+ hidden_size=hidden_size,+ intermediate_size=intermediate_size,+ num_hidden_layers=layer_count,+ num_attention_heads=num_attention_heads,+ num_key_value_heads=num_kv_heads,+ head_dim=head_dim,+ max_position_embeddings=40960,+ rms_norm_eps=1e-6,+ tie_word_embeddings=True,+ rope_theta=1000000.0,+ use_sliding_window=False,+ attention_bias=False,+ attention_dropout=0.0,+ torch_dtype=compute_dtype,+ )++ # Use Qwen3ForCausalLM with empty weights, then load SDNQ tensors+ with accelerate.init_empty_weights():+ model = Qwen3ForCausalLM(qwen_config)++ # Load the SDNQ weights with assign=True. lm_head is tied to embed_tokens (re-shared below),+ # so it is expected to be missing; any other missing key or any unexpected key (e.g. from an+ # incompatible or contaminated export) must fail here. The later meta-parameter guard only+ # catches missing required params, not unexpected ones.+ missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)+ raise_on_incomplete_sdnq_load("SDNQ Qwen3 encoder", missing, unexpected, allowed_missing={"lm_head.weight"})++ # Dequantize embed_tokens weight - embedding lookups require indexed access+ embed_tokens_weight = model.model.embed_tokens.weight+ if isinstance(embed_tokens_weight, SDNQTensor):+ dequantized = embed_tokens_weight.get_dequantized_tensor()+ model.model.embed_tokens.weight = torch.nn.Parameter(dequantized, requires_grad=False)+ logger.info("Dequantized embed_tokens weight for embedding lookups")++ # Handle tied weights+ if qwen_config.tie_word_embeddings:+ if model.lm_head.weight.is_meta:+ model.lm_head.weight = model.model.embed_tokens.weight+ logger.info("Tied lm_head.weight to embed_tokens.weight")+ else:+ model.tie_weights()++ # Re-initialize any remaining meta tensor buffers+ for name, buffer in list(model.named_buffers()):+ if buffer.is_meta:+ parts = name.rsplit(".", 1)+ if len(parts) == 2:+ parent = model.get_submodule(parts[0])+ buffer_name = parts[1]+ else:+ parent = model+ buffer_name = name++ if buffer_name == "inv_freq":+ base = qwen_config.rope_theta+ inv_freq = 1.0 / (base ** (torch.arange(0, head_dim, 2, dtype=torch.float32) / head_dim))+ parent.register_buffer(buffer_name, inv_freq.to(dtype=compute_dtype), persistent=False)+ else:+ logger.warning(f"Re-initializing unknown meta buffer: {name}")++ # Final check: ensure no meta tensors remain in parameters+ meta_params = [(name, p) for name, p in model.named_parameters() if p.is_meta]+ if meta_params:+ meta_names = [name for name, _ in meta_params]+ raise RuntimeError(+ f"Failed to load all parameters from SDNQ. The following remain as meta tensors: {meta_names}."+ )++ return modeldiff --git a/invokeai/backend/model_manager/model_on_disk.py b/invokeai/backend/model_manager/model_on_disk.pyindex 4ecaf40c2d..e5fdf1f617 100644--- a/invokeai/backend/model_manager/model_on_disk.py+++ b/invokeai/backend/model_manager/model_on_disk.py@@ -11,6 +11,7 @@ from invokeai.app.services.config.config_default import get_configfrom invokeai.backend.model_hash.model_hash import HASHING_ALGORITHMS, ModelHashfrom invokeai.backend.model_manager.taxonomy import ModelRepoVariantfrom invokeai.backend.quantization.gguf.loaders import WrappedGGUFReader, gguf_sd_loader+from invokeai.backend.quantization.sdnq.loaders import sdnq_sd_loaderfrom invokeai.backend.util.logging import InvokeAILoggerfrom invokeai.backend.util.silence_warnings import SilenceWarnings@@ -19,6 +20,21 @@ StateDict: TypeAlias = dict[str | int, Any] # When are the keys int?logger = InvokeAILogger.get_logger()+def _is_sdnq_safetensors(path: Path) -> bool:+ """Check if a safetensors file contains SDNQ-quantized weights by checking for weight+scale pairs."""+ try:+ with safe_open(path, framework="pt", device="cpu") as f:+ keys = set(f.keys())+ for key in keys:+ if key.endswith(".weight"):+ base = key[:-7]+ if f"{base}.scale" in keys:+ return True+ except Exception:+ pass+ return False++class ModelOnDisk:"""A utility class representing a model stored on disk."""@@ -124,7 +140,10 @@ class ModelOnDisk:elif path.suffix.endswith(".gguf"):checkpoint = gguf_sd_loader(path, compute_dtype=torch.float32)elif path.suffix.endswith(".safetensors"):- checkpoint = safetensors.torch.load_file(path)+ if _is_sdnq_safetensors(path):+ checkpoint = sdnq_sd_loader(path, compute_dtype=torch.float32)+ else:+ checkpoint = safetensors.torch.load_file(path)else:raise ValueError(f"Unrecognized model extension: {path.suffix}")diff --git a/invokeai/backend/model_manager/starter_models.py b/invokeai/backend/model_manager/starter_models.pyindex edd2a4cb14..eb8812f02f 100644--- a/invokeai/backend/model_manager/starter_models.py+++ b/invokeai/backend/model_manager/starter_models.py@@ -292,6 +292,15 @@ flux_dev = StarterModel(type=ModelType.Main,dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],)+flux_schnell_sdnq = StarterModel(+ name="FLUX.1 schnell (SDNQ uint4 + SVD)",+ base=BaseModelType.Flux,+ source="Disty0/FLUX.1-schnell-SDNQ-uint4-svd-r32",+ description="FLUX.1 schnell quantized via SDNQ to uint4 + SVD rank 32. Full self-contained "+ "Flux pipeline (transformer + T5 + CLIP + VAE). ~15GB",+ type=ModelType.Main,+ format=ModelFormat.SDNQQuantized,+)flux_kontext = StarterModel(name="FLUX.1 Kontext dev",base=BaseModelType.Flux,@@ -1112,6 +1121,26 @@ flux2_klein_9b_fp8 = StarterModel(dependencies=[flux2_vae, flux2_klein_qwen3_8b_encoder],)+flux2_klein_4b_sdnq = StarterModel(+ name="FLUX.2 Klein 4B (SDNQ dynamic 4-bit)",+ base=BaseModelType.Flux2,+ source="Disty0/FLUX.2-klein-4B-SDNQ-4bit-dynamic",+ description="FLUX.2 Klein 4B quantized via SDNQ to dynamic uint4/int5 mixed precision. "+ "Full self-contained Flux2KleinPipeline (transformer + Qwen3 4B + AutoencoderKLFlux2). ~5GB",+ type=ModelType.Main,+ format=ModelFormat.SDNQQuantized,+)++flux2_klein_9b_sdnq = StarterModel(+ name="FLUX.2 Klein 9B (SDNQ dynamic 4-bit + SVD)",+ base=BaseModelType.Flux2,+ source="Disty0/FLUX.2-klein-9B-SDNQ-4bit-dynamic-svd-r32",+ description="FLUX.2 Klein 9B quantized via SDNQ to dynamic uint4/int5 + SVD rank 32. "+ "Full self-contained Flux2KleinPipeline. ~13GB",+ type=ModelType.Main,+ format=ModelFormat.SDNQQuantized,+)+flux2_klein_4b_gguf_q4 = StarterModel(name="FLUX.2 Klein 4B (GGUF Q4)",base=BaseModelType.Flux2,@@ -1346,6 +1375,16 @@ z_image_turbo_q8 = StarterModel(dependencies=[z_image_qwen3_encoder_quantized, flux_vae],)+z_image_turbo_sdnq = StarterModel(+ name="Z-Image Turbo (SDNQ uint4 + SVD)",+ base=BaseModelType.ZImage,+ source="Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32",+ description="Z-Image Turbo quantized via SDNQ to uint4 + SVD rank 32. Full self-contained "+ "ZImagePipeline (transformer + Qwen3 + VAE). ~5GB",+ type=ModelType.Main,+ format=ModelFormat.SDNQQuantized,+)+z_image_controlnet_union = StarterModel(name="Z-Image ControlNet Union",base=BaseModelType.ZImage,@@ -2247,6 +2286,7 @@ STARTER_MODELS: list[StarterModel] = [flux_dev_quantized,flux_schnell,flux_dev,+ flux_schnell_sdnq,sd35_medium,sd35_large,ideogram_4_nf4,@@ -2326,6 +2366,8 @@ STARTER_MODELS: list[StarterModel] = [flux2_klein_4b_fp8,flux2_klein_9b,flux2_klein_9b_fp8,+ flux2_klein_4b_sdnq,+ flux2_klein_9b_sdnq,flux2_klein_4b_gguf_q4,flux2_klein_4b_gguf_q8,flux2_klein_9b_gguf_q4,@@ -2368,6 +2410,7 @@ STARTER_MODELS: list[StarterModel] = [z_image_turbo,z_image_turbo_quantized,z_image_turbo_q8,+ z_image_turbo_sdnq,z_image_qwen3_encoder,z_image_qwen3_encoder_quantized,z_image_controlnet_union,diff --git a/invokeai/backend/model_manager/taxonomy.py b/invokeai/backend/model_manager/taxonomy.pyindex f0fd5726de..aa569e8f63 100644--- a/invokeai/backend/model_manager/taxonomy.py+++ b/invokeai/backend/model_manager/taxonomy.py@@ -312,6 +312,7 @@ class ModelFormat(str, Enum):BnbQuantizednf4b = "bnb_quantized_nf4b"GGUFQuantized = "gguf_quantized"ExternalApi = "external_api"+ SDNQQuantized = "sdnq_quantized"Unknown = "unknown"diff --git a/invokeai/backend/quantization/sdnq/__init__.py b/invokeai/backend/quantization/sdnq/__init__.pynew file mode 100644index 0000000000..e200218722--- /dev/null+++ b/invokeai/backend/quantization/sdnq/__init__.py@@ -0,0 +1,17 @@+"""SDNQ (SD.Next Quantization) support for InvokeAI.++This module provides support for loading SDNQ quantized models with on-the-fly+CPU dequantization, similar to GGUF support.+"""++from invokeai.backend.quantization.sdnq.loaders import has_sdnq_keys, has_sdnq_tensors, sdnq_sd_loader+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationType++__all__ = [+ "SDNQTensor",+ "sdnq_sd_loader",+ "has_sdnq_tensors",+ "has_sdnq_keys",+ "SDNQQuantizationType",+]diff --git a/invokeai/backend/quantization/sdnq/detection.py b/invokeai/backend/quantization/sdnq/detection.pynew file mode 100644index 0000000000..c18cba4634--- /dev/null+++ b/invokeai/backend/quantization/sdnq/detection.py@@ -0,0 +1,62 @@+"""Deciding whether a folder holds SDNQ-quantized weights.++This is one question with one answer, but it used to have four near-identical implementations — in+`configs/main.py`, the FLUX and Z-Image loaders, and `vae.py` — and only the last of them looked past+the `quantization_config.json` marker. That divergence is a real defect rather than untidiness:+identification and loading consult the *same* folder and must reach the *same* verdict. When they+disagree on a markerless export, identification hands the folder to a plain-diffusers config and the+loader then calls `from_pretrained()` on packed SDNQ weights, which either fails outright or+misreads them.+"""++import json+from pathlib import Path++from safetensors import safe_open++_QUANTIZATION_CONFIG_FILENAME = "quantization_config.json"+++def folder_has_sdnq_keys(folder_path: Path) -> bool:+ """True if the safetensors in `folder_path` carry an SDNQ ``<name>.weight`` / ``<name>.scale`` pair.++ The pair is resolved across the union of every shard, never within a single file: sharding splits+ a checkpoint by tensor order, so a weight and its scale routinely land in different files.++ Only safetensors are inspected, which is the same set `sdnq_sd_loader` reads — a `.bin` holding+ SDNQ-shaped tensors is not something we could load anyway, so calling it SDNQ would only move the+ failure around.+ """+ if not folder_path.is_dir():+ return False++ keys: set[str] = set()+ for shard in sorted(folder_path.glob("*.safetensors")):+ try:+ with safe_open(shard, framework="pt", device="cpu") as f:+ keys.update(f.keys())+ except Exception:+ continue++ return any(key.endswith(".weight") and f"{key[: -len('.weight')]}.scale" in keys for key in keys)+++def is_sdnq_folder(folder_path: Path) -> bool:+ """True if `folder_path` holds SDNQ-quantized weights.++ Checks the `quantization_config.json` marker first because it is definitive and free, then falls+ back to the key shape. The fallback is what covers exports that ship no marker — without it such+ a folder reads as plain diffusers to identification and as SDNQ to nothing at all.+ """+ marker = folder_path / _QUANTIZATION_CONFIG_FILENAME+ if marker.is_file():+ try:+ with open(marker, "r", encoding="utf-8") as f:+ if json.load(f).get("quant_method") == "sdnq":+ return True+ except (json.JSONDecodeError, OSError):+ pass+ # A marker that exists but names another method is not evidence *against* SDNQ keys, so fall+ # through rather than returning False here.++ return folder_has_sdnq_keys(folder_path)diff --git a/invokeai/backend/quantization/sdnq/loaders.py b/invokeai/backend/quantization/sdnq/loaders.pynew file mode 100644index 0000000000..252ea8a620--- /dev/null+++ b/invokeai/backend/quantization/sdnq/loaders.py@@ -0,0 +1,398 @@+"""SDNQ State Dict Loader - loads SDNQ quantized safetensors files."""++import gc+import json+import logging+from collections.abc import Iterable+from pathlib import Path+from typing import Any, Union++import torch+from safetensors.torch import load_file++from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationType++logger = logging.getLogger(__name__)+++def raise_on_incomplete_sdnq_load(+ model_name: str,+ missing_keys: Iterable[str],+ unexpected_keys: Iterable[str],+ allowed_missing: Iterable[str] = (),+) -> None:+ """Fail fast when ``load_state_dict(..., strict=False)`` left an SDNQ model incomplete.++ ``load_state_dict`` with ``strict=False`` silently ignores the missing/unexpected key lists.+ For SDNQ folder loads that is dangerous: a partial export, missing shard key or architecture+ mismatch leaves required parameters on the meta device and returns a model that fails much later+ during device movement or inference, far from the real cause. This raises with the offending+ keys instead.++ Args:+ model_name: Human-readable name for the error message (e.g. "SDNQ Z-Image transformer").+ missing_keys: The ``missing_keys`` returned by ``load_state_dict``.+ unexpected_keys: The ``unexpected_keys`` returned by ``load_state_dict``.+ allowed_missing: Keys that are expected to be absent (e.g. tied weights the caller re-shares+ after load), which must not trigger a failure.+ """+ allowed = set(allowed_missing)+ real_missing = [k for k in missing_keys if k not in allowed]+ unexpected = list(unexpected_keys)+ if unexpected:+ raise ValueError(f"Unexpected keys loading {model_name}: {unexpected}")+ if real_missing:+ raise ValueError(f"Missing keys loading {model_name} (required parameters left on meta): {real_missing}")+++def _parse_quantization_config(config_path: Path) -> dict[str, Any]:+ """Parse quantization_config.json for SDNQ parameters."""+ if not config_path.exists():+ return {}++ with open(config_path, "r", encoding="utf-8") as f:+ return json.load(f)+++_DTYPE_NAME_TO_QUANT_TYPE = {+ "uint4": SDNQQuantizationType.UINT4_ASYM,+ "int4": SDNQQuantizationType.UINT4_ASYM, # signed naming, same packed storage+ "uint5": SDNQQuantizationType.INT5_ASYM,+ "int5": SDNQQuantizationType.INT5_ASYM, # SDNQ dynamic-mixed uses this label+ "int8": SDNQQuantizationType.INT8_SYM,+ "uint8": SDNQQuantizationType.UINT8_SYM,+}+++def _infer_quantization_type(+ weight_dtype: torch.dtype,+ has_zero_point: bool,+ config: dict[str, Any],+ weight: torch.Tensor | None = None,+ scale: torch.Tensor | None = None,+ tensor_name: str | None = None,+ per_tensor_dtype: str | None = None,+) -> SDNQQuantizationType:+ """Infer quantization type from weight dtype and config.++ Dynamic-mixed-precision SDNQ models use ``modules_dtype_dict`` to record per-tensor dtypes+ (e.g. some layers uint4, others int5). ``per_tensor_dtype`` is the resolved label for this+ tensor; when provided it takes precedence over the global ``weights_dtype``.+ """+ # Per-tensor override (dynamic mixed precision)+ if per_tensor_dtype:+ mapped = _DTYPE_NAME_TO_QUANT_TYPE.get(per_tensor_dtype)+ if mapped is not None:+ # Asymmetric vs symmetric: int8/uint8 follow has_zero_point; everything else is asym.+ if mapped == SDNQQuantizationType.INT8_SYM and has_zero_point:+ return SDNQQuantizationType.INT8_ASYM+ if mapped == SDNQQuantizationType.UINT8_SYM and has_zero_point:+ return SDNQQuantizationType.UINT8_ASYM+ return mapped++ # Check config for weights_dtype (SDNQ style; static-quantization fallback)+ weights_dtype = config.get("weights_dtype", "")+ if weights_dtype == "uint4":+ return SDNQQuantizationType.UINT4_ASYM+ if weights_dtype == "uint5" or weights_dtype == "int5":+ return SDNQQuantizationType.INT5_ASYM++ # Check config for quant_type+ if "quant_type" in config:+ return SDNQQuantizationType(config["quant_type"])++ # Try to detect uint4 from shapes:+ # uint4 is packed as 2 values per uint8, so if scale suggests a shape that's+ # 2x the weight's last dimension, it's likely uint4+ if weight is not None and scale is not None and weight_dtype == torch.uint8:+ if len(weight.shape) == 2 and len(scale.shape) >= 2:+ # For per-group quantization: scale shape [out, num_groups, 1] or [out, num_groups]+ # weight shape [out, in/2] for uint4+ # Check if scale's out_features matches weight's out_features+ # and if num_groups * group_size would be 2x weight's in_features+ out_features = weight.shape[0]+ packed_in = weight.shape[1]+ scale_out = scale.shape[0]+ num_groups = scale.shape[1]++ if scale_out == out_features and num_groups > 0:+ # If we can infer that unpacked shape would be 2x packed, it's uint4+ # For typical group sizes (32, 64, 128), num_groups * group_size = in_features+ # If packed_in * 2 can be divided by num_groups, it's likely uint4+ unpacked_in = packed_in * 2+ if unpacked_in % num_groups == 0:+ inferred_group_size = unpacked_in // num_groups+ if inferred_group_size in (32, 64, 128, 256):+ return SDNQQuantizationType.UINT4_ASYM++ # Infer from dtype+ if weight_dtype == torch.int8:+ return SDNQQuantizationType.INT8_ASYM if has_zero_point else SDNQQuantizationType.INT8_SYM+ elif weight_dtype == torch.uint8:+ return SDNQQuantizationType.UINT8_ASYM if has_zero_point else SDNQQuantizationType.UINT8_SYM+ elif weight_dtype in (torch.float8_e4m3fn, torch.float8_e4m3fnuz):+ return SDNQQuantizationType.FP8_E4M3+ elif weight_dtype in (torch.float8_e5m2, torch.float8_e5m2fnuz):+ return SDNQQuantizationType.FP8_E5M2++ # Default to symmetric int8+ return SDNQQuantizationType.INT8_SYM+++def _get_original_shape(+ weight: torch.Tensor,+ config: dict[str, Any],+ tensor_name: str,+ quant_type: SDNQQuantizationType,+ scale: torch.Tensor | None = None,+ group_size: int = 128,+) -> torch.Size:+ """Determine the original tensor shape before quantization."""+ # Check if shape is stored in config+ if "shapes" in config and tensor_name in config["shapes"]:+ return torch.Size(config["shapes"][tensor_name])++ # For uint4 packed weights with per-group quantization. The packed size is the+ # authoritative source for in_features: scale's num_groups × the passed-in group_size can+ # be wrong if group_size was not actually known (e.g. Klein 4B uses group_size=64 for some+ # to_out layers while others use 128).+ if quant_type == SDNQQuantizationType.UINT4_ASYM:+ if scale is not None and scale.shape and scale.shape[0] > 0:+ out_features = scale.shape[0]+ # uint4 packs 2 values per byte; total unpacked = numel * 2 regardless of 1D/2D layout.+ total_elements = weight.numel() * 2+ if total_elements % out_features == 0:+ in_features = total_elements // out_features+ return torch.Size([out_features, in_features])++ # Fallback for 2D packed weights without usable scale info.+ if len(weight.shape) == 2:+ return torch.Size([weight.shape[0], weight.shape[1] * 2])++ # Final fallback for 1D.+ if len(weight.shape) == 1:+ return torch.Size([weight.numel() * 2])++ # For uint5 packed weights with per-group quantization. SDNQ stores uint5 as 2D with last+ # dim = 5 (8 unpacked values per 5 bytes). Same authoritative-packed-size logic.+ if quant_type == SDNQQuantizationType.INT5_ASYM:+ total_elements = weight.numel() * 8 // 5+ if scale is not None and scale.shape and scale.shape[0] > 0:+ out_features = scale.shape[0]+ if total_elements % out_features == 0:+ return torch.Size([out_features, total_elements // out_features])+ # Fallback when there's no scale: trust the 2D packed layout.+ if len(weight.shape) == 2 and weight.shape[-1] == 5:+ return torch.Size([total_elements])++ # Quantized tensors usually keep the same shape+ return weight.shape+++def sdnq_sd_loader(+ model_path: Path,+ compute_dtype: torch.dtype = torch.bfloat16,+) -> dict[str, Union[SDNQTensor, torch.Tensor]]:+ """Load SDNQ quantized safetensors files.++ SDNQ stores quantized weights with associated scale, zero_point (optional),+ and SVD correction matrices (optional). This loader creates SDNQTensor+ wrappers that provide on-the-fly dequantization.++ Args:+ model_path: Path to safetensors file or directory containing model files.+ compute_dtype: Dtype for dequantized computation (default: bfloat16).++ Returns:+ State dict with SDNQTensor wrappers for quantized weights and+ regular tensors for non-quantized weights.+ """+ # Determine which safetensors file(s) hold the weights. For larger models (FLUX.2 Klein 9B,+ # FLUX.2 dev, ...) the transformer is sharded across multiple ``*-NNNNN-of-MMMMM.safetensors``+ # files; we merge all of them into one state_dict before grouping.+ if model_path.is_dir():+ safetensors_files = sorted(model_path.glob("*.safetensors"))+ if not safetensors_files:+ raise ValueError(f"No safetensors files found in {model_path}")+ config_path = model_path / "quantization_config.json"+ else:+ safetensors_files = [model_path]+ config_path = model_path.parent / "quantization_config.json"++ # Load quantization config if available+ quant_config = _parse_quantization_config(config_path)++ # Get group_size from config (default: 128 for SDNQ)+ # Note: group_size=0 in config means per-tensor quantization or it needs to be inferred+ config_group_size = quant_config.get("group_size", 128)++ # Build a reverse map for dynamic-mixed-precision models. SDNQ stores+ # ``modules_dtype_dict`` as ``{dtype_name: [list of layer keys]}``; we flip it to+ # ``{layer_key: dtype_name}`` for O(1) lookup during the per-tensor type inference.+ per_tensor_dtype_map: dict[str, str] = {}+ modules_dtype_dict = quant_config.get("modules_dtype_dict") or {}+ if isinstance(modules_dtype_dict, dict):+ for dtype_name, layer_keys in modules_dtype_dict.items():+ if isinstance(layer_keys, list):+ for layer_key in layer_keys:+ per_tensor_dtype_map[layer_key] = dtype_name++ # Load and merge all safetensors shards.+ raw_sd: dict[str, torch.Tensor] = {}+ for shard in safetensors_files:+ shard_sd = load_file(shard)+ # Detect accidental key collisions between shards — would indicate a corrupted bundle.+ overlap = set(shard_sd).intersection(raw_sd)+ if overlap:+ raise ValueError(f"Duplicate keys across SDNQ shards (model={model_path}): {sorted(overlap)[:3]}")+ raw_sd.update(shard_sd)++ # Group related tensors (weight, scale, zero_point, svd_up, svd_down)+ sd: dict[str, Union[SDNQTensor, torch.Tensor]] = {}+ processed_keys: set[str] = set()++ for key in raw_sd.keys():+ if key in processed_keys:+ continue++ # Check if this is a base weight tensor+ if key.endswith(".weight"):+ base_key = key[:-7] # Remove ".weight"++ weight = raw_sd[key]+ scale_key = f"{base_key}.scale"+ zero_point_key = f"{base_key}.zero_point"+ svd_up_key = f"{base_key}.svd_up"+ svd_down_key = f"{base_key}.svd_down"++ # Check if this is a quantized tensor (has scale)+ if scale_key in raw_sd:+ scale = raw_sd[scale_key]+ zero_point = raw_sd.get(zero_point_key)+ svd_up = raw_sd.get(svd_up_key)+ svd_down = raw_sd.get(svd_down_key)++ # Determine quantization type. For dynamic-mixed-precision models, look up the+ # per-tensor dtype in the reverse map we built from ``modules_dtype_dict``.+ quant_type = _infer_quantization_type(+ weight.dtype,+ zero_point is not None,+ quant_config,+ weight=weight,+ scale=scale,+ tensor_name=key,+ per_tensor_dtype=per_tensor_dtype_map.get(key),+ )++ # Determine original shape (need quant_type and scale to handle uint4 packing).+ # For the per-group uint4/int5 types this derives in_features from the packed byte+ # count, so it does not depend on group_size.+ original_shape = _get_original_shape(+ weight, quant_config, key, quant_type, scale=scale, group_size=config_group_size or 128+ )++ # Determine group_size for this tensor.+ #+ # The scale tensor's group dimension is authoritative and takes precedence over the+ # nominal ``group_size`` from quantization_config.json. SDNQ dynamic-mixed-precision+ # models (e.g. FLUX.2 Klein 4B) quantize some layers with a group size that differs+ # from the global config value, so trusting ``config_group_size`` whenever it is > 0+ # can yield a group size that disagrees with scale.shape[1]. That mismatch makes+ # ``num_groups = in_features // group_size`` wrong and breaks the reshape/broadcast+ # in dequantize_uint4_per_group / dequantize_int5_per_group. We therefore derive the+ # per-tensor group size from ``in_features / num_groups`` whenever the scale exposes a+ # usable group dimension, and only fall back to the config value (then the SDNQ+ # default of 128) when it doesn't.+ tensor_group_size: int | None = None+ if len(original_shape) == 2 and len(scale.shape) >= 2 and scale.shape[1] > 0:+ _, in_features = original_shape+ num_groups = scale.shape[1]+ if in_features % num_groups == 0:+ tensor_group_size = in_features // num_groups+ if tensor_group_size is None:+ tensor_group_size = config_group_size if config_group_size > 0 else 128++ # Log quantization info for debugging+ logger.debug(+ f"SDNQ: {key} - type={quant_type.value}, weight_shape={weight.shape}, "+ f"weight_dtype={weight.dtype}, scale_shape={scale.shape}, "+ f"original_shape={original_shape}, group_size={tensor_group_size}"+ )++ # Create SDNQTensor+ sd[key] = SDNQTensor(+ data=weight,+ quantization_type=quant_type,+ tensor_shape=original_shape,+ compute_dtype=compute_dtype,+ scale=scale,+ zero_point=zero_point,+ svd_up=svd_up,+ svd_down=svd_down,+ group_size=tensor_group_size+ if quant_type in (SDNQQuantizationType.UINT4_ASYM, SDNQQuantizationType.INT5_ASYM)+ else None,+ )++ # Mark related keys as processed+ processed_keys.add(key)+ processed_keys.add(scale_key)+ if zero_point is not None:+ processed_keys.add(zero_point_key)+ if svd_up is not None:+ processed_keys.add(svd_up_key)+ if svd_down is not None:+ processed_keys.add(svd_down_key)+ else:+ # Regular tensor, not quantized+ sd[key] = weight+ processed_keys.add(key)++ elif key.endswith((".scale", ".zero_point", ".svd_up", ".svd_down")):+ # Skip - these are handled with their parent weight tensor+ continue++ else:+ # Other tensors (biases, norms, etc.) - copy as-is+ sd[key] = raw_sd[key]+ processed_keys.add(key)++ # Log summary+ sdnq_count = sum(1 for v in sd.values() if isinstance(v, SDNQTensor))+ regular_count = len(sd) - sdnq_count+ source_desc = (+ str(safetensors_files[0]) if len(safetensors_files) == 1 else f"{len(safetensors_files)} shards in {model_path}"+ )+ # Logged, not printed: stdout bypasses the app's log level, format and handlers, and this line+ # already went to the logger on the next call anyway.+ logger.info(f"SDNQ loader: {sdnq_count} quantized tensors, {regular_count} regular tensors from {source_desc}")++ gc.collect()+ return sd+++def has_sdnq_tensors(state_dict: dict[str, Any]) -> bool:+ """Check if state dict contains SDNQTensor instances."""+ return any(isinstance(v, SDNQTensor) for v in state_dict.values())+++def has_sdnq_keys(state_dict: dict[str, Any]) -> bool:+ """Check if state dict has SDNQ-style keys (weight + scale pairs).++ SDNQ quantized models store weights with associated scale tensors.+ This function detects this pattern to identify SDNQ models.++ Args:+ state_dict: State dict to check.++ Returns:+ True if state dict has SDNQ-style key patterns.+ """+ keys = {k for k in state_dict.keys() if isinstance(k, str)}+ for key in keys:+ if key.endswith(".weight"):+ base = key[:-7]+ if f"{base}.scale" in keys:+ return True+ return Falsediff --git a/invokeai/backend/quantization/sdnq/sdnq_tensor.py b/invokeai/backend/quantization/sdnq/sdnq_tensor.pynew file mode 100644index 0000000000..69bb1fb01e--- /dev/null+++ b/invokeai/backend/quantization/sdnq/sdnq_tensor.py@@ -0,0 +1,420 @@+"""SDNQTensor - A torch.Tensor subclass for SDNQ quantized weights with on-the-fly dequantization."""++import logging+from typing import Optional, overload++import torch++from invokeai.backend.quantization.sdnq.utils import (+ SDNQQuantizationType,+ apply_svd_correction,+ dequantize_asymmetric,+ dequantize_int5_per_group,+ dequantize_symmetric,+ dequantize_uint4_per_group,+)++logger = logging.getLogger(__name__)+++def dequantize_and_run(func, args, kwargs):+ """Helper function for running math ops on SDNQTensor inputs.++ Dequantizes the inputs and runs the function.+ Also casts other floating point tensors to match the compute_dtype of SDNQTensors.++ Some ops (e.g. ``torch.cat`` / ``torch.stack``) pass their tensors inside a list or tuple rather+ than as top-level args, so both discovery and processing recurse into sequences. Without this a+ sequence arg is left untouched — its SDNQTensors are never dequantized and ``func`` redispatches+ onto them, recursing until ``RecursionError``.+ """+ compute_dtype = None+ target_device = None++ def scan(value) -> None:+ nonlocal compute_dtype, target_device+ if isinstance(value, (list, tuple)):+ for item in value:+ scan(item)+ return+ if compute_dtype is None and hasattr(value, "compute_dtype"):+ compute_dtype = value.compute_dtype+ if target_device is None and isinstance(value, torch.Tensor):+ target_device = value.device++ for a in args:+ scan(a)+ if compute_dtype is not None and target_device is not None:+ break++ if compute_dtype is None or target_device is None:+ for v in kwargs.values():+ scan(v)+ if compute_dtype is not None and target_device is not None:+ break++ def process_tensor(t):+ if isinstance(t, (list, tuple)):+ return type(t)(process_tensor(item) for item in t)+ if hasattr(t, "get_dequantized_tensor"):+ result = t.get_dequantized_tensor()+ if target_device is not None and result.device != target_device:+ result = result.to(target_device)+ return result+ elif isinstance(t, torch.Tensor) and compute_dtype is not None and t.is_floating_point():+ return t.to(compute_dtype)+ return t++ dequantized_args = [process_tensor(a) for a in args]+ dequantized_kwargs = {k: process_tensor(v) for k, v in kwargs.items()}+ return func(*dequantized_args, **dequantized_kwargs)+++def apply_to_quantized_tensor(func, args, kwargs):+ """Apply function to quantized tensor and re-wrap result in SDNQTensor.++ Assumes that the first argument is an SDNQTensor.+ """+ sdnq_tensor = args[0]+ assert isinstance(sdnq_tensor, SDNQTensor)+ assert all(not isinstance(a, SDNQTensor) for a in args[1:])+ assert all(not isinstance(v, SDNQTensor) for v in kwargs.values())++ new_data = func(sdnq_tensor.quantized_data, *args[1:], **kwargs)++ if new_data.dtype != sdnq_tensor.quantized_data.dtype:+ raise ValueError("Operation changed the dtype of SDNQTensor unexpectedly.")++ # Realign the auxiliary payloads (scale / zero_point / svd) to the new data's device so the whole+ # wrapper lives on one device. `_to_copy` implements SDNQTensor.to(device); without this a+ # "GPU-resident" SDNQ parameter would keep its scale/zero_point/svd tensors in system RAM,+ # forcing a host->device copy of all of them (both SVD matrices included) on every dequantization+ # of every quantized layer, on every inference step. We only move the device and preserve each+ # tensor's own dtype (a dtype change to the packed data is already rejected above).+ target_device = new_data.device++ def _align(t: Optional[torch.Tensor]) -> Optional[torch.Tensor]:+ if isinstance(t, torch.Tensor) and t.device != target_device:+ return t.to(device=target_device)+ return t++ return SDNQTensor(+ data=new_data,+ quantization_type=sdnq_tensor._quantization_type,+ tensor_shape=sdnq_tensor.tensor_shape,+ compute_dtype=sdnq_tensor.compute_dtype,+ scale=_align(sdnq_tensor._scale),+ zero_point=_align(sdnq_tensor._zero_point),+ svd_up=_align(sdnq_tensor._svd_up),+ svd_down=_align(sdnq_tensor._svd_down),+ group_size=sdnq_tensor._group_size,+ )+++SDNQ_TENSOR_OP_TABLE = {+ # Ops to run on the quantized tensor (keep quantized).+ torch.ops.aten.detach.default: apply_to_quantized_tensor, # pyright: ignore+ torch.ops.aten._to_copy.default: apply_to_quantized_tensor, # pyright: ignore+ torch.ops.aten.clone.default: apply_to_quantized_tensor, # pyright: ignore+ # Ops to run on dequantized tensors.+ torch.ops.aten.t.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.linear.default: dequantize_and_run, # pyright: ignore - needed for F.linear+ torch.ops.aten.addmm.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.mm.default: dequantize_and_run, # pyright: ignore - matrix multiply+ torch.ops.aten.bmm.default: dequantize_and_run, # pyright: ignore - batch matrix multiply+ torch.ops.aten.baddbmm.default: dequantize_and_run, # pyright: ignore - batch add batch mm+ torch.ops.aten.matmul.default: dequantize_and_run, # pyright: ignore - general matmul+ # Element-wise ops+ torch.ops.aten.mul.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.mul.Scalar: dequantize_and_run, # pyright: ignore+ torch.ops.aten.add.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.add.Scalar: dequantize_and_run, # pyright: ignore+ torch.ops.aten.sub.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.sub.Scalar: dequantize_and_run, # pyright: ignore+ torch.ops.aten.div.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.div.Scalar: dequantize_and_run, # pyright: ignore+ torch.ops.aten.neg.default: dequantize_and_run, # pyright: ignore+ # Shape manipulation ops+ torch.ops.aten.slice.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.view.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.reshape.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten._unsafe_view.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.expand.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.permute.default: dequantize_and_run, # pyright: ignore - attention reshaping+ torch.ops.aten.transpose.int: dequantize_and_run, # pyright: ignore - attention+ torch.ops.aten.contiguous.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.squeeze.dim: dequantize_and_run, # pyright: ignore+ torch.ops.aten.squeeze.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.unsqueeze.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.select.int: dequantize_and_run, # pyright: ignore+ torch.ops.aten.split.Tensor: dequantize_and_run, # pyright: ignore+ torch.ops.aten.split_with_sizes.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.chunk.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.cat.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.stack.default: dequantize_and_run, # pyright: ignore+ # Attention ops+ torch.ops.aten.scaled_dot_product_attention.default: dequantize_and_run, # pyright: ignore - SDPA+ torch.ops.aten._scaled_dot_product_flash_attention.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten._scaled_dot_product_efficient_attention.default: dequantize_and_run, # pyright: ignore+ # Normalization and activation ops+ torch.ops.aten.layer_norm.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.group_norm.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.native_layer_norm.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.native_group_norm.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.silu.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.gelu.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.relu.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.softmax.int: dequantize_and_run, # pyright: ignore+ torch.ops.aten._softmax.default: dequantize_and_run, # pyright: ignore+ # Reduction ops+ torch.ops.aten.mean.dim: dequantize_and_run, # pyright: ignore+ torch.ops.aten.sum.dim_IntList: dequantize_and_run, # pyright: ignore+ torch.ops.aten.var.correction: dequantize_and_run, # pyright: ignore - for RMSNorm+ torch.ops.aten.std.correction: dequantize_and_run, # pyright: ignore+ torch.ops.aten.pow.Tensor_Scalar: dequantize_and_run, # pyright: ignore - for RMSNorm+ torch.ops.aten.rsqrt.default: dequantize_and_run, # pyright: ignore - for RMSNorm+ torch.ops.aten.sqrt.default: dequantize_and_run, # pyright: ignore+ # Misc ops+ torch.ops.aten.allclose.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.index_put_.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.embedding.default: dequantize_and_run, # pyright: ignore+ torch.ops.aten.copy_.default: dequantize_and_run, # pyright: ignore+ # Conv ops - needed for VAE+ torch.ops.aten.convolution.default: dequantize_and_run, # pyright: ignore - Conv2d uses this+ torch.ops.aten.conv2d.default: dequantize_and_run, # pyright: ignore+}+++class SDNQTensor(torch.Tensor):+ """A torch.Tensor subclass holding SDNQ quantized weights.++ Provides on-the-fly dequantization when used in operations.+ Supports symmetric/asymmetric quantization and optional SVD correction.+ """++ @staticmethod+ def __new__(+ cls,+ data: torch.Tensor,+ quantization_type: SDNQQuantizationType,+ tensor_shape: torch.Size,+ compute_dtype: torch.dtype,+ scale: torch.Tensor,+ zero_point: Optional[torch.Tensor] = None,+ svd_up: Optional[torch.Tensor] = None,+ svd_down: Optional[torch.Tensor] = None,+ group_size: Optional[int] = None,+ ):+ # Use tensor_shape (the dequantized shape) for the wrapper, not data.shape (packed shape)+ # This ensures PyTorch's load_state_dict sees the correct shape for assignment+ # Compute strides for row-major (C-contiguous) layout+ strides = []+ stride = 1+ for dim in reversed(tensor_shape):+ strides.append(stride)+ stride *= dim+ strides = tuple(reversed(strides))++ return torch.Tensor._make_wrapper_subclass( # pyright: ignore+ cls,+ tensor_shape,+ dtype=data.dtype,+ layout=data.layout,+ device=data.device,+ strides=strides,+ storage_offset=0,+ )++ def __init__(+ self,+ data: torch.Tensor,+ quantization_type: SDNQQuantizationType,+ tensor_shape: torch.Size,+ compute_dtype: torch.dtype,+ scale: torch.Tensor,+ zero_point: Optional[torch.Tensor] = None,+ svd_up: Optional[torch.Tensor] = None,+ svd_down: Optional[torch.Tensor] = None,+ group_size: Optional[int] = None,+ ):+ self.quantized_data = data+ self._quantization_type = quantization_type+ self.tensor_shape = tensor_shape+ self.compute_dtype = compute_dtype+ self._scale = scale+ self._zero_point = zero_point+ self._svd_up = svd_up+ self._svd_down = svd_down+ self._group_size = group_size++ def __repr__(self, *, tensor_contents=None):+ return (+ f"SDNQTensor(type={self._quantization_type.value}, "+ f"dequantized_shape=({self.tensor_shape}), "+ f"has_svd={self._svd_up is not None})"+ )++ @overload+ def size(self, dim: None = None) -> torch.Size: ...++ @overload+ def size(self, dim: int) -> int: ...++ def size(self, dim: int | None = None):+ """Return the size of the tensor after dequantization."""+ if dim is not None:+ return self.tensor_shape[dim]+ return self.tensor_shape++ @property+ def shape(self) -> torch.Size: # pyright: ignore[reportIncompatibleVariableOverride]+ """The shape of the tensor after dequantization."""+ return self.size()++ @property+ def quantized_shape(self) -> torch.Size:+ """The shape of the quantized tensor."""+ return self.quantized_data.shape++ @property+ def is_asymmetric(self) -> bool:+ """Whether this tensor uses asymmetric quantization."""+ return self._zero_point is not None++ @property+ def has_svd(self) -> bool:+ """Whether this tensor has SVD correction components."""+ return self._svd_up is not None and self._svd_down is not None++ def sdnq_storage_nbytes(self) -> int:+ """Actual in-memory storage of this quantized tensor, in bytes.++ Generic size accounting (calc_tensor_size) uses the wrapper's advertised (dequantized) shape+ together with the packed uint8 dtype: for uint4 that double-counts the weight (one byte per+ unpacked element instead of one per two), for int5 it counts one byte per element instead of+ five per eight, and the scale / zero_point / svd payloads are omitted entirely. This returns+ the real storage — the packed data plus every auxiliary tensor — so cache eviction and+ partial-load budgets operate on true sizes.+ """+ total = self.quantized_data.nelement() * self.quantized_data.element_size()+ for aux in (self._scale, self._zero_point, self._svd_up, self._svd_down):+ if isinstance(aux, torch.Tensor):+ total += aux.nelement() * aux.element_size()+ return total++ def requires_grad_(self, mode: bool = True) -> torch.Tensor:+ """SDNQTensor is only for inference, not training. This is a no-op."""+ return self++ # Track which tensors we've logged (to avoid spam)+ _logged_tensors: set = set()++ def get_dequantized_tensor(self) -> torch.Tensor:+ """Return the dequantized tensor.++ Returns:+ Dequantized tensor with compute_dtype.+ """+ # Debug logging for the first few tensors. Gated on the log level as well as the count: the+ # `min()`/`max()` calls below are device syncs, and this runs on the hot dequantize path.+ # Nothing here goes to stdout — that would bypass the app's log level, format and handlers.+ tensor_id = id(self)+ should_log = (+ tensor_id not in SDNQTensor._logged_tensors+ and len(SDNQTensor._logged_tensors) < 5+ and logger.isEnabledFor(logging.DEBUG)+ )+ if should_log:+ SDNQTensor._logged_tensors.add(tensor_id)+ logger.debug(+ f"SDNQ dequantize: type={self._quantization_type.value}, "+ f"weight_shape={self.quantized_data.shape}, weight_dtype={self.quantized_data.dtype}, "+ f"scale_shape={self._scale.shape}, scale_range=[{self._scale.min():.6f}, {self._scale.max():.6f}], "+ f"zp={self._zero_point is not None}, svd={self.has_svd}, group_size={self._group_size}"+ )+ if self._zero_point is not None:+ logger.debug(+ f" zero_point_shape={self._zero_point.shape}, "+ f"zp_range=[{self._zero_point.min():.6f}, {self._zero_point.max():.6f}]"+ )++ # Perform dequantization based on quantization type+ if self._quantization_type == SDNQQuantizationType.UINT4_ASYM:+ # uint4 with per-group quantization+ assert self._zero_point is not None+ assert self._group_size is not None+ dequantized = dequantize_uint4_per_group(+ self.quantized_data,+ self._scale,+ self._zero_point,+ self.tensor_shape,+ self._group_size,+ dtype=self.compute_dtype,+ )+ elif self._quantization_type == SDNQQuantizationType.INT5_ASYM:+ # Signed 5-bit with per-group quantization (8 values per 5 bytes). zero_point may+ # be absent for scale-only 5-bit tensors produced by SDNQ's dynamic-mixed pass.+ assert self._group_size is not None+ dequantized = dequantize_int5_per_group(+ self.quantized_data,+ self._scale,+ self._zero_point,+ self.tensor_shape,+ self._group_size,+ dtype=self.compute_dtype,+ )+ elif self.is_asymmetric:+ assert self._zero_point is not None+ dequantized = dequantize_asymmetric(+ self.quantized_data,+ self._scale,+ self._zero_point,+ dtype=self.compute_dtype,+ )+ else:+ dequantized = dequantize_symmetric(+ self.quantized_data,+ self._scale,+ dtype=self.compute_dtype,+ )++ # Apply SVD correction if present+ if self.has_svd:+ dequantized = apply_svd_correction(+ dequantized,+ self._svd_up,+ self._svd_down,+ dtype=self.compute_dtype,+ )++ # Reshape to original tensor shape if needed+ if dequantized.shape != self.tensor_shape:+ dequantized = dequantized.view(self.tensor_shape)++ result = dequantized.to(self.compute_dtype)++ # Log output range for debugging+ if should_log:+ logger.info(f" -> output_shape={result.shape}, output_range=[{result.min():.6f}, {result.max():.6f}]")++ return result++ # Track unknown ops to avoid spamming warnings+ _warned_ops: set = set()++ @classmethod+ def __torch_dispatch__(cls, func, types, args, kwargs):+ if func in SDNQ_TENSOR_OP_TABLE:+ return SDNQ_TENSOR_OP_TABLE[func](func, args, kwargs)++ # Fallback: dequantize and run for unknown operations+ # This ensures computation works, but may indicate missing ops+ if func not in cls._warned_ops:+ cls._warned_ops.add(func)+ import logging++ logging.getLogger(__name__).warning(+ f"SDNQTensor: unknown op {func}, dequantizing (add to op table for efficiency)"+ )++ return dequantize_and_run(func, args, kwargs)diff --git a/invokeai/backend/quantization/sdnq/utils.py b/invokeai/backend/quantization/sdnq/utils.pynew file mode 100644index 0000000000..81d88a9b05--- /dev/null+++ b/invokeai/backend/quantization/sdnq/utils.py@@ -0,0 +1,363 @@+"""SDNQ (SD.Next Quantization) utility functions and enums."""++import logging+from enum import Enum+from typing import Optional++import torch++from invokeai.backend.util.logging import InvokeAILogger++logger = InvokeAILogger.get_logger(__name__)++# How many elements the one-shot uint4 diagnostic may look at. Every figure it reports is otherwise a+# full-tensor reduction over a weight that can be gigabytes — a device sync and a real cost paid on+# the first dequantization of every model, for output nobody reads unless they are debugging.+_DIAGNOSTIC_SAMPLE_SIZE = 1024+++class SDNQQuantizationType(str, Enum):+ """SDNQ Quantization types from SD.Next."""++ INT8_SYM = "int8_sym" # Symmetric Int8 quantization+ INT8_ASYM = "int8_asym" # Asymmetric Int8 quantization+ UINT8_SYM = "uint8_sym" # Symmetric UInt8 quantization+ UINT8_ASYM = "uint8_asym" # Asymmetric UInt8 quantization+ UINT4_ASYM = "uint4_asym" # Asymmetric UInt4 quantization (packed in uint8)+ INT5_ASYM = "int5_asym" # Asymmetric signed 5-bit quantization (range -16..15, packed 8/5 bytes)+ FP8_E4M3 = "fp8_e4m3" # FP8 E4M3 format+ FP8_E5M2 = "fp8_e5m2" # FP8 E5M2 format+++def unpack_uint4(packed: torch.Tensor, original_shape: torch.Size) -> torch.Tensor:+ """Unpack uint4 values from packed uint8 tensor.++ SDNQ stores uint4 values packed as 2 values per uint8 byte:+ - Lower 4 bits: first value (packed & 0x0F)+ - Upper 4 bits: second value (packed >> 4)++ Args:+ packed: Packed uint8 tensor with shape [..., N/2] or flattened 1D.+ original_shape: Original tensor shape before packing.++ Returns:+ Unpacked tensor with shape original_shape containing uint4 values (0-15).+ """+ # If packed is 1D but original_shape is 2D, reshape to packed 2D first+ # This ensures correct unpacking order+ if packed.dim() == 1 and len(original_shape) == 2:+ out_features, in_features = original_shape+ packed_in_features = in_features // 2+ packed = packed.view(out_features, packed_in_features)++ # Extract lower and upper 4 bits+ lower = torch.bitwise_and(packed, 15)+ upper = torch.bitwise_right_shift(packed, 4)++ # Standard packing order: lower nibble first, upper nibble second+ # byte = (upper << 4) | lower means lower is at even indices, upper at odd+ unpacked = torch.stack((lower, upper), dim=-1).view(original_shape)+ return unpacked+++def unpack_uint5(packed: torch.Tensor, original_shape: torch.Size) -> torch.Tensor:+ """Unpack 5-bit values from packed uint8 tensor.++ SDNQ packs 8 5-bit values into 5 bytes (40 bits). The packed tensor has its+ last dim equal to 5, where each (..., 5) row encodes 8 unpacked values.+ Bit layout matches Disty0/sdnq's ``unpack_uint5`` so the produced order is the+ same as the producer's pack order.++ Args:+ packed: Packed uint8 tensor with shape (..., 5).+ original_shape: Original tensor shape before packing (must total to packed.numel() * 8 // 5).++ Returns:+ Unpacked tensor with shape ``original_shape`` containing values 0-31.+ """+ if packed.dim() < 2 or packed.shape[-1] != 5:+ raise ValueError(f"unpack_uint5 expects packed tensor with last dim = 5; got shape {tuple(packed.shape)}")+ result_bitwise_right_shift = torch.bitwise_right_shift(packed[..., :3], 5)+ result = torch.cat(+ (+ torch.bitwise_and(packed[..., :5], 31),+ torch.bitwise_or(+ result_bitwise_right_shift[..., :2],+ torch.bitwise_and(torch.bitwise_right_shift(packed[..., 3:5], 2), 24),+ ),+ torch.bitwise_or(+ result_bitwise_right_shift[..., 2:3],+ torch.bitwise_or(+ torch.bitwise_and(torch.bitwise_right_shift(packed[..., 3:4], 3), 16),+ torch.bitwise_and(torch.bitwise_right_shift(packed[..., 4:5], 4), 8),+ ),+ ),+ ),+ dim=-1,+ ).view(original_shape)+ return result+++def dequantize_symmetric(+ weight: torch.Tensor,+ scale: torch.Tensor,+ dtype: torch.dtype = torch.float32,+) -> torch.Tensor:+ """Symmetric dequantization: result = weight * scale.++ Args:+ weight: Quantized weight tensor (int8, uint8, or fp8).+ scale: Scale factor tensor.+ dtype: Target dtype for the result.++ Returns:+ Dequantized tensor.+ """+ # Ensure scale is on the same device as weight+ if scale.device != weight.device:+ scale = scale.to(weight.device)++ # Handle scale broadcasting for different shapes+ # Scale might be: scalar, [1], [out_features], [out_features, 1], etc.+ scale = scale.to(dtype)+ weight = weight.to(dtype)++ # Reshape scale for broadcasting if needed+ if scale.dim() == 1 and weight.dim() == 2:+ # Per-channel scale for Linear: [out_features] -> [out_features, 1]+ scale = scale.unsqueeze(-1)+ elif scale.dim() == 1 and weight.dim() == 4:+ # Per-channel scale for Conv2d: [out_channels] -> [out_channels, 1, 1, 1]+ scale = scale.view(-1, 1, 1, 1)++ return weight * scale+++def dequantize_asymmetric(+ weight: torch.Tensor,+ scale: torch.Tensor,+ zero_point: torch.Tensor,+ dtype: torch.dtype = torch.float32,+) -> torch.Tensor:+ """Asymmetric dequantization: result = weight * scale + zero_point.++ Note: SDNQ uses a different convention where zero_point is a pre-computed bias.+ Standard formula: result = (weight - zp) * scale+ SDNQ formula: result = weight * scale + zero_point (where zero_point = -zp * scale)++ Args:+ weight: Quantized weight tensor.+ scale: Scale factor tensor.+ zero_point: Zero point/bias tensor for asymmetric quantization.+ dtype: Target dtype for the result.++ Returns:+ Dequantized tensor.+ """+ # Ensure scale and zero_point are on the same device as weight+ if scale.device != weight.device:+ scale = scale.to(weight.device)+ if zero_point.device != weight.device:+ zero_point = zero_point.to(weight.device)++ # Convert to compute dtype+ scale = scale.to(dtype)+ zero_point = zero_point.to(dtype)+ weight = weight.to(dtype)++ # Reshape scale and zero_point for broadcasting if needed+ if scale.dim() == 1 and weight.dim() == 2:+ # Per-channel for Linear: [out_features] -> [out_features, 1]+ scale = scale.unsqueeze(-1)+ elif scale.dim() == 1 and weight.dim() == 4:+ # Per-channel for Conv2d: [out_channels] -> [out_channels, 1, 1, 1]+ scale = scale.view(-1, 1, 1, 1)++ if zero_point.dim() == 1 and weight.dim() == 2:+ zero_point = zero_point.unsqueeze(-1)+ elif zero_point.dim() == 1 and weight.dim() == 4:+ zero_point = zero_point.view(-1, 1, 1, 1)++ # SDNQ formula: x = q * scale + zero_point (zero_point is actually a bias)+ return weight * scale + zero_point+++# Track whether we've done diagnostic logging+_uint4_diagnostic_done = False+++def dequantize_uint4_per_group(+ packed_weight: torch.Tensor,+ scale: torch.Tensor,+ zero_point: torch.Tensor,+ original_shape: torch.Size,+ group_size: int,+ dtype: torch.dtype = torch.float32,+) -> torch.Tensor:+ """Dequantize uint4 weights with per-group scaling.++ SDNQ uint4 quantization uses:+ - Packed uint8 storage (2 uint4 values per byte)+ - Per-group scale factors+ - Per-group zero points for asymmetric quantization++ The scale tensor has shape [out_features, num_groups, 1] where+ num_groups = in_features / group_size.++ Args:+ packed_weight: Packed uint8 tensor with shape [out_features, in_features/2].+ scale: Per-group scale tensor with shape [out_features, num_groups, 1].+ zero_point: Per-group zero point tensor with shape [out_features, num_groups, 1].+ original_shape: Original weight shape [out_features, in_features].+ group_size: Number of elements per quantization group.+ dtype: Target dtype for the result.++ Returns:+ Dequantized tensor with shape original_shape.+ """+ global _uint4_diagnostic_done++ # Ensure scale and zero_point are on the same device as packed_weight+ device = packed_weight.device+ if scale.device != device:+ scale = scale.to(device)+ if zero_point.device != device:+ zero_point = zero_point.to(device)++ # Per-group scale/zero_point may be stored as [out_features, num_groups, 1] or, without the+ # trailing singleton, as [out_features, num_groups]. The grouped weight below is 3D+ # ([out_features, num_groups, group_size]); a 2D scale would right-align (group_size vs+ # num_groups) and fail broadcasting, so normalize 2D params with a trailing singleton dim.+ if scale.dim() == 2:+ scale = scale.unsqueeze(-1)+ if zero_point.dim() == 2:+ zero_point = zero_point.unsqueeze(-1)++ # Unpack uint4 values+ unpacked = unpack_uint4(packed_weight, original_shape)++ out_features, in_features = original_shape+ num_groups = in_features // group_size++ # Reshape for per-group operations: [out_features, num_groups, group_size]+ weight_grouped = unpacked.view(out_features, num_groups, group_size).to(dtype)++ # SDNQ uses pre-computed bias: x = q * scale + zero_point+ # where zero_point = -original_zp * scale (already a floating point bias)+ scale_f = scale.to(dtype)+ zp_f = zero_point.to(dtype)+ dequantized = weight_grouped * scale_f + zp_f++ # One-shot diagnostic, gated on the log level *before* computing anything: the reductions below+ # cost more than the dequantization they describe. Bounded to a fixed-size sample so that even+ # with debug logging on, the diagnostic does not scale with the tensor.+ if not _uint4_diagnostic_done and logger.isEnabledFor(logging.DEBUG):+ _uint4_diagnostic_done = True+ unpacked_sample = unpacked.flatten()[:_DIAGNOSTIC_SAMPLE_SIZE]+ dequantized_sample = dequantized.flatten()[:_DIAGNOSTIC_SAMPLE_SIZE]+ logger.debug(+ "[SDNQ uint4] packed_weight: shape=%s dtype=%s | group_size=%d num_groups=%d\n"+ " scale: shape=%s dtype=%s | zero_point: shape=%s dtype=%s\n"+ " unpacked (first %d): min=%s max=%s unique=%d\n"+ " zero_point sample: %s\n"+ " dequantized (first %d): min=%s max=%s sample=%s",+ tuple(packed_weight.shape),+ packed_weight.dtype,+ group_size,+ num_groups,+ tuple(scale.shape),+ scale.dtype,+ tuple(zero_point.shape),+ zero_point.dtype,+ unpacked_sample.numel(),+ unpacked_sample.min().item(),+ unpacked_sample.max().item(),+ len(unpacked_sample.unique()),+ zero_point.flatten()[:10].tolist(),+ dequantized_sample.numel(),+ dequantized_sample.min().item(),+ dequantized_sample.max().item(),+ dequantized_sample[:10].tolist(),+ )++ # Reshape back to original shape+ return dequantized.view(original_shape)+++def dequantize_int5_per_group(+ packed_weight: torch.Tensor,+ scale: torch.Tensor,+ zero_point: Optional[torch.Tensor],+ original_shape: torch.Size,+ group_size: int,+ dtype: torch.dtype = torch.float32,+) -> torch.Tensor:+ """Dequantize signed 5-bit weights with per-group scaling.++ SDNQ packs 8 int5 values into 5 bytes. The raw unpacked bytes give 0..31; for signed+ int5 storage we shift by ``min = -16`` to get the actual range -16..15 (matches Disty0+ upstream's ``unpack_int`` sign-extension step).++ ``zero_point`` is optional: dynamic-mixed-precision SDNQ can emit scale-only 5-bit+ tensors when the per-group loss budget allows it.+ """+ device = packed_weight.device+ if scale.device != device:+ scale = scale.to(device)+ if zero_point is not None and zero_point.device != device:+ zero_point = zero_point.to(device)++ # Normalize [out_features, num_groups] scale/zero_point to [out_features, num_groups, 1] so they+ # broadcast against the 3D grouped weight below (a 2D param would right-align group_size against+ # num_groups and fail broadcasting).+ if scale.dim() == 2:+ scale = scale.unsqueeze(-1)+ if zero_point is not None and zero_point.dim() == 2:+ zero_point = zero_point.unsqueeze(-1)++ unpacked = unpack_uint5(packed_weight, original_shape)+ # Sign-extend: SDNQ stores signed int5 (-16..15) in unsigned 5-bit (0..31) by adding 16+ # at pack time. We subtract it back here. We cast to int8 first so the subtraction stays+ # within an exact integer domain before dtype promotion.+ signed = unpacked.to(torch.int8) - 16++ out_features, in_features = original_shape+ num_groups = in_features // group_size+ weight_grouped = signed.view(out_features, num_groups, group_size).to(dtype)+ scale_f = scale.to(dtype)+ dequantized = weight_grouped * scale_f+ if zero_point is not None:+ dequantized = dequantized + zero_point.to(dtype)+ return dequantized.view(original_shape)+++def apply_svd_correction(+ dequantized: torch.Tensor,+ svd_up: Optional[torch.Tensor],+ svd_down: Optional[torch.Tensor],+ dtype: torch.dtype = torch.float32,+) -> torch.Tensor:+ """Apply SVD correction: result = dequantized + svd_up @ svd_down.++ SVD (Singular Value Decomposition) correction adds a low-rank approximation+ to improve the accuracy of quantized weights.++ Args:+ dequantized: Already dequantized tensor.+ svd_up: SVD up matrix (U * S component).+ svd_down: SVD down matrix (V^T component).+ dtype: Target dtype for the result.++ Returns:+ Tensor with SVD correction applied.+ """+ if svd_up is not None and svd_down is not None:+ # Ensure SVD matrices are on the same device as dequantized tensor+ device = dequantized.device+ if svd_up.device != device:+ svd_up = svd_up.to(device)+ if svd_down.device != device:+ svd_down = svd_down.to(device)+ svd_correction = svd_up.to(dtype) @ svd_down.to(dtype)+ return dequantized + svd_correction+ return dequantizeddiff --git a/invokeai/backend/util/calc_tensor_size.py b/invokeai/backend/util/calc_tensor_size.pyindex 70b99cd884..2a3f57ee7b 100644--- a/invokeai/backend/util/calc_tensor_size.py+++ b/invokeai/backend/util/calc_tensor_size.py@@ -3,6 +3,13 @@ import torchdef calc_tensor_size(t: torch.Tensor) -> int:"""Calculate the size of a tensor in bytes."""+ # SDNQ quantized tensors advertise the dequantized shape with a uint8 dtype, which both+ # over-counts the packed uint4/int5 storage and omits the scale/zero_point/svd payloads. Ask the+ # wrapper for its real storage. Detected by duck-typing to avoid importing the subclass (and a+ # dependency on the quantization package) into this low-level util.+ sdnq_storage_nbytes = getattr(t, "sdnq_storage_nbytes", None)+ if callable(sdnq_storage_nbytes):+ return sdnq_storage_nbytes()return t.nelement() * t.element_size()diff --git a/invokeai/frontend/web/openapi.json b/invokeai/frontend/web/openapi.jsonindex 0499e6f426..7d67e2716e 100644--- a/invokeai/frontend/web/openapi.json+++ b/invokeai/frontend/web/openapi.json@@ -907,6 +907,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -1051,6 +1060,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -1069,6 +1081,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -1311,6 +1326,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -1455,6 +1479,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -1473,6 +1500,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -1715,6 +1745,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -1859,6 +1898,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -1877,6 +1919,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -2164,6 +2209,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -2308,6 +2362,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -2326,6 +2383,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -2637,6 +2697,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -2781,6 +2850,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -2799,6 +2871,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -3940,6 +4015,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -4084,6 +4168,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -4102,6 +4189,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -14342,6 +14432,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -14486,6 +14585,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -14504,6 +14606,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -29817,14 +29922,13 @@}],"default": null,- "description": "Diffusers Flux2 Klein model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.",+ "description": "Diffusers or SDNQ-pipeline Flux2 Klein model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.","field_kind": "input","input": "direct","orig_default": null,"orig_required": false,- "title": "Qwen3 Source (Diffusers)",+ "title": "Qwen3 Source","ui_model_base": ["flux2"],- "ui_model_format": ["diffusers"],"ui_model_type": ["main"]},"max_seq_len": {@@ -29850,7 +29954,7 @@"tags": ["model", "flux", "klein", "qwen3"],"title": "Main Model - Flux2 Klein","type": "object",- "version": "1.0.0",+ "version": "1.1.0","output": {"$ref": "#/components/schemas/Flux2KleinModelLoaderOutput"}@@ -32541,7 +32645,8 @@"description": "T5 tokenizer and text encoder","field_kind": "input","input": "any",- "orig_required": true,+ "orig_default": null,+ "orig_required": false,"title": "T5 Encoder","ui_model_type": ["t5_encoder"]},@@ -32558,7 +32663,8 @@"description": "CLIP Embed loader","field_kind": "input","input": "any",- "orig_required": true,+ "orig_default": null,+ "orig_required": false,"title": "CLIP Embed","ui_model_type": ["clip_embed"]},@@ -32575,7 +32681,8 @@"description": "VAE model to load","field_kind": "input","input": "any",- "orig_required": true,+ "orig_default": null,+ "orig_required": false,"title": "VAE","ui_model_base": ["flux"],"ui_model_type": ["vae"]@@ -32592,7 +32699,7 @@"tags": ["model", "flux"],"title": "Main Model - FLUX","type": "object",- "version": "1.0.7",+ "version": "1.1.0","output": {"$ref": "#/components/schemas/FluxModelLoaderOutput"}@@ -57227,20 +57334,540 @@"title": "Config Path","description": "Path to the config for this model, if any."},- "base": {- "type": "string",- "const": "krea-2",- "title": "Base",- "default": "krea-2"- },+ "base": {+ "type": "string",+ "const": "krea-2",+ "title": "Base",+ "default": "krea-2"+ },+ "format": {+ "type": "string",+ "const": "checkpoint",+ "title": "Format",+ "default": "checkpoint"+ },+ "variant": {+ "$ref": "#/components/schemas/Krea2VariantType"+ }+ },+ "type": "object",+ "required": [+ "key",+ "hash",+ "path",+ "file_size",+ "name",+ "description",+ "source",+ "source_type",+ "source_api_response",+ "source_url",+ "cover_image",+ "type",+ "trigger_phrases",+ "default_settings",+ "config_path",+ "base",+ "format",+ "variant"+ ],+ "title": "Main_Checkpoint_Krea2_Config",+ "description": "Model config for Krea-2 single-file checkpoint models (safetensors, etc)."+ },+ "Main_Checkpoint_QwenImage_Config": {+ "properties": {+ "key": {+ "type": "string",+ "title": "Key",+ "description": "A unique key for this model."+ },+ "hash": {+ "type": "string",+ "title": "Hash",+ "description": "The hash of the model file(s)."+ },+ "path": {+ "type": "string",+ "title": "Path",+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."+ },+ "file_size": {+ "type": "integer",+ "title": "File Size",+ "description": "The size of the model in bytes."+ },+ "name": {+ "type": "string",+ "title": "Name",+ "description": "Name of the model."+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description",+ "description": "Model description"+ },+ "source": {+ "type": "string",+ "title": "Source",+ "description": "The original source of the model (path, URL or repo_id)."+ },+ "source_type": {+ "$ref": "#/components/schemas/ModelSourceType",+ "description": "The type of source"+ },+ "source_api_response": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Api Response",+ "description": "The original API response from the source, as stringified JSON."+ },+ "source_url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Url",+ "description": "Optional URL for the model (e.g. download page or model page)."+ },+ "cover_image": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cover Image",+ "description": "Url for image to preview model"+ },+ "type": {+ "type": "string",+ "const": "main",+ "title": "Type",+ "default": "main"+ },+ "trigger_phrases": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array",+ "uniqueItems": true+ },+ {+ "type": "null"+ }+ ],+ "title": "Trigger Phrases",+ "description": "Set of trigger phrases for this model"+ },+ "default_settings": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/MainModelDefaultSettings"+ },+ {+ "type": "null"+ }+ ],+ "description": "Default settings for this model"+ },+ "config_path": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Config Path",+ "description": "Path to the config for this model, if any."+ },+ "base": {+ "type": "string",+ "const": "qwen-image",+ "title": "Base",+ "default": "qwen-image"+ },+ "format": {+ "type": "string",+ "const": "checkpoint",+ "title": "Format",+ "default": "checkpoint"+ },+ "variant": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/QwenImageVariantType"+ },+ {+ "type": "null"+ }+ ]+ }+ },+ "type": "object",+ "required": [+ "key",+ "hash",+ "path",+ "file_size",+ "name",+ "description",+ "source",+ "source_type",+ "source_api_response",+ "source_url",+ "cover_image",+ "type",+ "trigger_phrases",+ "default_settings",+ "config_path",+ "base",+ "format",+ "variant"+ ],+ "title": "Main_Checkpoint_QwenImage_Config",+ "description": "Model config for Qwen Image single-file checkpoint models (safetensors, etc).\n\nCovers both raw bf16/fp16 checkpoints and ComfyUI-style fp8_scaled checkpoints.\nThe loader dequantizes fp8 weights back to bf16 at load time; the\n`default_settings.fp8_storage` toggle can then optionally re-cast to fp8 for\nVRAM savings."+ },+ "Main_Checkpoint_SD1_Config": {+ "properties": {+ "key": {+ "type": "string",+ "title": "Key",+ "description": "A unique key for this model."+ },+ "hash": {+ "type": "string",+ "title": "Hash",+ "description": "The hash of the model file(s)."+ },+ "path": {+ "type": "string",+ "title": "Path",+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."+ },+ "file_size": {+ "type": "integer",+ "title": "File Size",+ "description": "The size of the model in bytes."+ },+ "name": {+ "type": "string",+ "title": "Name",+ "description": "Name of the model."+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description",+ "description": "Model description"+ },+ "source": {+ "type": "string",+ "title": "Source",+ "description": "The original source of the model (path, URL or repo_id)."+ },+ "source_type": {+ "$ref": "#/components/schemas/ModelSourceType",+ "description": "The type of source"+ },+ "source_api_response": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Api Response",+ "description": "The original API response from the source, as stringified JSON."+ },+ "source_url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Url",+ "description": "Optional URL for the model (e.g. download page or model page)."+ },+ "cover_image": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cover Image",+ "description": "Url for image to preview model"+ },+ "type": {+ "type": "string",+ "const": "main",+ "title": "Type",+ "default": "main"+ },+ "trigger_phrases": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array",+ "uniqueItems": true+ },+ {+ "type": "null"+ }+ ],+ "title": "Trigger Phrases",+ "description": "Set of trigger phrases for this model"+ },+ "default_settings": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/MainModelDefaultSettings"+ },+ {+ "type": "null"+ }+ ],+ "description": "Default settings for this model"+ },+ "config_path": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Config Path",+ "description": "Path to the config for this model, if any."+ },+ "format": {+ "type": "string",+ "const": "checkpoint",+ "title": "Format",+ "default": "checkpoint"+ },+ "prediction_type": {+ "$ref": "#/components/schemas/SchedulerPredictionType"+ },+ "variant": {+ "$ref": "#/components/schemas/ModelVariantType"+ },+ "base": {+ "type": "string",+ "const": "sd-1",+ "title": "Base",+ "default": "sd-1"+ }+ },+ "type": "object",+ "required": [+ "key",+ "hash",+ "path",+ "file_size",+ "name",+ "description",+ "source",+ "source_type",+ "source_api_response",+ "source_url",+ "cover_image",+ "type",+ "trigger_phrases",+ "default_settings",+ "config_path",+ "format",+ "prediction_type",+ "variant",+ "base"+ ],+ "title": "Main_Checkpoint_SD1_Config"+ },+ "Main_Checkpoint_SD2_Config": {+ "properties": {+ "key": {+ "type": "string",+ "title": "Key",+ "description": "A unique key for this model."+ },+ "hash": {+ "type": "string",+ "title": "Hash",+ "description": "The hash of the model file(s)."+ },+ "path": {+ "type": "string",+ "title": "Path",+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."+ },+ "file_size": {+ "type": "integer",+ "title": "File Size",+ "description": "The size of the model in bytes."+ },+ "name": {+ "type": "string",+ "title": "Name",+ "description": "Name of the model."+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description",+ "description": "Model description"+ },+ "source": {+ "type": "string",+ "title": "Source",+ "description": "The original source of the model (path, URL or repo_id)."+ },+ "source_type": {+ "$ref": "#/components/schemas/ModelSourceType",+ "description": "The type of source"+ },+ "source_api_response": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Api Response",+ "description": "The original API response from the source, as stringified JSON."+ },+ "source_url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Url",+ "description": "Optional URL for the model (e.g. download page or model page)."+ },+ "cover_image": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cover Image",+ "description": "Url for image to preview model"+ },+ "type": {+ "type": "string",+ "const": "main",+ "title": "Type",+ "default": "main"+ },+ "trigger_phrases": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array",+ "uniqueItems": true+ },+ {+ "type": "null"+ }+ ],+ "title": "Trigger Phrases",+ "description": "Set of trigger phrases for this model"+ },+ "default_settings": {+ "anyOf": [+ {+ "$ref": "#/components/schemas/MainModelDefaultSettings"+ },+ {+ "type": "null"+ }+ ],+ "description": "Default settings for this model"+ },+ "config_path": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Config Path",+ "description": "Path to the config for this model, if any."+ },"format": {"type": "string","const": "checkpoint","title": "Format","default": "checkpoint"},+ "prediction_type": {+ "$ref": "#/components/schemas/SchedulerPredictionType"+ },"variant": {- "$ref": "#/components/schemas/Krea2VariantType"+ "$ref": "#/components/schemas/ModelVariantType"+ },+ "base": {+ "type": "string",+ "const": "sd-2",+ "title": "Base",+ "default": "sd-2"}},"type": "object",@@ -57260,14 +57887,14 @@"trigger_phrases","default_settings","config_path",- "base","format",- "variant"+ "prediction_type",+ "variant",+ "base"],- "title": "Main_Checkpoint_Krea2_Config",- "description": "Model config for Krea-2 single-file checkpoint models (safetensors, etc)."+ "title": "Main_Checkpoint_SD2_Config"},- "Main_Checkpoint_QwenImage_Config": {+ "Main_Checkpoint_SDXLRefiner_Config": {"properties": {"key": {"type": "string",@@ -57396,27 +58023,23 @@"title": "Config Path","description": "Path to the config for this model, if any."},- "base": {- "type": "string",- "const": "qwen-image",- "title": "Base",- "default": "qwen-image"- },"format": {"type": "string","const": "checkpoint","title": "Format","default": "checkpoint"},+ "prediction_type": {+ "$ref": "#/components/schemas/SchedulerPredictionType"+ },"variant": {- "anyOf": [- {- "$ref": "#/components/schemas/QwenImageVariantType"- },- {- "type": "null"- }- ]+ "$ref": "#/components/schemas/ModelVariantType"+ },+ "base": {+ "type": "string",+ "const": "sdxl-refiner",+ "title": "Base",+ "default": "sdxl-refiner"}},"type": "object",@@ -57436,14 +58059,14 @@"trigger_phrases","default_settings","config_path",- "base","format",- "variant"+ "prediction_type",+ "variant",+ "base"],- "title": "Main_Checkpoint_QwenImage_Config",- "description": "Model config for Qwen Image single-file checkpoint models (safetensors, etc).\n\nCovers both raw bf16/fp16 checkpoints and ComfyUI-style fp8_scaled checkpoints.\nThe loader dequantizes fp8 weights back to bf16 at load time; the\n`default_settings.fp8_storage` toggle can then optionally re-cast to fp8 for\nVRAM savings."+ "title": "Main_Checkpoint_SDXLRefiner_Config"},- "Main_Checkpoint_SD1_Config": {+ "Main_Checkpoint_SDXL_Config": {"properties": {"key": {"type": "string",@@ -57586,9 +58209,9 @@},"base": {"type": "string",- "const": "sd-1",+ "const": "sdxl","title": "Base",- "default": "sd-1"+ "default": "sdxl"}},"type": "object",@@ -57613,9 +58236,9 @@"variant","base"],- "title": "Main_Checkpoint_SD1_Config"+ "title": "Main_Checkpoint_SDXL_Config"},- "Main_Checkpoint_SD2_Config": {+ "Main_Checkpoint_ZImage_Config": {"properties": {"key": {"type": "string",@@ -57744,23 +58367,20 @@"title": "Config Path","description": "Path to the config for this model, if any."},+ "base": {+ "type": "string",+ "const": "z-image",+ "title": "Base",+ "default": "z-image"+ },"format": {"type": "string","const": "checkpoint","title": "Format","default": "checkpoint"},- "prediction_type": {- "$ref": "#/components/schemas/SchedulerPredictionType"- },"variant": {- "$ref": "#/components/schemas/ModelVariantType"- },- "base": {- "type": "string",- "const": "sd-2",- "title": "Base",- "default": "sd-2"+ "$ref": "#/components/schemas/ZImageVariantType"}},"type": "object",@@ -57780,14 +58400,14 @@"trigger_phrases","default_settings","config_path",+ "base","format",- "prediction_type",- "variant",- "base"+ "variant"],- "title": "Main_Checkpoint_SD2_Config"+ "title": "Main_Checkpoint_ZImage_Config",+ "description": "Model config for Z-Image single-file checkpoint models (safetensors, etc)."},- "Main_Checkpoint_SDXLRefiner_Config": {+ "Main_Diffusers_CogView4_Config": {"properties": {"key": {"type": "string",@@ -57904,35 +58524,21 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."- },"format": {"type": "string",- "const": "checkpoint",+ "const": "diffusers","title": "Format",- "default": "checkpoint"- },- "prediction_type": {- "$ref": "#/components/schemas/SchedulerPredictionType"+ "default": "diffusers"},- "variant": {- "$ref": "#/components/schemas/ModelVariantType"+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""},"base": {"type": "string",- "const": "sdxl-refiner",+ "const": "cogview4","title": "Base",- "default": "sdxl-refiner"+ "default": "cogview4"}},"type": "object",@@ -57951,15 +58557,13 @@"type","trigger_phrases","default_settings",- "config_path","format",- "prediction_type",- "variant",+ "repo_variant","base"],- "title": "Main_Checkpoint_SDXLRefiner_Config"+ "title": "Main_Diffusers_CogView4_Config"},- "Main_Checkpoint_SDXL_Config": {+ "Main_Diffusers_ErnieImage_Config": {"properties": {"key": {"type": "string",@@ -58076,35 +58680,21 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."- },"format": {"type": "string",- "const": "checkpoint",+ "const": "diffusers","title": "Format",- "default": "checkpoint"- },- "prediction_type": {- "$ref": "#/components/schemas/SchedulerPredictionType"+ "default": "diffusers"},- "variant": {- "$ref": "#/components/schemas/ModelVariantType"+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""},"base": {"type": "string",- "const": "sdxl",+ "const": "ernie-image","title": "Base",- "default": "sdxl"+ "default": "ernie-image"}},"type": "object",@@ -58123,15 +58713,14 @@"type","trigger_phrases","default_settings",- "config_path","format",- "prediction_type",- "variant",+ "repo_variant","base"],- "title": "Main_Checkpoint_SDXL_Config"+ "title": "Main_Diffusers_ErnieImage_Config",+ "description": "Model config for ERNIE-Image diffusers models (ERNIE-Image, ERNIE-Image-Turbo)."},- "Main_Checkpoint_ZImage_Config": {+ "Main_Diffusers_FLUX_Config": {"properties": {"key": {"type": "string",@@ -58248,32 +58837,24 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."+ "format": {+ "type": "string",+ "const": "diffusers",+ "title": "Format",+ "default": "diffusers"+ },+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""},"base": {"type": "string",- "const": "z-image",+ "const": "flux","title": "Base",- "default": "z-image"- },- "format": {- "type": "string",- "const": "checkpoint",- "title": "Format",- "default": "checkpoint"+ "default": "flux"},"variant": {- "$ref": "#/components/schemas/ZImageVariantType"+ "$ref": "#/components/schemas/FluxVariantType"}},"type": "object",@@ -58292,15 +58873,15 @@"type","trigger_phrases","default_settings",- "config_path",- "base","format",+ "repo_variant",+ "base","variant"],- "title": "Main_Checkpoint_ZImage_Config",- "description": "Model config for Z-Image single-file checkpoint models (safetensors, etc)."+ "title": "Main_Diffusers_FLUX_Config",+ "description": "Model config for FLUX.1 models in diffusers format."},- "Main_Diffusers_CogView4_Config": {+ "Main_Diffusers_Flux2_Config": {"properties": {"key": {"type": "string",@@ -58429,9 +59010,12 @@},"base": {"type": "string",- "const": "cogview4",+ "const": "flux2","title": "Base",- "default": "cogview4"+ "default": "flux2"+ },+ "variant": {+ "$ref": "#/components/schemas/Flux2VariantType"}},"type": "object",@@ -58452,11 +59036,13 @@"default_settings","format","repo_variant",- "base"+ "base",+ "variant"],- "title": "Main_Diffusers_CogView4_Config"+ "title": "Main_Diffusers_Flux2_Config",+ "description": "Model config for FLUX.2 models in diffusers format (FLUX.2 Klein and FLUX.2 [dev])."},- "Main_Diffusers_ErnieImage_Config": {+ "Main_Diffusers_Ideogram4_Config": {"properties": {"key": {"type": "string",@@ -58585,9 +59171,9 @@},"base": {"type": "string",- "const": "ernie-image",+ "const": "ideogram-4","title": "Base",- "default": "ernie-image"+ "default": "ideogram-4"}},"type": "object",@@ -58610,10 +59196,10 @@"repo_variant","base"],- "title": "Main_Diffusers_ErnieImage_Config",- "description": "Model config for ERNIE-Image diffusers models (ERNIE-Image, ERNIE-Image-Turbo)."+ "title": "Main_Diffusers_Ideogram4_Config",+ "description": "Model config for Ideogram 4 diffusers models (nf4 / fp8 quantized).\n\nThe on-disk layout is a diffusers pipeline folder bundling two transformers\n(transformer/ + unconditional_transformer/), a Qwen3-VL text_encoder/ + tokenizer/,\nand a FLUX.2-style vae/. Quantization (nf4 vs fp8) lives inside the component folders\nand is detected by the loader, not here."},- "Main_Diffusers_FLUX_Config": {+ "Main_Diffusers_Krea2_Config": {"properties": {"key": {"type": "string",@@ -58742,12 +59328,12 @@},"base": {"type": "string",- "const": "flux",+ "const": "krea-2","title": "Base",- "default": "flux"+ "default": "krea-2"},"variant": {- "$ref": "#/components/schemas/FluxVariantType"+ "$ref": "#/components/schemas/Krea2VariantType"}},"type": "object",@@ -58771,10 +59357,10 @@"base","variant"],- "title": "Main_Diffusers_FLUX_Config",- "description": "Model config for FLUX.1 models in diffusers format."+ "title": "Main_Diffusers_Krea2_Config",+ "description": "Model config for Krea-2 diffusers models (Krea-2-Turbo)."},- "Main_Diffusers_Flux2_Config": {+ "Main_Diffusers_QwenImage_Config": {"properties": {"key": {"type": "string",@@ -58903,12 +59489,19 @@},"base": {"type": "string",- "const": "flux2",+ "const": "qwen-image","title": "Base",- "default": "flux2"+ "default": "qwen-image"},"variant": {- "$ref": "#/components/schemas/Flux2VariantType"+ "anyOf": [+ {+ "$ref": "#/components/schemas/QwenImageVariantType"+ },+ {+ "type": "null"+ }+ ]}},"type": "object",@@ -58932,10 +59525,10 @@"base","variant"],- "title": "Main_Diffusers_Flux2_Config",- "description": "Model config for FLUX.2 models in diffusers format (FLUX.2 Klein and FLUX.2 [dev])."+ "title": "Main_Diffusers_QwenImage_Config",+ "description": "Model config for Qwen Image diffusers models (both txt2img and edit)."},- "Main_Diffusers_Ideogram4_Config": {+ "Main_Diffusers_SD1_Config": {"properties": {"key": {"type": "string",@@ -59062,11 +59655,17 @@"$ref": "#/components/schemas/ModelRepoVariant","default": ""},+ "prediction_type": {+ "$ref": "#/components/schemas/SchedulerPredictionType"+ },+ "variant": {+ "$ref": "#/components/schemas/ModelVariantType"+ },"base": {"type": "string",- "const": "ideogram-4",+ "const": "sd-1","title": "Base",- "default": "ideogram-4"+ "default": "sd-1"}},"type": "object",@@ -59087,12 +59686,13 @@"default_settings","format","repo_variant",+ "prediction_type",+ "variant","base"],- "title": "Main_Diffusers_Ideogram4_Config",- "description": "Model config for Ideogram 4 diffusers models (nf4 / fp8 quantized).\n\nThe on-disk layout is a diffusers pipeline folder bundling two transformers\n(transformer/ + unconditional_transformer/), a Qwen3-VL text_encoder/ + tokenizer/,\nand a FLUX.2-style vae/. Quantization (nf4 vs fp8) lives inside the component folders\nand is detected by the loader, not here."+ "title": "Main_Diffusers_SD1_Config"},- "Main_Diffusers_Krea2_Config": {+ "Main_Diffusers_SD2_Config": {"properties": {"key": {"type": "string",@@ -59219,14 +59819,17 @@"$ref": "#/components/schemas/ModelRepoVariant","default": ""},+ "prediction_type": {+ "$ref": "#/components/schemas/SchedulerPredictionType"+ },+ "variant": {+ "$ref": "#/components/schemas/ModelVariantType"+ },"base": {"type": "string",- "const": "krea-2",+ "const": "sd-2","title": "Base",- "default": "krea-2"- },- "variant": {- "$ref": "#/components/schemas/Krea2VariantType"+ "default": "sd-2"}},"type": "object",@@ -59247,13 +59850,13 @@"default_settings","format","repo_variant",- "base",- "variant"+ "prediction_type",+ "variant",+ "base"],- "title": "Main_Diffusers_Krea2_Config",- "description": "Model config for Krea-2 diffusers models (Krea-2-Turbo)."+ "title": "Main_Diffusers_SD2_Config"},- "Main_Diffusers_QwenImage_Config": {+ "Main_Diffusers_SD3_Config": {"properties": {"key": {"type": "string",@@ -59382,19 +59985,27 @@},"base": {"type": "string",- "const": "qwen-image",+ "const": "sd-3","title": "Base",- "default": "qwen-image"+ "default": "sd-3"},- "variant": {+ "submodels": {"anyOf": [{- "$ref": "#/components/schemas/QwenImageVariantType"+ "additionalProperties": {+ "$ref": "#/components/schemas/SubmodelDefinition"+ },+ "propertyNames": {+ "$ref": "#/components/schemas/SubModelType"+ },+ "type": "object"},{"type": "null"}- ]+ ],+ "title": "Submodels",+ "description": "Loadable submodels in this model"}},"type": "object",@@ -59416,12 +60027,11 @@"format","repo_variant","base",- "variant"+ "submodels"],- "title": "Main_Diffusers_QwenImage_Config",- "description": "Model config for Qwen Image diffusers models (both txt2img and edit)."+ "title": "Main_Diffusers_SD3_Config"},- "Main_Diffusers_SD1_Config": {+ "Main_Diffusers_SDXLRefiner_Config": {"properties": {"key": {"type": "string",@@ -59556,9 +60166,9 @@},"base": {"type": "string",- "const": "sd-1",+ "const": "sdxl-refiner","title": "Base",- "default": "sd-1"+ "default": "sdxl-refiner"}},"type": "object",@@ -59583,9 +60193,9 @@"variant","base"],- "title": "Main_Diffusers_SD1_Config"+ "title": "Main_Diffusers_SDXLRefiner_Config"},- "Main_Diffusers_SD2_Config": {+ "Main_Diffusers_SDXL_Config": {"properties": {"key": {"type": "string",@@ -59720,9 +60330,9 @@},"base": {"type": "string",- "const": "sd-2",+ "const": "sdxl","title": "Base",- "default": "sd-2"+ "default": "sdxl"}},"type": "object",@@ -59747,9 +60357,9 @@"variant","base"],- "title": "Main_Diffusers_SD2_Config"+ "title": "Main_Diffusers_SDXL_Config"},- "Main_Diffusers_SD3_Config": {+ "Main_Diffusers_Wan_Config": {"properties": {"key": {"type": "string",@@ -59878,27 +60488,30 @@},"base": {"type": "string",- "const": "sd-3",+ "const": "wan","title": "Base",- "default": "sd-3"+ "default": "wan"},- "submodels": {+ "variant": {+ "$ref": "#/components/schemas/WanVariantType"+ },+ "has_dual_expert": {+ "type": "boolean",+ "title": "Has Dual Expert",+ "description": "Whether this model ships two transformer experts (Wan 2.2 A14B MoE). False for TI2V-5B.",+ "default": false+ },+ "boundary_ratio": {"anyOf": [{- "additionalProperties": {- "$ref": "#/components/schemas/SubmodelDefinition"- },- "propertyNames": {- "$ref": "#/components/schemas/SubModelType"- },- "type": "object"+ "type": "number"},{"type": "null"}],- "title": "Submodels",- "description": "Loadable submodels in this model"+ "title": "Boundary Ratio",+ "description": "MoE expert switch point as a fraction of num_train_timesteps (typically 1000). None for single-transformer models. Read from model_index.json by Diffusers' WanPipeline."}},"type": "object",@@ -59920,11 +60533,14 @@"format","repo_variant","base",- "submodels"+ "variant",+ "has_dual_expert",+ "boundary_ratio"],- "title": "Main_Diffusers_SD3_Config"+ "title": "Main_Diffusers_Wan_Config",+ "description": "Model config for Wan 2.2 diffusers models.\n\nCovers both the dual-expert T2V-A14B family and the single-transformer TI2V-5B\nfamily. Variant is detected from the on-disk transformer config (latent channel\ncount) plus the presence of a sibling ``transformer_2/`` directory."},- "Main_Diffusers_SDXLRefiner_Config": {+ "Main_Diffusers_ZImage_Config": {"properties": {"key": {"type": "string",@@ -60051,17 +60667,14 @@"$ref": "#/components/schemas/ModelRepoVariant","default": ""},- "prediction_type": {- "$ref": "#/components/schemas/SchedulerPredictionType"- },- "variant": {- "$ref": "#/components/schemas/ModelVariantType"- },"base": {"type": "string",- "const": "sdxl-refiner",+ "const": "z-image","title": "Base",- "default": "sdxl-refiner"+ "default": "z-image"+ },+ "variant": {+ "$ref": "#/components/schemas/ZImageVariantType"}},"type": "object",@@ -60082,13 +60695,13 @@"default_settings","format","repo_variant",- "prediction_type",- "variant",- "base"+ "base",+ "variant"],- "title": "Main_Diffusers_SDXLRefiner_Config"+ "title": "Main_Diffusers_ZImage_Config",+ "description": "Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base)."},- "Main_Diffusers_SDXL_Config": {+ "Main_GGUF_FLUX_Config": {"properties": {"key": {"type": "string",@@ -60205,27 +60818,32 @@],"description": "Default settings for this model"},+ "config_path": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Config Path",+ "description": "Path to the config for this model, if any."+ },+ "base": {+ "type": "string",+ "const": "flux",+ "title": "Base",+ "default": "flux"+ },"format": {"type": "string",- "const": "diffusers",+ "const": "gguf_quantized","title": "Format",- "default": "diffusers"- },- "repo_variant": {- "$ref": "#/components/schemas/ModelRepoVariant",- "default": ""- },- "prediction_type": {- "$ref": "#/components/schemas/SchedulerPredictionType"+ "default": "gguf_quantized"},"variant": {- "$ref": "#/components/schemas/ModelVariantType"- },- "base": {- "type": "string",- "const": "sdxl",- "title": "Base",- "default": "sdxl"+ "$ref": "#/components/schemas/FluxVariantType"}},"type": "object",@@ -60244,15 +60862,15 @@"type","trigger_phrases","default_settings",+ "config_path",+ "base","format",- "repo_variant",- "prediction_type",- "variant",- "base"+ "variant"],- "title": "Main_Diffusers_SDXL_Config"+ "title": "Main_GGUF_FLUX_Config",+ "description": "Model config for main checkpoint models."},- "Main_Diffusers_Wan_Config": {+ "Main_GGUF_Flux2_Config": {"properties": {"key": {"type": "string",@@ -60369,42 +60987,32 @@],"description": "Default settings for this model"},- "format": {- "type": "string",- "const": "diffusers",- "title": "Format",- "default": "diffusers"- },- "repo_variant": {- "$ref": "#/components/schemas/ModelRepoVariant",- "default": ""- },- "base": {- "type": "string",- "const": "wan",- "title": "Base",- "default": "wan"- },- "variant": {- "$ref": "#/components/schemas/WanVariantType"- },- "has_dual_expert": {- "type": "boolean",- "title": "Has Dual Expert",- "description": "Whether this model ships two transformer experts (Wan 2.2 A14B MoE). False for TI2V-5B.",- "default": false- },- "boundary_ratio": {+ "config_path": {"anyOf": [{- "type": "number"+ "type": "string"},{"type": "null"}],- "title": "Boundary Ratio",- "description": "MoE expert switch point as a fraction of num_train_timesteps (typically 1000). None for single-transformer models. Read from model_index.json by Diffusers' WanPipeline."+ "title": "Config Path",+ "description": "Path to the config for this model, if any."+ },+ "base": {+ "type": "string",+ "const": "flux2",+ "title": "Base",+ "default": "flux2"+ },+ "format": {+ "type": "string",+ "const": "gguf_quantized",+ "title": "Format",+ "default": "gguf_quantized"+ },+ "variant": {+ "$ref": "#/components/schemas/Flux2VariantType"}},"type": "object",@@ -60423,17 +61031,15 @@"type","trigger_phrases","default_settings",- "format",- "repo_variant",+ "config_path","base",- "variant",- "has_dual_expert",- "boundary_ratio"+ "format",+ "variant"],- "title": "Main_Diffusers_Wan_Config",- "description": "Model config for Wan 2.2 diffusers models.\n\nCovers both the dual-expert T2V-A14B family and the single-transformer TI2V-5B\nfamily. Variant is detected from the on-disk transformer config (latent channel\ncount) plus the presence of a sibling ``transformer_2/`` directory."+ "title": "Main_GGUF_Flux2_Config",+ "description": "Model config for GGUF-quantized FLUX.2 checkpoint models (e.g. Klein)."},- "Main_Diffusers_ZImage_Config": {+ "Main_GGUF_Krea2_Config": {"properties": {"key": {"type": "string",@@ -60550,24 +61156,32 @@],"description": "Default settings for this model"},- "format": {- "type": "string",- "const": "diffusers",- "title": "Format",- "default": "diffusers"- },- "repo_variant": {- "$ref": "#/components/schemas/ModelRepoVariant",- "default": ""+ "config_path": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Config Path",+ "description": "Path to the config for this model, if any."},"base": {"type": "string",- "const": "z-image",+ "const": "krea-2","title": "Base",- "default": "z-image"+ "default": "krea-2"+ },+ "format": {+ "type": "string",+ "const": "gguf_quantized",+ "title": "Format",+ "default": "gguf_quantized"},"variant": {- "$ref": "#/components/schemas/ZImageVariantType"+ "$ref": "#/components/schemas/Krea2VariantType"}},"type": "object",@@ -60586,15 +61200,15 @@"type","trigger_phrases","default_settings",- "format",- "repo_variant",+ "config_path","base",+ "format","variant"],- "title": "Main_Diffusers_ZImage_Config",- "description": "Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base)."+ "title": "Main_GGUF_Krea2_Config",+ "description": "Model config for GGUF-quantized Krea-2 transformer models (single-file)."},- "Main_GGUF_FLUX_Config": {+ "Main_GGUF_QwenImage_Config": {"properties": {"key": {"type": "string",@@ -60725,9 +61339,9 @@},"base": {"type": "string",- "const": "flux",+ "const": "qwen-image","title": "Base",- "default": "flux"+ "default": "qwen-image"},"format": {"type": "string",@@ -60736,7 +61350,14 @@"default": "gguf_quantized"},"variant": {- "$ref": "#/components/schemas/FluxVariantType"+ "anyOf": [+ {+ "$ref": "#/components/schemas/QwenImageVariantType"+ },+ {+ "type": "null"+ }+ ]}},"type": "object",@@ -60760,10 +61381,10 @@"format","variant"],- "title": "Main_GGUF_FLUX_Config",- "description": "Model config for main checkpoint models."+ "title": "Main_GGUF_QwenImage_Config",+ "description": "Model config for GGUF-quantized Qwen Image transformer models."},- "Main_GGUF_Flux2_Config": {+ "Main_GGUF_Wan_Config": {"properties": {"key": {"type": "string",@@ -60894,9 +61515,9 @@},"base": {"type": "string",- "const": "flux2",+ "const": "wan","title": "Base",- "default": "flux2"+ "default": "wan"},"format": {"type": "string",@@ -60905,7 +61526,14 @@"default": "gguf_quantized"},"variant": {- "$ref": "#/components/schemas/Flux2VariantType"+ "$ref": "#/components/schemas/WanVariantType"+ },+ "expert": {+ "type": "string",+ "enum": ["high", "low", "none"],+ "title": "Expert",+ "description": "For Wan 2.2 A14B's dual-expert MoE: 'high' for the high-noise expert, 'low' for the low-noise expert. 'none' for single-transformer models (TI2V-5B).",+ "default": "none"}},"type": "object",@@ -60927,12 +61555,13 @@"config_path","base","format",- "variant"+ "variant",+ "expert"],- "title": "Main_GGUF_Flux2_Config",- "description": "Model config for GGUF-quantized FLUX.2 checkpoint models (e.g. Klein)."+ "title": "Main_GGUF_Wan_Config",+ "description": "Model config for GGUF-quantized Wan 2.2 transformer models.\n\nA14B's MoE ships as two GGUF files (one per expert); ``expert`` records\nwhich one this is so the model loader invocation can pair them. TI2V-5B\nis a single-transformer model and stores ``expert='none'``."},- "Main_GGUF_Krea2_Config": {+ "Main_GGUF_ZImage_Config": {"properties": {"key": {"type": "string",@@ -61063,9 +61692,9 @@},"base": {"type": "string",- "const": "krea-2",+ "const": "z-image","title": "Base",- "default": "krea-2"+ "default": "z-image"},"format": {"type": "string",@@ -61074,7 +61703,7 @@"default": "gguf_quantized"},"variant": {- "$ref": "#/components/schemas/Krea2VariantType"+ "$ref": "#/components/schemas/ZImageVariantType"}},"type": "object",@@ -61098,10 +61727,10 @@"format","variant"],- "title": "Main_GGUF_Krea2_Config",- "description": "Model config for GGUF-quantized Krea-2 transformer models (single-file)."+ "title": "Main_GGUF_ZImage_Config",+ "description": "Model config for GGUF-quantized Z-Image transformer models."},- "Main_GGUF_QwenImage_Config": {+ "Main_SDNQ_Diffusers_FLUX_Config": {"properties": {"key": {"type": "string",@@ -61218,39 +61847,42 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."- },"base": {"type": "string",- "const": "qwen-image",+ "const": "flux","title": "Base",- "default": "qwen-image"+ "default": "flux"},"format": {"type": "string",- "const": "gguf_quantized",+ "const": "sdnq_quantized","title": "Format",- "default": "gguf_quantized"+ "default": "sdnq_quantized"},"variant": {+ "$ref": "#/components/schemas/FluxVariantType"+ },+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""+ },+ "submodels": {"anyOf": [{- "$ref": "#/components/schemas/QwenImageVariantType"+ "additionalProperties": {+ "$ref": "#/components/schemas/SubmodelDefinition"+ },+ "propertyNames": {+ "$ref": "#/components/schemas/SubModelType"+ },+ "type": "object"},{"type": "null"}- ]+ ],+ "title": "Submodels",+ "description": "Loadable submodels in this model"}},"type": "object",@@ -61269,15 +61901,16 @@"type","trigger_phrases","default_settings",- "config_path","base","format",- "variant"+ "variant",+ "repo_variant",+ "submodels"],- "title": "Main_GGUF_QwenImage_Config",- "description": "Model config for GGUF-quantized Qwen Image transformer models."+ "title": "Main_SDNQ_Diffusers_FLUX_Config",+ "description": "Model config for SDNQ-quantized FLUX models in diffusers format (folder with transformer, text_encoder, etc.)."},- "Main_GGUF_Wan_Config": {+ "Main_SDNQ_Diffusers_Flux2_Config": {"properties": {"key": {"type": "string",@@ -61394,39 +62027,42 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."- },"base": {"type": "string",- "const": "wan",+ "const": "flux2","title": "Base",- "default": "wan"+ "default": "flux2"},"format": {"type": "string",- "const": "gguf_quantized",+ "const": "sdnq_quantized","title": "Format",- "default": "gguf_quantized"+ "default": "sdnq_quantized"},"variant": {- "$ref": "#/components/schemas/WanVariantType"+ "$ref": "#/components/schemas/Flux2VariantType"},- "expert": {- "type": "string",- "enum": ["high", "low", "none"],- "title": "Expert",- "description": "For Wan 2.2 A14B's dual-expert MoE: 'high' for the high-noise expert, 'low' for the low-noise expert. 'none' for single-transformer models (TI2V-5B).",- "default": "none"+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""+ },+ "submodels": {+ "anyOf": [+ {+ "additionalProperties": {+ "$ref": "#/components/schemas/SubmodelDefinition"+ },+ "propertyNames": {+ "$ref": "#/components/schemas/SubModelType"+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Submodels",+ "description": "Loadable submodels in this model"}},"type": "object",@@ -61445,16 +62081,16 @@"type","trigger_phrases","default_settings",- "config_path","base","format","variant",- "expert"+ "repo_variant",+ "submodels"],- "title": "Main_GGUF_Wan_Config",- "description": "Model config for GGUF-quantized Wan 2.2 transformer models.\n\nA14B's MoE ships as two GGUF files (one per expert); ``expert`` records\nwhich one this is so the model loader invocation can pair them. TI2V-5B\nis a single-transformer model and stores ``expert='none'``."+ "title": "Main_SDNQ_Diffusers_Flux2_Config",+ "description": "Model config for SDNQ-quantized FLUX.2 models in diffusers format\n(Flux2KleinPipeline / Flux2Pipeline folder with transformer/, text_encoder/, vae/, ...)."},- "Main_GGUF_ZImage_Config": {+ "Main_SDNQ_Diffusers_ZImage_Config": {"properties": {"key": {"type": "string",@@ -61571,18 +62207,6 @@],"description": "Default settings for this model"},- "config_path": {- "anyOf": [- {- "type": "string"- },- {- "type": "null"- }- ],- "title": "Config Path",- "description": "Path to the config for this model, if any."- },"base": {"type": "string","const": "z-image",@@ -61591,12 +62215,34 @@},"format": {"type": "string",- "const": "gguf_quantized",+ "const": "sdnq_quantized","title": "Format",- "default": "gguf_quantized"+ "default": "sdnq_quantized"},"variant": {"$ref": "#/components/schemas/ZImageVariantType"+ },+ "repo_variant": {+ "$ref": "#/components/schemas/ModelRepoVariant",+ "default": ""+ },+ "submodels": {+ "anyOf": [+ {+ "additionalProperties": {+ "$ref": "#/components/schemas/SubmodelDefinition"+ },+ "propertyNames": {+ "$ref": "#/components/schemas/SubModelType"+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "title": "Submodels",+ "description": "Loadable submodels in this model"}},"type": "object",@@ -61615,13 +62261,14 @@"type","trigger_phrases","default_settings",- "config_path","base","format",- "variant"+ "variant",+ "repo_variant",+ "submodels"],- "title": "Main_GGUF_ZImage_Config",- "description": "Model config for GGUF-quantized Z-Image transformer models."+ "title": "Main_SDNQ_Diffusers_ZImage_Config",+ "description": "Model config for SDNQ-quantized Z-Image models in diffusers format (full ZImagePipeline folder)."},"MaskCombineInvocation": {"category": "mask",@@ -65650,6 +66297,7 @@"bnb_quantized_nf4b","gguf_quantized","external_api",+ "sdnq_quantized","unknown"],"title": "ModelFormat",@@ -65982,6 +66630,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -66126,6 +66783,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -66144,6 +66804,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -66632,6 +67295,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -66776,6 +67448,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -66794,6 +67469,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -67167,6 +67845,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -67311,6 +67998,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -67329,6 +68019,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -67558,6 +68251,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -67702,6 +68404,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -67720,6 +68425,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -68419,6 +69127,15 @@{"$ref": "#/components/schemas/Main_GGUF_Krea2_Config"},+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_Flux2_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_FLUX_Config"+ },+ {+ "$ref": "#/components/schemas/Main_SDNQ_Diffusers_ZImage_Config"+ },{"$ref": "#/components/schemas/VAE_Checkpoint_SD1_Config"},@@ -68563,6 +69280,9 @@{"$ref": "#/components/schemas/T5Encoder_BnBLLMint8_Config"},+ {+ "$ref": "#/components/schemas/T5Encoder_SDNQ_Config"+ },{"$ref": "#/components/schemas/T5Encoder_GGUF_Config"},@@ -68581,6 +69301,9 @@{"$ref": "#/components/schemas/Qwen3Encoder_GGUF_Config"},+ {+ "$ref": "#/components/schemas/Qwen3Encoder_SDNQ_Folder_Config"+ },{"$ref": "#/components/schemas/MistralEncoder_Diffusers_Config"},@@ -72406,6 +73129,147 @@"title": "Qwen3Encoder_Qwen3Encoder_Config","description": "Configuration for Qwen3 Encoder models in a diffusers-like format.\n\nThe model weights are expected to be in a folder called text_encoder inside the model directory,\ncompatible with Qwen2VLForConditionalGeneration or similar architectures used by Z-Image."},+ "Qwen3Encoder_SDNQ_Folder_Config": {+ "properties": {+ "key": {+ "type": "string",+ "title": "Key",+ "description": "A unique key for this model."+ },+ "hash": {+ "type": "string",+ "title": "Hash",+ "description": "The hash of the model file(s)."+ },+ "path": {+ "type": "string",+ "title": "Path",+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."+ },+ "file_size": {+ "type": "integer",+ "title": "File Size",+ "description": "The size of the model in bytes."+ },+ "name": {+ "type": "string",+ "title": "Name",+ "description": "Name of the model."+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description",+ "description": "Model description"+ },+ "source": {+ "type": "string",+ "title": "Source",+ "description": "The original source of the model (path, URL or repo_id)."+ },+ "source_type": {+ "$ref": "#/components/schemas/ModelSourceType",+ "description": "The type of source"+ },+ "source_api_response": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Api Response",+ "description": "The original API response from the source, as stringified JSON."+ },+ "source_url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Url",+ "description": "Optional URL for the model (e.g. download page or model page)."+ },+ "cover_image": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cover Image",+ "description": "Url for image to preview model"+ },+ "base": {+ "type": "string",+ "const": "any",+ "title": "Base",+ "default": "any"+ },+ "type": {+ "type": "string",+ "const": "qwen3_encoder",+ "title": "Type",+ "default": "qwen3_encoder"+ },+ "format": {+ "type": "string",+ "const": "sdnq_quantized",+ "title": "Format",+ "default": "sdnq_quantized"+ },+ "cpu_only": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cpu Only",+ "description": "Whether this model should run on CPU only"+ },+ "variant": {+ "$ref": "#/components/schemas/Qwen3VariantType",+ "description": "Qwen3 model size variant (4B or 8B)"+ }+ },+ "type": "object",+ "required": [+ "key",+ "hash",+ "path",+ "file_size",+ "name",+ "description",+ "source",+ "source_type",+ "source_api_response",+ "source_url",+ "cover_image",+ "base",+ "type",+ "format",+ "cpu_only",+ "variant"+ ],+ "title": "Qwen3Encoder_SDNQ_Folder_Config",+ "description": "Configuration for folder-based SDNQ-quantized Qwen3 Encoder models.\n\nUsed for SDNQ bundles where the text_encoder is a folder containing\nquantization_config.json and safetensors files with SDNQ keys."+ },"Qwen3VLEncoderField": {"description": "Field for the Qwen3-VL text encoder used by Krea-2 models.","properties": {@@ -82083,6 +82947,142 @@"title": "T5Encoder_GGUF_Config","description": "Configuration for GGUF-quantized T5 text encoder models in a single .gguf file.\n\nThese are conversions like city96/t5-v1_1-xxl-encoder-gguf, which use llama.cpp's T5 encoder\ntensor naming (``enc.blk.N.*``, ``token_embd.weight``, ``enc.output_norm.weight``)."},+ "T5Encoder_SDNQ_Config": {+ "properties": {+ "key": {+ "type": "string",+ "title": "Key",+ "description": "A unique key for this model."+ },+ "hash": {+ "type": "string",+ "title": "Hash",+ "description": "The hash of the model file(s)."+ },+ "path": {+ "type": "string",+ "title": "Path",+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."+ },+ "file_size": {+ "type": "integer",+ "title": "File Size",+ "description": "The size of the model in bytes."+ },+ "name": {+ "type": "string",+ "title": "Name",+ "description": "Name of the model."+ },+ "description": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Description",+ "description": "Model description"+ },+ "source": {+ "type": "string",+ "title": "Source",+ "description": "The original source of the model (path, URL or repo_id)."+ },+ "source_type": {+ "$ref": "#/components/schemas/ModelSourceType",+ "description": "The type of source"+ },+ "source_api_response": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Api Response",+ "description": "The original API response from the source, as stringified JSON."+ },+ "source_url": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Source Url",+ "description": "Optional URL for the model (e.g. download page or model page)."+ },+ "cover_image": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cover Image",+ "description": "Url for image to preview model"+ },+ "base": {+ "type": "string",+ "const": "any",+ "title": "Base",+ "default": "any"+ },+ "type": {+ "type": "string",+ "const": "t5_encoder",+ "title": "Type",+ "default": "t5_encoder"+ },+ "format": {+ "type": "string",+ "const": "sdnq_quantized",+ "title": "Format",+ "default": "sdnq_quantized"+ },+ "cpu_only": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "title": "Cpu Only",+ "description": "Whether this model should run on CPU only"+ }+ },+ "type": "object",+ "required": [+ "key",+ "hash",+ "path",+ "file_size",+ "name",+ "description",+ "source",+ "source_type",+ "source_api_response",+ "source_url",+ "cover_image",+ "base",+ "type",+ "format",+ "cpu_only"+ ],+ "title": "T5Encoder_SDNQ_Config",+ "description": "Configuration for SDNQ-quantized T5 Encoder models.\n\nMatches two layouts:\n\n1. **Standalone T5 bundle**: ``mod.path`` is the pipeline-style root, with\n ``text_encoder_2/`` (and usually ``tokenizer_2/``) as subfolders.\n2. **Inline submodel**: ``mod.path`` *is* the ``text_encoder_2`` folder itself \u2014\n this is how a parent FluxPipeline / similar config registers its T5 submodel\n (``submodels[TextEncoder2].path_or_prefix`` points straight at the folder).\n\nIn both cases, the SDNQ-quantized state lives next to a ``config.json`` declaring\n``T5EncoderModel`` and is signalled either by ``quantization_config.json`` with\n``quant_method == \"sdnq\"`` or by SDNQ-style ``weight`` + ``scale`` key pairs."+ },"T5Encoder_T5Encoder_Config": {"properties": {"key": {@@ -91762,14 +92762,13 @@}],"default": null,- "description": "Diffusers Z-Image model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.",+ "description": "Z-Image pipeline model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.","field_kind": "input","input": "direct","orig_default": null,"orig_required": false,- "title": "Qwen3 Source (Diffusers)",+ "title": "Qwen3 Source","ui_model_base": ["z-image"],- "ui_model_format": ["diffusers"],"ui_model_type": ["main"]},"type": {@@ -91784,7 +92783,7 @@"tags": ["model", "z-image"],"title": "Main Model - Z-Image","type": "object",- "version": "3.0.0",+ "version": "3.1.0","output": {"$ref": "#/components/schemas/ZImageModelLoaderOutput"}diff --git a/invokeai/frontend/web/src/features/modelManagerV2/models.ts b/invokeai/frontend/web/src/features/modelManagerV2/models.tsindex d607a0058f..3c9d4a128e 100644--- a/invokeai/frontend/web/src/features/modelManagerV2/models.ts+++ b/invokeai/frontend/web/src/features/modelManagerV2/models.ts@@ -337,6 +337,7 @@ export const MODEL_FORMAT_TO_LONG_NAME: Record<ModelFormat, string> = {bnb_quantized_int8b: 'BNB Quantized (int8b)',bnb_quantized_nf4b: 'BNB Quantized (nf4b)',gguf_quantized: 'GGUF Quantized',+ sdnq_quantized: 'SDNQ Quantized',unknown: 'Unknown',};diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelFormatBadge.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelFormatBadge.tsxindex f4ea9f06f2..7b62a728df 100644--- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelFormatBadge.tsx+++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelFormatBadge.tsx@@ -23,6 +23,7 @@ const FORMAT_NAME_MAP: Record<ModelFormat, string> = {bnb_quantized_int8b: 'bnb_quantized_int8b',bnb_quantized_nf4b: 'quantized',gguf_quantized: 'gguf',+ sdnq_quantized: 'sdnq',omi: 'omi',external_api: 'external_api',unknown: 'unknown',@@ -48,6 +49,7 @@ const FORMAT_COLOR_MAP: Record<ModelFormat, string> = {bnb_quantized_int8b: 'base',bnb_quantized_nf4b: 'base',gguf_quantized: 'base',+ sdnq_quantized: 'base',unknown: 'red',olive: 'base',onnx: 'base',diff --git a/invokeai/frontend/web/src/features/nodes/types/common.ts b/invokeai/frontend/web/src/features/nodes/types/common.tsindex fe9d8e7ad8..c38cd493b5 100644--- a/invokeai/frontend/web/src/features/nodes/types/common.ts+++ b/invokeai/frontend/web/src/features/nodes/types/common.ts@@ -239,6 +239,7 @@ export const zModelFormat = z.enum(['bnb_quantized_int8b','bnb_quantized_nf4b','gguf_quantized',+ 'sdnq_quantized','external_api','unknown',]);diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.test.ts b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.test.tsindex 7c78a8c090..004344421f 100644--- a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.test.ts+++ b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.test.ts@@ -579,3 +579,73 @@ describe('buildFLUXGraph (FLUX.2 [dev])', () => {});});});++// ---------------------------------------------------------------------------+// FLUX.1: a complete SDNQ pipeline supplies its own T5 / CLIP / VAE+//+// The backend model loader falls back to the main model for any omitted component, but the graph+// builder used to assert all three were selected, so that path was unreachable from the UI.+// ---------------------------------------------------------------------------++const flux1SdnqPipelineModel = {+ key: 'flux1-sdnq-pipeline',+ hash: 'flux1-sdnq-hash',+ name: 'FLUX.1 dev SDNQ',+ base: 'flux',+ type: 'main',+ format: 'sdnq_quantized',+ variant: 'dev',+ submodels: {+ transformer: {},+ vae: {},+ text_encoder: {},+ tokenizer: {},+ text_encoder_2: {},+ tokenizer_2: {},+ },+};++const flux1SingleFileModel = {+ key: 'flux1-gguf',+ hash: 'flux1-gguf-hash',+ name: 'FLUX.1 dev GGUF',+ base: 'flux',+ type: 'main',+ format: 'gguf_quantized',+ variant: 'dev',+};++const getFluxModelLoaderNode = async () => {+ const { g } = await buildFLUXGraph(buildGraphArg());+ const graph = g.getGraph();+ const entry = Object.entries(graph.nodes).find(([id]) => id.startsWith('flux_model_loader:'));+ return entry?.[1] as Record<string, unknown> | undefined;+};++describe('buildFLUXGraph – self-contained FLUX.1 SDNQ pipeline', () => {+ it('omits the standalone component inputs when the pipeline ships them', async () => {+ currentModel = { ...flux1SdnqPipelineModel };++ const loader = await getFluxModelLoaderNode();++ expect(loader).toBeDefined();+ expect(loader!.t5_encoder_model).toBeUndefined();+ expect(loader!.clip_embed_model).toBeUndefined();+ expect(loader!.vae_model).toBeUndefined();+ // The main model is still wired in — the node resolves the parts from it.+ expect(loader!.model).toBeDefined();+ });++ it('still requires the standalone components for a single-file FLUX.1 model', async () => {+ currentModel = { ...flux1SingleFileModel };++ await expect(buildFLUXGraph(buildGraphArg())).rejects.toThrow(/T5 Encoder/);+ });++ it('still requires them when the pipeline is missing its T5 pair', async () => {+ const { text_encoder_2: _te2, tokenizer_2: _tok2, ...withoutT5 } = flux1SdnqPipelineModel.submodels;+ currentModel = { ...flux1SdnqPipelineModel, submodels: withoutT5 };++ await expect(buildFLUXGraph(buildGraphArg())).rejects.toThrow(/T5 Encoder/);+ });+});diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.tsindex c4ab83bedc..7d99890a61 100644--- a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.ts+++ b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildFLUXGraph.ts@@ -43,6 +43,7 @@ import { selectActiveTab } from 'features/ui/store/uiSelectors';import { t } from 'i18next';import { selectFlux2DevDiffusersModels, selectFlux2DiffusersModels } from 'services/api/hooks/modelsByType';import type { Invocation } from 'services/api/types';+import { isSelfContainedSDNQFlux1Pipeline } from 'services/api/types';import type { Equals } from 'tsafe';import { assert } from 'tsafe';@@ -85,7 +86,11 @@ export const buildFLUXGraph = async (arg: GraphBuilderArg): Promise<GraphBuilderconst kleinQwen3EncoderModel = selectKleinQwen3EncoderModel(state);const flux2DevMistralEncoderModel = selectFlux2DevMistralEncoderModel(state);- if (!isFlux2) {+ // A complete SDNQ FLUX.1 pipeline supplies its own T5, CLIP and VAE; the model loader node falls+ // back to them when the corresponding input is omitted. Asserting here regardless would make that+ // path unreachable, which is what readiness now also allows for.+ const flux1PipelineSuppliesComponents = !isFlux2 && isSelfContainedSDNQFlux1Pipeline(model);+ if (!isFlux2 && !flux1PipelineSuppliesComponents) {assert(t5EncoderModel, 'No T5 Encoder model found in state');assert(clipEmbedModel, 'No CLIP Embed model found in state');assert(fluxVAE, 'No FLUX VAE model found in state');@@ -277,9 +282,16 @@ export const buildFLUXGraph = async (arg: GraphBuilderArg): Promise<GraphBuildertype: 'flux_model_loader',id: getPrefixedId('flux_model_loader'),model,- t5_encoder_model: t5EncoderModel!,- clip_embed_model: clipEmbedModel!,- vae_model: fluxVAE,+ // Omitted when the pipeline supplies them itself — the node then resolves each from the main+ // model. Sending an explicit `null` would be indistinguishable, but leaving the keys off keeps+ // the graph honest about what the user actually chose.+ ...(flux1PipelineSuppliesComponents+ ? {}+ : {+ t5_encoder_model: t5EncoderModel!,+ clip_embed_model: clipEmbedModel!,+ vae_model: fluxVAE,+ }),});posCond = g.addNode({diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.tsindex d3b2a899b4..1f6f3553b9 100644--- a/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts+++ b/invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts@@ -40,7 +40,7 @@ import { UnsupportedGenerationModeError } from 'features/nodes/util/graph/types'import { selectActiveTab } from 'features/ui/store/uiSelectors';import { t } from 'i18next';import type { Invocation } from 'services/api/types';-import { isNonRefinerMainModelConfig } from 'services/api/types';+import { isNonRefinerMainModelConfig, isSelfContainedSDNQPipeline } from 'services/api/types';import type { Equals } from 'tsafe';import { assert } from 'tsafe';@@ -60,9 +60,19 @@ export const buildZImageGraph = async (arg: GraphBuilderArg): Promise<GraphBuildconst zImageQwen3EncoderModel = selectZImageQwen3EncoderModel(state);const zImageQwen3SourceModel = selectZImageQwen3SourceModel(state);+ // An SDNQ-quantized Z-Image pipeline install is self-contained: it ships the VAE and Qwen3+ // encoder (text_encoder + tokenizer) as submodels of the main model. In that case the+ // z_image_model_loader falls back to the main model for those submodels, so no separate component+ // source is required. A truthy submodels dict is not enough — a partial pipeline may expose only+ // some submodels — so require every one the loader needs. Single-file / GGUF Z-Image models don't+ // have submodels and still need a standalone VAE + Qwen3 (or Qwen3 Source).+ const mainIsSelfContainedPipeline =+ (model as { format?: unknown }).format === 'sdnq_quantized' && isSelfContainedSDNQPipeline(model);+// Validate that we have the required models- const hasVaeSource = zImageVaeModel !== null || zImageQwen3SourceModel !== null;- const hasQwen3Source = zImageQwen3EncoderModel !== null || zImageQwen3SourceModel !== null;+ const hasVaeSource = mainIsSelfContainedPipeline || zImageVaeModel !== null || zImageQwen3SourceModel !== null;+ const hasQwen3Source =+ mainIsSelfContainedPipeline || zImageQwen3EncoderModel !== null || zImageQwen3SourceModel !== null;assert(hasVaeSource, 'No VAE source: Set either VAE or Qwen3 Source model');assert(hasQwen3Source, 'No Qwen3 Encoder source: Set either Qwen3 Encoder or Qwen3 Source model');diff --git a/invokeai/frontend/web/src/features/queue/store/readiness.test.ts b/invokeai/frontend/web/src/features/queue/store/readiness.test.tsindex 87d0e64785..8b0fc55db5 100644--- a/invokeai/frontend/web/src/features/queue/store/readiness.test.ts+++ b/invokeai/frontend/web/src/features/queue/store/readiness.test.ts@@ -51,6 +51,23 @@ const flux2GGUF9BModel = {const flux2VaeModel = { key: 'vae', name: 'VAE', base: 'flux2', type: 'vae' };const kleinQwen3Model = { key: 'qwen3', name: 'Qwen3', base: 'flux2', type: 'qwen3_encoder' };+const flux2SdnqPipelineModel = {+ key: 'flux2-sdnq',+ hash: 'h',+ name: 'FLUX.2 Klein 4B SDNQ',+ base: 'flux2',+ type: 'main',+ format: 'sdnq_quantized',+ variant: 'klein_4b',+ submodels: { transformer: {}, vae: {}, text_encoder: {}, tokenizer: {} },+} as unknown as MainModelConfig;++const flux2SdnqPartialModel = {+ ...flux2SdnqPipelineModel,+ key: 'flux2-sdnq-partial',+ submodels: { transformer: {} },+} as unknown as MainModelConfig;+const baseDynamicPrompts: DynamicPromptsState = {_version: 1,maxPrompts: 100,@@ -225,6 +242,129 @@ describe('FLUX.2 Klein readiness checks – generate tab', () => {});});+describe('FLUX.2 Klein SDNQ pipeline readiness checks', () => {+ it('generate: no errors for a full SDNQ pipeline (self-contained) with no component sources', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildGenerateTabArg({ model: flux2SdnqPipelineModel }));+ expect(hasFlux2VaeReason(reasons)).toBe(false);+ expect(hasFlux2Qwen3Reason(reasons)).toBe(false);+ });++ it('generate: errors for a partial SDNQ pipeline (only transformer submodel) with no sources', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildGenerateTabArg({ model: flux2SdnqPartialModel }));+ expect(hasFlux2VaeReason(reasons)).toBe(true);+ expect(hasFlux2Qwen3Reason(reasons)).toBe(true);+ });++ it('canvas: no errors for a full SDNQ pipeline (self-contained) with no component sources', () => {+ const reasons = getReasonsWhyCannotEnqueueCanvasTab(buildCanvasTabArg({ model: flux2SdnqPipelineModel }) as never);+ expect(hasFlux2VaeReason(reasons)).toBe(false);+ expect(hasFlux2Qwen3Reason(reasons)).toBe(false);+ });++ it('canvas: errors for a partial SDNQ pipeline (only transformer submodel) with no sources', () => {+ const reasons = getReasonsWhyCannotEnqueueCanvasTab(buildCanvasTabArg({ model: flux2SdnqPartialModel }) as never);+ expect(hasFlux2VaeReason(reasons)).toBe(true);+ expect(hasFlux2Qwen3Reason(reasons)).toBe(true);+ });+});++const zImageSdnqPipelineModel = {+ key: 'z-image-sdnq',+ hash: 'h',+ name: 'Z-Image Turbo SDNQ',+ base: 'z-image',+ type: 'main',+ format: 'sdnq_quantized',+ submodels: { transformer: {}, vae: {}, text_encoder: {}, tokenizer: {} },+} as unknown as MainModelConfig;++const zImageGgufModel = {+ key: 'z-image-gguf',+ hash: 'h',+ name: 'Z-Image Turbo GGUF',+ base: 'z-image',+ type: 'main',+ format: 'gguf_quantized',+} as unknown as MainModelConfig;++const buildZImageTabArg = (overrides: {+ model?: MainModelConfig | null;+ zImageVaeModel?: unknown;+ zImageQwen3EncoderModel?: unknown;+ zImageQwen3SourceModel?: unknown;+}) => ({+ isConnected: true,+ model: overrides.model ?? zImageGgufModel,+ params: {+ ...baseParams,+ zImageVaeModel: overrides.zImageVaeModel ?? null,+ zImageQwen3EncoderModel: overrides.zImageQwen3EncoderModel ?? null,+ zImageQwen3SourceModel: overrides.zImageQwen3SourceModel ?? null,+ } as unknown as ParamsState,+ refImages: baseRefImages,+ loras: [],+ dynamicPrompts: baseDynamicPrompts,+ hasFlux2DiffusersVaeSource: false,+ hasFlux2DiffusersQwen3Source: false,+ hasFlux2DevDiffusersSource: false,+});++const hasZImageVaeReason = (reasons: { content: string }[]) =>+ reasons.some((r) => r.content.includes('noZImageVaeSourceSelected'));++const hasZImageQwen3Reason = (reasons: { content: string }[]) =>+ reasons.some((r) => r.content.includes('noZImageQwen3EncoderSourceSelected'));++describe('Z-Image readiness checks – generate tab', () => {+ it('no errors when main model is a self-contained SDNQ pipeline (no component source selected)', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildZImageTabArg({ model: zImageSdnqPipelineModel }));+ expect(hasZImageVaeReason(reasons)).toBe(false);+ expect(hasZImageQwen3Reason(reasons)).toBe(false);+ });++ it('errors for both VAE and Qwen3 when GGUF model with no component source selected', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildZImageTabArg({ model: zImageGgufModel }));+ expect(hasZImageVaeReason(reasons)).toBe(true);+ expect(hasZImageQwen3Reason(reasons)).toBe(true);+ });++ it('no errors when GGUF model has a Qwen3 Source (supplies both VAE and encoder)', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(+ buildZImageTabArg({ model: zImageGgufModel, zImageQwen3SourceModel: { key: 'src' } })+ );+ expect(hasZImageVaeReason(reasons)).toBe(false);+ expect(hasZImageQwen3Reason(reasons)).toBe(false);+ });++ it('errors only for VAE when GGUF model has a standalone Qwen3 encoder but no VAE source', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(+ buildZImageTabArg({ model: zImageGgufModel, zImageQwen3EncoderModel: { key: 'enc' } })+ );+ expect(hasZImageVaeReason(reasons)).toBe(true);+ expect(hasZImageQwen3Reason(reasons)).toBe(false);+ });++ it('does not treat a non-pipeline SDNQ model (no submodels) as self-contained', () => {+ const zImageSdnqSingleFile = {+ ...zImageSdnqPipelineModel,+ submodels: undefined,+ } as unknown as MainModelConfig;+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildZImageTabArg({ model: zImageSdnqSingleFile }));+ expect(hasZImageVaeReason(reasons)).toBe(true);+ expect(hasZImageQwen3Reason(reasons)).toBe(true);+ });++ it('does not treat a partial SDNQ pipeline (missing vae/text_encoder/tokenizer) as self-contained', () => {+ const zImageSdnqPartial = {+ ...zImageSdnqPipelineModel,+ submodels: { transformer: {} },+ } as unknown as MainModelConfig;+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildZImageTabArg({ model: zImageSdnqPartial }));+ expect(hasZImageVaeReason(reasons)).toBe(true);+ expect(hasZImageQwen3Reason(reasons)).toBe(true);+ });+});+describe('FLUX.2 Klein readiness checks – canvas tab', () => {it('no errors when main model is diffusers', () => {const reasons = getReasonsWhyCannotEnqueueCanvasTab(buildCanvasTabArg({ model: flux2DiffusersModel }) as never);@@ -341,6 +481,7 @@ const buildPidCanvasArg = (model: MainModelConfig, bboxSide: number) => ({canvasIsSelectingObject: false,hasFlux2DiffusersVaeSource: false,hasFlux2DiffusersQwen3Source: false,+ hasFlux2DevDiffusersSource: false,});const hasBboxGridReason = (reasons: { content: string }[]) =>@@ -481,3 +622,70 @@ describe('Ideogram 4 readiness checks - canvas tab', () => {expect(hasReasonWith(reasons, 'rgReferenceImagesNotSupported')).toBe(true);});});++// ---------------------------------------------------------------------------+// FLUX.1: a complete SDNQ pipeline supplies its own T5 / CLIP / VAE+// ---------------------------------------------------------------------------++// `submodels` is not on MainModelConfig (the generated schema doesn't carry the SDNQ variants), so+// keep the map as its own const rather than reading it back through the cast.+const flux1PipelineSubmodels = {+ transformer: {},+ vae: {},+ text_encoder: {},+ tokenizer: {},+ text_encoder_2: {},+ tokenizer_2: {},+};++const flux1SdnqPipelineModel = {+ key: 'flux1-sdnq-pipeline',+ hash: 'flux1-sdnq-hash',+ name: 'FLUX.1 dev SDNQ',+ base: 'flux',+ type: 'main',+ format: 'sdnq_quantized',+ variant: 'dev',+ submodels: flux1PipelineSubmodels,+} as unknown as MainModelConfig;++const flux1SingleFileModel = {+ key: 'flux1-gguf',+ hash: 'flux1-gguf-hash',+ name: 'FLUX.1 dev GGUF',+ base: 'flux',+ type: 'main',+ format: 'gguf_quantized',+ variant: 'dev',+} as unknown as MainModelConfig;++const flux1ComponentReasons = (reasons: { content: string }[]) =>+ reasons.filter(+ (r) =>+ r.content.includes('noT5EncoderModelSelected') ||+ r.content.includes('noCLIPEmbedModelSelected') ||+ r.content.includes('noFLUXVAEModelSelected')+ );++describe('FLUX.1 readiness – self-contained SDNQ pipeline', () => {+ it('does not demand standalone T5 / CLIP / VAE when the pipeline ships them', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildGenerateTabArg({ model: flux1SdnqPipelineModel }));++ expect(flux1ComponentReasons(reasons)).toEqual([]);+ });++ it('still demands all three for a single-file FLUX.1 model', () => {+ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildGenerateTabArg({ model: flux1SingleFileModel }));++ expect(flux1ComponentReasons(reasons)).toHaveLength(3);+ });++ it('still demands them when the pipeline is missing its T5 pair', () => {+ const { text_encoder_2: _te2, tokenizer_2: _tok2, ...withoutT5 } = flux1PipelineSubmodels;+ const partial = { ...flux1SdnqPipelineModel, submodels: withoutT5 } as unknown as MainModelConfig;++ const reasons = getReasonsWhyCannotEnqueueGenerateTab(buildGenerateTabArg({ model: partial }));++ expect(flux1ComponentReasons(reasons)).toHaveLength(3);+ });+});diff --git a/invokeai/frontend/web/src/features/queue/store/readiness.ts b/invokeai/frontend/web/src/features/queue/store/readiness.tsindex 644c82889c..81751025c9 100644--- a/invokeai/frontend/web/src/features/queue/store/readiness.ts+++ b/invokeai/frontend/web/src/features/queue/store/readiness.ts@@ -46,7 +46,11 @@ import { atom, computed } from 'nanostores';import { useEffect } from 'react';import { selectFlux2DevDiffusersModels, selectFlux2DiffusersModels } from 'services/api/hooks/modelsByType';import type { MainOrExternalModelConfig } from 'services/api/types';-import { isExternalApiModelConfig } from 'services/api/types';+import {+ isExternalApiModelConfig,+ isSelfContainedSDNQFlux1Pipeline,+ isSelfContainedSDNQPipeline,+} from 'services/api/types';import { $isConnected } from 'services/events/stores';/**@@ -288,14 +292,20 @@ export const getReasonsWhyCannotEnqueueGenerateTab = (arg: {} else if (isExternalApiModelConfig(model)) {// external models don't require local sub-models} else if (model.base === 'flux') {- if (!params.t5EncoderModel) {- reasons.push({ content: i18n.t('parameters.invoke.noT5EncoderModelSelected') });- }- if (!params.clipEmbedModel) {- reasons.push({ content: i18n.t('parameters.invoke.noCLIPEmbedModelSelected') });- }- if (!params.fluxVAE) {- reasons.push({ content: i18n.t('parameters.invoke.noFLUXVAEModelSelected') });+ // A complete SDNQ FLUX.1 pipeline install ships its own T5, CLIP and VAE, and the model loader+ // node falls back to them, so requiring the standalone selections here would keep that path+ // unreachable from the UI. Anything else (single-file, GGUF, BnB) still needs all three.+ const mainSuppliesComponents = isSelfContainedSDNQFlux1Pipeline(model);+ if (!mainSuppliesComponents) {+ if (!params.t5EncoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noT5EncoderModelSelected') });+ }+ if (!params.clipEmbedModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noCLIPEmbedModelSelected') });+ }+ if (!params.fluxVAE) {+ reasons.push({ content: i18n.t('parameters.invoke.noFLUXVAEModelSelected') });+ }}if (params.pidMode !== 'off') {if (!params.pidDecoderModel) {@@ -307,24 +317,33 @@ export const getReasonsWhyCannotEnqueueGenerateTab = (arg: {}}- if (model?.base === 'flux2' && model.format !== 'diffusers') {- // Non-diffusers FLUX.2 models need standalone VAE + text encoder unless a Diffusers- // pipeline of the matching variant family is installed to extract from.- if ('variant' in model && model.variant === 'dev') {- // FLUX.2 [dev]: needs FLUX.2 VAE + Mistral text encoder.- if (!params.flux2VaeModel && !hasFlux2DevDiffusersSource) {- reasons.push({ content: i18n.t('parameters.invoke.noFlux2DevVaeModelSelected') });- }- if (!params.flux2DevMistralEncoderModel && !hasFlux2DevDiffusersSource) {- reasons.push({ content: i18n.t('parameters.invoke.noFlux2DevMistralEncoderModelSelected') });- }- } else {- // FLUX.2 Klein: needs FLUX.2 VAE + Qwen3 text encoder (variant-matched).- if (!params.flux2VaeModel && !hasFlux2DiffusersVaeSource) {- reasons.push({ content: i18n.t('parameters.invoke.noFlux2KleinVaeModelSelected') });- }- if (!params.kleinQwen3EncoderModel && !hasFlux2DiffusersQwen3Source) {- reasons.push({ content: i18n.t('parameters.invoke.noFlux2KleinQwen3EncoderModelSelected') });+ if (model?.base === 'flux2') {+ // A FLUX.2 model is a self-sufficient source when its config exposes the diffusers-style+ // submodels (transformer/vae/text_encoder/tokenizer). Plain Diffusers pipelines always do; an+ // SDNQ pipeline qualifies only when it ships all of them — a truthy submodels dict is not enough,+ // since a partial pipeline may expose only the transformer and the backend would then request+ // missing fixed subfolders. Single-file / GGUF models have no submodels and need a standalone+ // VAE + text encoder, or a Diffusers source of the matching variant family.+ const mainIsPipeline =+ model.format === 'diffusers' ||+ ((model as { format?: unknown }).format === 'sdnq_quantized' && isSelfContainedSDNQPipeline(model));+ if (!mainIsPipeline) {+ if ('variant' in model && model.variant === 'dev') {+ // FLUX.2 [dev]: needs FLUX.2 VAE + Mistral text encoder.+ if (!params.flux2VaeModel && !hasFlux2DevDiffusersSource) {+ reasons.push({ content: i18n.t('parameters.invoke.noFlux2DevVaeModelSelected') });+ }+ if (!params.flux2DevMistralEncoderModel && !hasFlux2DevDiffusersSource) {+ reasons.push({ content: i18n.t('parameters.invoke.noFlux2DevMistralEncoderModelSelected') });+ }+ } else {+ // FLUX.2 Klein: needs FLUX.2 VAE + Qwen3 text encoder (variant-matched).+ if (!params.flux2VaeModel && !hasFlux2DiffusersVaeSource) {+ reasons.push({ content: i18n.t('parameters.invoke.noFlux2KleinVaeModelSelected') });+ }+ if (!params.kleinQwen3EncoderModel && !hasFlux2DiffusersQwen3Source) {+ reasons.push({ content: i18n.t('parameters.invoke.noFlux2KleinQwen3EncoderModelSelected') });+ }}}}@@ -396,15 +415,33 @@ export const getReasonsWhyCannotEnqueueGenerateTab = (arg: {}if (model?.base === 'z-image') {- // Check if VAE source is available (either separate VAE or Qwen3 Source)- const hasVaeSource = params.zImageVaeModel !== null || params.zImageQwen3SourceModel !== null;- if (!hasVaeSource) {- reasons.push({ content: i18n.t('parameters.invoke.noZImageVaeSourceSelected') });+ // An SDNQ-quantized Z-Image pipeline install is self-contained: it ships the VAE and Qwen3+ // encoder (text_encoder + tokenizer) as submodels of the main model, so no separate component+ // source is required. A truthy submodels dict is not enough — a partial pipeline may expose only+ // some submodels — so require every one the loader needs. Single-file / GGUF Z-Image models+ // don't have submodels and still need a standalone VAE + Qwen3 (or a Qwen3 Source model).+ const mainIsSelfContainedPipeline =+ (model as { format?: unknown }).format === 'sdnq_quantized' && isSelfContainedSDNQPipeline(model);+ if (!mainIsSelfContainedPipeline) {+ // Check if VAE source is available (either separate VAE or Qwen3 Source)+ const hasVaeSource = params.zImageVaeModel !== null || params.zImageQwen3SourceModel !== null;+ if (!hasVaeSource) {+ reasons.push({ content: i18n.t('parameters.invoke.noZImageVaeSourceSelected') });+ }+ // Check if Qwen3 Encoder source is available (either separate Encoder or Qwen3 Source)+ const hasQwen3Source = params.zImageQwen3EncoderModel !== null || params.zImageQwen3SourceModel !== null;+ if (!hasQwen3Source) {+ reasons.push({ content: i18n.t('parameters.invoke.noZImageQwen3EncoderSourceSelected') });+ }}- // Check if Qwen3 Encoder source is available (either separate Encoder or Qwen3 Source)- const hasQwen3Source = params.zImageQwen3EncoderModel !== null || params.zImageQwen3SourceModel !== null;- if (!hasQwen3Source) {- reasons.push({ content: i18n.t('parameters.invoke.noZImageQwen3EncoderSourceSelected') });+ // PiD decode (Z-Image reuses the FLUX decoder) needs both a PiD decoder and the Gemma-2 caption encoder.+ if (params.pidMode !== 'off') {+ if (!params.pidDecoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noPidDecoderModelSelected') });+ }+ if (!params.gemma2EncoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noGemma2EncoderModelSelected') });+ }}// PiD decode (Z-Image reuses the FLUX decoder) needs both a PiD decoder and the Gemma-2 caption encoder.if (params.pidMode !== 'off') {@@ -676,14 +713,20 @@ export const getReasonsWhyCannotEnqueueCanvasTab = (arg: {} else if (isExternalApiModelConfig(model)) {// external models don't require local sub-models} else if (model.base === 'flux') {- if (!params.t5EncoderModel) {- reasons.push({ content: i18n.t('parameters.invoke.noT5EncoderModelSelected') });- }- if (!params.clipEmbedModel) {- reasons.push({ content: i18n.t('parameters.invoke.noCLIPEmbedModelSelected') });- }- if (!params.fluxVAE) {- reasons.push({ content: i18n.t('parameters.invoke.noFLUXVAEModelSelected') });+ // A complete SDNQ FLUX.1 pipeline install ships its own T5, CLIP and VAE, and the model loader+ // node falls back to them, so requiring the standalone selections here would keep that path+ // unreachable from the UI. Anything else (single-file, GGUF, BnB) still needs all three.+ const mainSuppliesComponents = isSelfContainedSDNQFlux1Pipeline(model);+ if (!mainSuppliesComponents) {+ if (!params.t5EncoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noT5EncoderModelSelected') });+ }+ if (!params.clipEmbedModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noCLIPEmbedModelSelected') });+ }+ if (!params.fluxVAE) {+ reasons.push({ content: i18n.t('parameters.invoke.noFLUXVAEModelSelected') });+ }}const { bbox } = canvas;@@ -747,9 +790,16 @@ export const getReasonsWhyCannotEnqueueCanvasTab = (arg: {}if (model?.base === 'flux2') {- // Non-diffusers FLUX.2 models need standalone VAE + text encoder unless a Diffusers- // pipeline of the matching variant family is installed to extract from.- if (model.format !== 'diffusers') {+ // A FLUX.2 model is a self-sufficient source when its config exposes the diffusers-style+ // submodels. Plain Diffusers pipelines always do; an SDNQ pipeline qualifies only when it ships+ // all of them — a truthy submodels dict is not enough, since a partial pipeline may expose only+ // the transformer and the backend would then request missing fixed subfolders. Mirrors the+ // generate-tab check so both tabs behave identically.+ const mainIsPipeline =+ model.format === 'diffusers' ||+ ((model as { format?: unknown }).format === 'sdnq_quantized' && isSelfContainedSDNQPipeline(model));+ // VAE is shared across variants, but the text encoder requires a variant-matching diffusers model.+ if (!mainIsPipeline) {if ('variant' in model && model.variant === 'dev') {if (!params.flux2VaeModel && !hasFlux2DevDiffusersSource) {reasons.push({ content: i18n.t('parameters.invoke.noFlux2DevVaeModelSelected') });@@ -1120,15 +1170,57 @@ export const getReasonsWhyCannotEnqueueCanvasTab = (arg: {}if (model?.base === 'z-image') {- // Check if VAE source is available (either separate VAE or Qwen3 Source)- const hasVaeSource = params.zImageVaeModel !== null || params.zImageQwen3SourceModel !== null;- if (!hasVaeSource) {- reasons.push({ content: i18n.t('parameters.invoke.noZImageVaeSourceSelected') });+ // An SDNQ-quantized Z-Image pipeline install is self-contained: it ships the VAE and Qwen3+ // encoder (text_encoder + tokenizer) as submodels of the main model, so no separate component+ // source is required. A truthy submodels dict is not enough — a partial pipeline may expose only+ // some submodels — so require every one the loader needs. Single-file / GGUF Z-Image models+ // don't have submodels and still need a standalone VAE + Qwen3 (or a Qwen3 Source model).+ const mainIsSelfContainedPipeline =+ (model as { format?: unknown }).format === 'sdnq_quantized' && isSelfContainedSDNQPipeline(model);+ if (!mainIsSelfContainedPipeline) {+ // Check if VAE source is available (either separate VAE or Qwen3 Source)+ const hasVaeSource = params.zImageVaeModel !== null || params.zImageQwen3SourceModel !== null;+ if (!hasVaeSource) {+ reasons.push({ content: i18n.t('parameters.invoke.noZImageVaeSourceSelected') });+ }+ // Check if Qwen3 Encoder source is available (either separate Encoder or Qwen3 Source)+ const hasQwen3Source = params.zImageQwen3EncoderModel !== null || params.zImageQwen3SourceModel !== null;+ if (!hasQwen3Source) {+ reasons.push({ content: i18n.t('parameters.invoke.noZImageQwen3EncoderSourceSelected') });+ }}- // Check if Qwen3 Encoder source is available (either separate Encoder or Qwen3 Source)- const hasQwen3Source = params.zImageQwen3EncoderModel !== null || params.zImageQwen3SourceModel !== null;- if (!hasQwen3Source) {- reasons.push({ content: i18n.t('parameters.invoke.noZImageQwen3EncoderSourceSelected') });+ // PiD decode on the Canvas: decoder + Gemma-2 encoder required, and "Scale Before Processing" must be off.+ if (params.pidMode !== 'off') {+ if (!params.pidDecoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noPidDecoderModelSelected') });+ }+ if (!params.gemma2EncoderModel) {+ reasons.push({ content: i18n.t('parameters.invoke.noGemma2EncoderModelSelected') });+ }+ if (canvas.bbox.scaleMethod !== 'none') {+ reasons.push({ content: i18n.t('parameters.invoke.pidScaleBeforeProcessingMustBeOff') });+ }+ // Native mode generates at bbox/4, so the bbox must be a multiple of the PiD-scaled grid (grid*4) for+ // bbox/4 to land on the grid; without this a 1040px bbox silently becomes a 256px generation.+ const gridSize = getGridSize('z-image', getPidScale(params.pidMode));+ if (canvas.bbox.rect.width % gridSize !== 0) {+ reasons.push({+ content: i18n.t('parameters.invoke.modelIncompatibleBboxWidth', {+ model: 'Z-Image',+ width: canvas.bbox.rect.width,+ multiple: gridSize,+ }),+ });+ }+ if (canvas.bbox.rect.height % gridSize !== 0) {+ reasons.push({+ content: i18n.t('parameters.invoke.modelIncompatibleBboxHeight', {+ model: 'Z-Image',+ height: canvas.bbox.rect.height,+ multiple: gridSize,+ }),+ });+ }}// PiD decode on the Canvas: decoder + Gemma-2 encoder required, and "Scale Before Processing" must be off.if (params.pidMode !== 'off') {diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.tsindex 2928b7170d..5c4bf08a56 100644--- a/invokeai/frontend/web/src/services/api/schema.ts+++ b/invokeai/frontend/web/src/services/api/schema.ts@@ -4200,7 +4200,7 @@ export type components = {*/type: "anima_text_encoder";};- AnyModelConfig: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ AnyModelConfig: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];/*** AppVersion* @description App Version Response@@ -12172,8 +12172,8 @@ export type components = {*/qwen3_encoder_model?: components["schemas"]["ModelIdentifierField"] | null;/**- * Qwen3 Source (Diffusers)- * @description Diffusers Flux2 Klein model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.+ * Qwen3 Source+ * @description Diffusers or SDNQ-pipeline Flux2 Klein model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.* @default null*/qwen3_source_model?: components["schemas"]["ModelIdentifierField"] | null;@@ -25852,6 +25852,286 @@ export type components = {format: "gguf_quantized";variant: components["schemas"]["ZImageVariantType"];};+ /**+ * Main_SDNQ_Diffusers_FLUX_Config+ * @description Model config for SDNQ-quantized FLUX models in diffusers format (folder with transformer, text_encoder, etc.).+ */+ Main_SDNQ_Diffusers_FLUX_Config: {+ /**+ * Key+ * @description A unique key for this model.+ */+ key: string;+ /**+ * Hash+ * @description The hash of the model file(s).+ */+ hash: string;+ /**+ * Path+ * @description Path to the model on the filesystem. Relative paths are relative to the Invoke root directory.+ */+ path: string;+ /**+ * File Size+ * @description The size of the model in bytes.+ */+ file_size: number;+ /**+ * Name+ * @description Name of the model.+ */+ name: string;+ /**+ * Description+ * @description Model description+ */+ description: string | null;+ /**+ * Source+ * @description The original source of the model (path, URL or repo_id).+ */+ source: string;+ /** @description The type of source */+ source_type: components["schemas"]["ModelSourceType"];+ /**+ * Source Api Response+ * @description The original API response from the source, as stringified JSON.+ */+ source_api_response: string | null;+ /**+ * Source Url+ * @description Optional URL for the model (e.g. download page or model page).+ */+ source_url: string | null;+ /**+ * Cover Image+ * @description Url for image to preview model+ */+ cover_image: string | null;+ /**+ * Type+ * @default main+ * @constant+ */+ type: "main";+ /**+ * Trigger Phrases+ * @description Set of trigger phrases for this model+ */+ trigger_phrases: string[] | null;+ /** @description Default settings for this model */+ default_settings: components["schemas"]["MainModelDefaultSettings"] | null;+ /**+ * Base+ * @default flux+ * @constant+ */+ base: "flux";+ /**+ * Format+ * @default sdnq_quantized+ * @constant+ */+ format: "sdnq_quantized";+ variant: components["schemas"]["FluxVariantType"];+ /** @default */+ repo_variant: components["schemas"]["ModelRepoVariant"];+ /**+ * Submodels+ * @description Loadable submodels in this model+ */+ submodels: {+ [key: string]: components["schemas"]["SubmodelDefinition"];+ } | null;+ };+ /**+ * Main_SDNQ_Diffusers_Flux2_Config+ * @description Model config for SDNQ-quantized FLUX.2 models in diffusers format+ * (Flux2KleinPipeline / Flux2Pipeline folder with transformer/, text_encoder/, vae/, ...).+ */+ Main_SDNQ_Diffusers_Flux2_Config: {+ /**+ * Key+ * @description A unique key for this model.+ */+ key: string;+ /**+ * Hash+ * @description The hash of the model file(s).+ */+ hash: string;+ /**+ * Path+ * @description Path to the model on the filesystem. Relative paths are relative to the Invoke root directory.+ */+ path: string;+ /**+ * File Size+ * @description The size of the model in bytes.+ */+ file_size: number;+ /**+ * Name+ * @description Name of the model.+ */+ name: string;+ /**+ * Description+ * @description Model description+ */+ description: string | null;+ /**+ * Source+ * @description The original source of the model (path, URL or repo_id).+ */+ source: string;+ /** @description The type of source */+ source_type: components["schemas"]["ModelSourceType"];+ /**+ * Source Api Response+ * @description The original API response from the source, as stringified JSON.+ */+ source_api_response: string | null;+ /**+ * Source Url+ * @description Optional URL for the model (e.g. download page or model page).+ */+ source_url: string | null;+ /**+ * Cover Image+ * @description Url for image to preview model+ */+ cover_image: string | null;+ /**+ * Type+ * @default main+ * @constant+ */+ type: "main";+ /**+ * Trigger Phrases+ * @description Set of trigger phrases for this model+ */+ trigger_phrases: string[] | null;+ /** @description Default settings for this model */+ default_settings: components["schemas"]["MainModelDefaultSettings"] | null;+ /**+ * Base+ * @default flux2+ * @constant+ */+ base: "flux2";+ /**+ * Format+ * @default sdnq_quantized+ * @constant+ */+ format: "sdnq_quantized";+ variant: components["schemas"]["Flux2VariantType"];+ /** @default */+ repo_variant: components["schemas"]["ModelRepoVariant"];+ /**+ * Submodels+ * @description Loadable submodels in this model+ */+ submodels: {+ [key: string]: components["schemas"]["SubmodelDefinition"];+ } | null;+ };+ /**+ * Main_SDNQ_Diffusers_ZImage_Config+ * @description Model config for SDNQ-quantized Z-Image models in diffusers format (full ZImagePipeline folder).+ */+ Main_SDNQ_Diffusers_ZImage_Config: {+ /**+ * Key+ * @description A unique key for this model.+ */+ key: string;+ /**+ * Hash+ * @description The hash of the model file(s).+ */+ hash: string;+ /**+ * Path+ * @description Path to the model on the filesystem. Relative paths are relative to the Invoke root directory.+ */+ path: string;+ /**+ * File Size+ * @description The size of the model in bytes.+ */+ file_size: number;+ /**+ * Name+ * @description Name of the model.+ */+ name: string;+ /**+ * Description+ * @description Model description+ */+ description: string | null;+ /**+ * Source+ * @description The original source of the model (path, URL or repo_id).+ */+ source: string;+ /** @description The type of source */+ source_type: components["schemas"]["ModelSourceType"];+ /**+ * Source Api Response+ * @description The original API response from the source, as stringified JSON.+ */+ source_api_response: string | null;+ /**+ * Source Url+ * @description Optional URL for the model (e.g. download page or model page).+ */+ source_url: string | null;+ /**+ * Cover Image+ * @description Url for image to preview model+ */+ cover_image: string | null;+ /**+ * Type+ * @default main+ * @constant+ */+ type: "main";+ /**+ * Trigger Phrases+ * @description Set of trigger phrases for this model+ */+ trigger_phrases: string[] | null;+ /** @description Default settings for this model */+ default_settings: components["schemas"]["MainModelDefaultSettings"] | null;+ /**+ * Base+ * @default z-image+ * @constant+ */+ base: "z-image";+ /**+ * Format+ * @default sdnq_quantized+ * @constant+ */+ format: "sdnq_quantized";+ variant: components["schemas"]["ZImageVariantType"];+ /** @default */+ repo_variant: components["schemas"]["ModelRepoVariant"];+ /**+ * Submodels+ * @description Loadable submodels in this model+ */+ submodels: {+ [key: string]: components["schemas"]["SubmodelDefinition"];+ } | null;+ };/*** Combine Masks* @description Combine two masks together by multiplying them using `PIL.ImageChops.multiply()`.@@ -27870,7 +28150,7 @@ export type components = {* @description Storage format of model.* @enum {string}*/- ModelFormat: "omi" | "diffusers" | "checkpoint" | "lycoris" | "onnx" | "olive" | "embedding_file" | "embedding_folder" | "invokeai" | "t5_encoder" | "qwen3_encoder" | "qwen_vl_encoder" | "qwen3_vl_encoder" | "mistral_encoder" | "wan_t5_encoder" | "gemma2_encoder" | "bnb_quantized_int8b" | "bnb_quantized_nf4b" | "gguf_quantized" | "external_api" | "unknown";+ ModelFormat: "omi" | "diffusers" | "checkpoint" | "lycoris" | "onnx" | "olive" | "embedding_file" | "embedding_folder" | "invokeai" | "t5_encoder" | "qwen3_encoder" | "qwen_vl_encoder" | "qwen3_vl_encoder" | "mistral_encoder" | "wan_t5_encoder" | "gemma2_encoder" | "bnb_quantized_int8b" | "bnb_quantized_nf4b" | "gguf_quantized" | "external_api" | "sdnq_quantized" | "unknown";/** ModelIdentifierField */ModelIdentifierField: {/**@@ -28007,7 +28287,7 @@ export type components = {* Config* @description The installed model's config*/- config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};/*** ModelInstallDownloadProgressEvent@@ -28173,7 +28453,7 @@ export type components = {* Config Out* @description After successful installation, this will hold the configuration object.*/- config_out?: (components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"]) | null;+ config_out?: (components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"]) | null;/*** Inplace* @description Leave model in its current location; otherwise install under models directory@@ -28259,7 +28539,7 @@ export type components = {* Config* @description The model's config*/- config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];/*** @description The submodel type, if any* @default null@@ -28286,7 +28566,7 @@ export type components = {* Config* @description The model's config*/- config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ config: components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];/*** @description The submodel type, if any* @default null@@ -28513,7 +28793,7 @@ export type components = {*/ModelsList: {/** Models */- models: (components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"])[];+ models: (components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"])[];};/*** Multiply Integers@@ -30617,6 +30897,92 @@ export type components = {/** @description Qwen3 model size variant (4B or 8B) */variant: components["schemas"]["Qwen3VariantType"];};+ /**+ * Qwen3Encoder_SDNQ_Folder_Config+ * @description Configuration for folder-based SDNQ-quantized Qwen3 Encoder models.+ *+ * Used for SDNQ bundles where the text_encoder is a folder containing+ * quantization_config.json and safetensors files with SDNQ keys.+ */+ Qwen3Encoder_SDNQ_Folder_Config: {+ /**+ * Key+ * @description A unique key for this model.+ */+ key: string;+ /**+ * Hash+ * @description The hash of the model file(s).+ */+ hash: string;+ /**+ * Path+ * @description Path to the model on the filesystem. Relative paths are relative to the Invoke root directory.+ */+ path: string;+ /**+ * File Size+ * @description The size of the model in bytes.+ */+ file_size: number;+ /**+ * Name+ * @description Name of the model.+ */+ name: string;+ /**+ * Description+ * @description Model description+ */+ description: string | null;+ /**+ * Source+ * @description The original source of the model (path, URL or repo_id).+ */+ source: string;+ /** @description The type of source */+ source_type: components["schemas"]["ModelSourceType"];+ /**+ * Source Api Response+ * @description The original API response from the source, as stringified JSON.+ */+ source_api_response: string | null;+ /**+ * Source Url+ * @description Optional URL for the model (e.g. download page or model page).+ */+ source_url: string | null;+ /**+ * Cover Image+ * @description Url for image to preview model+ */+ cover_image: string | null;+ /**+ * Base+ * @default any+ * @constant+ */+ base: "any";+ /**+ * Type+ * @default qwen3_encoder+ * @constant+ */+ type: "qwen3_encoder";+ /**+ * Format+ * @default sdnq_quantized+ * @constant+ */+ format: "sdnq_quantized";+ /**+ * Cpu Only+ * @description Whether this model should run on CPU only+ */+ cpu_only: boolean | null;+ /** @description Qwen3 model size variant (4B or 8B) */+ variant: components["schemas"]["Qwen3VariantType"];+ };/*** Qwen3VLEncoderField* @description Field for the Qwen3-VL text encoder used by Krea-2 models.@@ -35639,6 +36005,99 @@ export type components = {*/cpu_only: boolean | null;};+ /**+ * T5Encoder_SDNQ_Config+ * @description Configuration for SDNQ-quantized T5 Encoder models.+ *+ * Matches two layouts:+ *+ * 1. **Standalone T5 bundle**: ``mod.path`` is the pipeline-style root, with+ * ``text_encoder_2/`` (and usually ``tokenizer_2/``) as subfolders.+ * 2. **Inline submodel**: ``mod.path`` *is* the ``text_encoder_2`` folder itself —+ * this is how a parent FluxPipeline / similar config registers its T5 submodel+ * (``submodels[TextEncoder2].path_or_prefix`` points straight at the folder).+ *+ * In both cases, the SDNQ-quantized state lives next to a ``config.json`` declaring+ * ``T5EncoderModel`` and is signalled either by ``quantization_config.json`` with+ * ``quant_method == "sdnq"`` or by SDNQ-style ``weight`` + ``scale`` key pairs.+ */+ T5Encoder_SDNQ_Config: {+ /**+ * Key+ * @description A unique key for this model.+ */+ key: string;+ /**+ * Hash+ * @description The hash of the model file(s).+ */+ hash: string;+ /**+ * Path+ * @description Path to the model on the filesystem. Relative paths are relative to the Invoke root directory.+ */+ path: string;+ /**+ * File Size+ * @description The size of the model in bytes.+ */+ file_size: number;+ /**+ * Name+ * @description Name of the model.+ */+ name: string;+ /**+ * Description+ * @description Model description+ */+ description: string | null;+ /**+ * Source+ * @description The original source of the model (path, URL or repo_id).+ */+ source: string;+ /** @description The type of source */+ source_type: components["schemas"]["ModelSourceType"];+ /**+ * Source Api Response+ * @description The original API response from the source, as stringified JSON.+ */+ source_api_response: string | null;+ /**+ * Source Url+ * @description Optional URL for the model (e.g. download page or model page).+ */+ source_url: string | null;+ /**+ * Cover Image+ * @description Url for image to preview model+ */+ cover_image: string | null;+ /**+ * Base+ * @default any+ * @constant+ */+ base: "any";+ /**+ * Type+ * @default t5_encoder+ * @constant+ */+ type: "t5_encoder";+ /**+ * Format+ * @default sdnq_quantized+ * @constant+ */+ format: "sdnq_quantized";+ /**+ * Cpu Only+ * @description Whether this model should run on CPU only+ */+ cpu_only: boolean | null;+ };/*** T5Encoder_T5Encoder_Config* @description Configuration for T5 Encoder models in a bespoke, diffusers-like format. The model weights are expected to be in@@ -41163,8 +41622,8 @@ export type components = {*/qwen3_encoder_model?: components["schemas"]["ModelIdentifierField"] | null;/**- * Qwen3 Source (Diffusers)- * @description Diffusers Z-Image model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.+ * Qwen3 Source+ * @description Z-Image pipeline model to extract VAE and/or Qwen3 encoder from. Use this if you don't have separate VAE/Qwen3 models. Ignored if both VAE and Qwen3 Encoder are provided separately.* @default null*/qwen3_source_model?: components["schemas"]["ModelIdentifierField"] | null;@@ -41943,7 +42402,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Validation Error */@@ -41975,7 +42434,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Validation Error */@@ -42027,7 +42486,7 @@ export interface operations {* "upcast_attention": false* }*/- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Bad request */@@ -42134,7 +42593,7 @@ export interface operations {* "upcast_attention": false* }*/- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Bad request */@@ -42207,7 +42666,7 @@ export interface operations {* "upcast_attention": false* }*/- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Bad request */@@ -42942,7 +43401,7 @@ export interface operations {* "upcast_attention": false* }*/- "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];+ "application/json": components["schemas"]["Main_Diffusers_SD1_Config"] | components["schemas"]["Main_Diffusers_SD2_Config"] | components["schemas"]["Main_Diffusers_SDXL_Config"] | components["schemas"]["Main_Diffusers_SDXLRefiner_Config"] | components["schemas"]["Main_Diffusers_SD3_Config"] | components["schemas"]["Main_Diffusers_FLUX_Config"] | components["schemas"]["Main_Diffusers_Flux2_Config"] | components["schemas"]["Main_Diffusers_CogView4_Config"] | components["schemas"]["Main_Diffusers_QwenImage_Config"] | components["schemas"]["Main_Diffusers_Wan_Config"] | components["schemas"]["Main_Diffusers_ZImage_Config"] | components["schemas"]["Main_Diffusers_ErnieImage_Config"] | components["schemas"]["Main_Diffusers_Ideogram4_Config"] | components["schemas"]["Main_Diffusers_Krea2_Config"] | components["schemas"]["Main_Checkpoint_SD1_Config"] | components["schemas"]["Main_Checkpoint_SD2_Config"] | components["schemas"]["Main_Checkpoint_SDXL_Config"] | components["schemas"]["Main_Checkpoint_SDXLRefiner_Config"] | components["schemas"]["Main_Checkpoint_Flux2_Config"] | components["schemas"]["Main_Checkpoint_FLUX_Config"] | components["schemas"]["Main_Checkpoint_QwenImage_Config"] | components["schemas"]["Main_Checkpoint_ZImage_Config"] | components["schemas"]["Main_Checkpoint_Krea2_Config"] | components["schemas"]["Main_Checkpoint_Anima_Config"] | components["schemas"]["Main_BnBNF4_FLUX_Config"] | components["schemas"]["Main_GGUF_Flux2_Config"] | components["schemas"]["Main_GGUF_FLUX_Config"] | components["schemas"]["Main_GGUF_QwenImage_Config"] | components["schemas"]["Main_GGUF_Wan_Config"] | components["schemas"]["Main_GGUF_ZImage_Config"] | components["schemas"]["Main_GGUF_Krea2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_Flux2_Config"] | components["schemas"]["Main_SDNQ_Diffusers_FLUX_Config"] | components["schemas"]["Main_SDNQ_Diffusers_ZImage_Config"] | components["schemas"]["VAE_Checkpoint_SD1_Config"] | components["schemas"]["VAE_Checkpoint_SD2_Config"] | components["schemas"]["VAE_Checkpoint_SDXL_Config"] | components["schemas"]["VAE_Checkpoint_FLUX_Config"] | components["schemas"]["VAE_Checkpoint_Flux2_Config"] | components["schemas"]["VAE_Checkpoint_Wan_Config"] | components["schemas"]["VAE_Checkpoint_QwenImage_Config"] | components["schemas"]["VAE_Checkpoint_Anima_Config"] | components["schemas"]["VAE_Diffusers_SD1_Config"] | components["schemas"]["VAE_Diffusers_SDXL_Config"] | components["schemas"]["VAE_Diffusers_Flux2_Config"] | components["schemas"]["VAE_Diffusers_Wan_Config"] | components["schemas"]["PiDDecoder_Checkpoint_FLUX_Config"] | components["schemas"]["PiDDecoder_Checkpoint_Flux2_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SD3_Config"] | components["schemas"]["PiDDecoder_Checkpoint_SDXL_Config"] | components["schemas"]["PiDDecoder_Checkpoint_QwenImage_Config"] | components["schemas"]["ControlNet_Checkpoint_SD1_Config"] | components["schemas"]["ControlNet_Checkpoint_SD2_Config"] | components["schemas"]["ControlNet_Checkpoint_SDXL_Config"] | components["schemas"]["ControlNet_Checkpoint_FLUX_Config"] | components["schemas"]["ControlNet_Checkpoint_ZImage_Config"] | components["schemas"]["ControlNet_Checkpoint_Anima_Config"] | components["schemas"]["ControlNet_Diffusers_SD1_Config"] | components["schemas"]["ControlNet_Diffusers_SD2_Config"] | components["schemas"]["ControlNet_Diffusers_SDXL_Config"] | components["schemas"]["ControlNet_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_SD1_Config"] | components["schemas"]["LoRA_LyCORIS_SD2_Config"] | components["schemas"]["LoRA_LyCORIS_SDXL_Config"] | components["schemas"]["LoRA_LyCORIS_Flux2_Config"] | components["schemas"]["LoRA_LyCORIS_FLUX_Config"] | components["schemas"]["LoRA_LyCORIS_ZImage_Config"] | components["schemas"]["LoRA_LyCORIS_Krea2_Config"] | components["schemas"]["LoRA_LyCORIS_QwenImage_Config"] | components["schemas"]["LoRA_LyCORIS_Wan_Config"] | components["schemas"]["LoRA_LyCORIS_Anima_Config"] | components["schemas"]["LoRA_OMI_SDXL_Config"] | components["schemas"]["LoRA_OMI_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_SD1_Config"] | components["schemas"]["LoRA_Diffusers_SD2_Config"] | components["schemas"]["LoRA_Diffusers_SDXL_Config"] | components["schemas"]["LoRA_Diffusers_Flux2_Config"] | components["schemas"]["LoRA_Diffusers_FLUX_Config"] | components["schemas"]["LoRA_Diffusers_ZImage_Config"] | components["schemas"]["ControlLoRA_LyCORIS_FLUX_Config"] | components["schemas"]["T5Encoder_T5Encoder_Config"] | components["schemas"]["T5Encoder_BnBLLMint8_Config"] | components["schemas"]["T5Encoder_SDNQ_Config"] | components["schemas"]["T5Encoder_GGUF_Config"] | components["schemas"]["Qwen3VLEncoder_Checkpoint_Config"] | components["schemas"]["Qwen3VLEncoder_Qwen3VLEncoder_Config"] | components["schemas"]["Qwen3Encoder_Qwen3Encoder_Config"] | components["schemas"]["Qwen3Encoder_Checkpoint_Config"] | components["schemas"]["Qwen3Encoder_GGUF_Config"] | components["schemas"]["Qwen3Encoder_SDNQ_Folder_Config"] | components["schemas"]["MistralEncoder_Diffusers_Config"] | components["schemas"]["MistralEncoder_Checkpoint_Config"] | components["schemas"]["MistralEncoder_GGUF_Config"] | components["schemas"]["Gemma2Encoder_Gemma2Encoder_Config"] | components["schemas"]["Gemma2Encoder_GGUF_Config"] | components["schemas"]["QwenVLEncoder_Diffusers_Config"] | components["schemas"]["QwenVLEncoder_Checkpoint_Config"] | components["schemas"]["WanT5Encoder_WanT5Encoder_Config"] | components["schemas"]["TI_File_SD1_Config"] | components["schemas"]["TI_File_SD2_Config"] | components["schemas"]["TI_File_SDXL_Config"] | components["schemas"]["TI_Folder_SD1_Config"] | components["schemas"]["TI_Folder_SD2_Config"] | components["schemas"]["TI_Folder_SDXL_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD1_Config"] | components["schemas"]["IPAdapter_InvokeAI_SD2_Config"] | components["schemas"]["IPAdapter_InvokeAI_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD1_Config"] | components["schemas"]["IPAdapter_Checkpoint_SD2_Config"] | components["schemas"]["IPAdapter_Checkpoint_SDXL_Config"] | components["schemas"]["IPAdapter_Checkpoint_FLUX_Config"] | components["schemas"]["T2IAdapter_Diffusers_SD1_Config"] | components["schemas"]["T2IAdapter_Diffusers_SDXL_Config"] | components["schemas"]["Spandrel_Checkpoint_Config"] | components["schemas"]["CLIPEmbed_Diffusers_G_Config"] | components["schemas"]["CLIPEmbed_Diffusers_L_Config"] | components["schemas"]["CLIPVision_Diffusers_Config"] | components["schemas"]["SigLIP_Diffusers_Config"] | components["schemas"]["FLUXRedux_Checkpoint_Config"] | components["schemas"]["LlavaOnevision_Diffusers_Config"] | components["schemas"]["TextLLM_Diffusers_Config"] | components["schemas"]["ExternalApiModelConfig"] | components["schemas"]["Unknown_Config"];};};/** @description Bad request */diff --git a/invokeai/frontend/web/src/services/api/types.test.ts b/invokeai/frontend/web/src/services/api/types.test.tsnew file mode 100644index 0000000000..0c63dd5d25--- /dev/null+++ b/invokeai/frontend/web/src/services/api/types.test.ts@@ -0,0 +1,28 @@+import { describe, expect, it } from 'vitest';++import { isFlux2DiffusersMainModelConfig, isZImageDiffusersMainModelConfig } from './types';++const partialConfig = (base: 'flux2' | 'z-image', submodels: Record<string, unknown>) => ({+ type: 'main',+ base,+ format: 'sdnq_quantized',+ variant: 'klein_4b',+ name: 'partial-sdnq-pipeline',+ submodels,+});++describe('SDNQ pipeline model predicates', () => {+ it.each([+ ['flux2', isFlux2DiffusersMainModelConfig],+ ['z-image', isZImageDiffusersMainModelConfig],+ ] as const)('rejects a pipeline with only a transformer submodel', (base, predicate) => {+ expect(predicate(partialConfig(base, { transformer: {} }) as never)).toBe(false);+ });++ it.each([+ ['flux2', isFlux2DiffusersMainModelConfig],+ ['z-image', isZImageDiffusersMainModelConfig],+ ] as const)('rejects a pipeline with no transformer submodel', (base, predicate) => {+ expect(predicate(partialConfig(base, { vae: {}, text_encoder: {}, tokenizer: {} }) as never)).toBe(false);+ });+});diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.tsindex 344633fe03..37e4ee2149 100644--- a/invokeai/frontend/web/src/services/api/types.ts+++ b/invokeai/frontend/web/src/services/api/types.ts@@ -542,12 +542,92 @@ export const isFluxFillMainModelModelConfig = (config: AnyModelConfig): config ireturn config.type === 'main' && config.base === 'flux' && config.variant === 'dev_fill';};+/**+ * The submodels an SDNQ pipeline install must expose before it can act as a component source.+ * Mirrors `_REQUIRED_PIPELINE_SUBMODELS` / `is_self_contained_sdnq_pipeline()` in+ * `invokeai/app/invocations/model.py` — the frontend and the backend must agree on what "complete"+ * means, or the graph builders offer a source the invocation validation then rejects.+ */+const SDNQ_PIPELINE_REQUIRED_SUBMODELS = ['transformer', 'vae', 'text_encoder', 'tokenizer'] as const;++/**+ * True if an SDNQ pipeline config ships every component its loaders read from a fixed subfolder.+ *+ * A truthy `submodels` map is not enough: a partial pipeline can expose only the transformer, and a+ * malformed model_index.json can expose the components while omitting the transformer. Either would+ * otherwise be offered in the source pickers, auto-selected by the graph builders, and only rejected+ * by the backend after graph construction.+ */+export const isSelfContainedSDNQPipeline = (config: AnyModelConfig): boolean => {+ return hasSubmodels(config, SDNQ_PIPELINE_REQUIRED_SUBMODELS);+};++/**+ * FLUX.1 drives two text encoders, so a pipeline install can only replace the standalone components+ * if it also ships the T5 pair on top of the CLIP one. Mirrors+ * `_REQUIRED_FLUX1_PIPELINE_SUBMODELS` / `is_self_contained_sdnq_flux1_pipeline()` in+ * `invokeai/app/invocations/model.py`; if the two disagree, the UI either blocks a model the node+ * would have accepted or builds a graph the node then rejects.+ */+const SDNQ_FLUX1_PIPELINE_REQUIRED_SUBMODELS = [+ ...SDNQ_PIPELINE_REQUIRED_SUBMODELS,+ 'text_encoder_2',+ 'tokenizer_2',+] as const;++const hasSubmodels = (config: AnyModelConfig, required: readonly string[]): boolean => {+ const submodels = (config as { submodels?: unknown }).submodels;+ if (typeof submodels !== 'object' || submodels === null) {+ return false;+ }+ return required.every((submodel) => Boolean((submodels as Record<string, unknown>)[submodel]));+};++/**+ * True for a FLUX.1 SDNQ pipeline that ships every component the FLUX graph needs, so the+ * standalone T5 / CLIP / VAE selections are not required.+ */+export const isSelfContainedSDNQFlux1Pipeline = (config: AnyModelConfig): boolean => {+ if ((config as { format?: unknown }).format !== 'sdnq_quantized') {+ return false;+ }+ return hasSubmodels(config, SDNQ_FLUX1_PIPELINE_REQUIRED_SUBMODELS);+};+export const isZImageDiffusersMainModelConfig = (config: AnyModelConfig): config is MainModelConfig => {- return config.type === 'main' && config.base === 'z-image' && config.format === 'diffusers';+ if (config.type !== 'main' || config.base !== 'z-image') {+ return false;+ }+ // Read `format` and `submodels` as plain strings/unknown so TS doesn't narrow away the+ // `sdnq_quantized` branch. The OpenAPI schema is regenerated separately and currently+ // doesn't list the `sdnq_quantized` Z-Image format variant.+ const format = (config as { format?: unknown }).format as string | undefined;+ if (format === 'diffusers') {+ return true;+ }+ // SDNQ-quantized ZImagePipeline folders carry the same submodels layout (transformer, vae,+ // text_encoder, ...) as a plain diffusers ZImagePipeline. Single-file SDNQ Z-Image+ // checkpoints have no submodels and must not match here, and neither may a partial pipeline.+ if (format !== 'sdnq_quantized') {+ return false;+ }+ return isSelfContainedSDNQPipeline(config);};export const isFlux2DiffusersMainModelConfig = (config: AnyModelConfig): config is MainModelConfig => {- return config.type === 'main' && config.base === 'flux2' && config.format === 'diffusers';+ if (config.type !== 'main' || config.base !== 'flux2') {+ return false;+ }+ // Same reasoning as isZImageDiffusersMainModelConfig: an SDNQ FLUX.2 pipeline folder ships+ // the same submodels (transformer/text_encoder/tokenizer/vae) and qualifies as a source model.+ const format = (config as { format?: unknown }).format as string | undefined;+ if (format === 'diffusers') {+ return true;+ }+ if (format !== 'sdnq_quantized') {+ return false;+ }+ return isSelfContainedSDNQPipeline(config);};export const isQwenImageDiffusersMainModelConfig = (config: AnyModelConfig): config is MainModelConfig => {diff --git a/tests/app/invocations/test_flux2_klein_model_loader.py b/tests/app/invocations/test_flux2_klein_model_loader.pynew file mode 100644index 0000000000..8366bccf18--- /dev/null+++ b/tests/app/invocations/test_flux2_klein_model_loader.py@@ -0,0 +1,68 @@+"""Tests for Flux2KleinModelLoaderInvocation submodel-source resolution.++Focus: a partial SDNQ FLUX.2 pipeline (format=sdnq_quantized whose submodels contains only the+transformer) must NOT be treated as a self-contained source. Otherwise the invocation sets+main_is_diffusers=True, skips the standalone VAE/Qwen3 requirement, and emits VAE/Tokenizer/+TextEncoder requests against the main model, moving the failure to runtime submodel loading.+"""++from types import SimpleNamespace+from unittest.mock import MagicMock++import pytest++from invokeai.app.invocations.flux2_klein_model_loader import Flux2KleinModelLoaderInvocation+from invokeai.app.invocations.model import ModelIdentifierField+from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, SubModelType+++def _make_main_model() -> ModelIdentifierField:+ return ModelIdentifierField(+ key="flux2-sdnq-key",+ hash="blake3:fakehash",+ name="FLUX.2 Klein SDNQ",+ base=BaseModelType.Flux2,+ type=ModelType.Main,+ )+++def _make_context(config) -> MagicMock:+ context = MagicMock()+ context.models.get_config.return_value = config+ return context+++class TestFlux2KleinSelfContainedSDNQ:+ def test_full_sdnq_pipeline_falls_back_to_main_model(self):+ invocation = Flux2KleinModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(+ format=ModelFormat.SDNQQuantized,+ submodels={+ SubModelType.Transformer: object(),+ SubModelType.VAE: object(),+ SubModelType.TextEncoder: object(),+ SubModelType.Tokenizer: object(),+ },+ name="FLUX.2 Klein SDNQ",+ )+ output = invocation.invoke(_make_context(config))+ assert output.vae.vae.submodel_type is SubModelType.VAE+ assert output.qwen3_encoder.text_encoder.submodel_type is SubModelType.TextEncoder+ assert output.qwen3_encoder.tokenizer.submodel_type is SubModelType.Tokenizer++ def test_partial_sdnq_pipeline_requires_explicit_source(self):+ """Only the transformer is recognized — not self-contained, so a VAE source is required."""+ invocation = Flux2KleinModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(+ format=ModelFormat.SDNQQuantized,+ submodels={SubModelType.Transformer: object()}, # missing VAE / TextEncoder / Tokenizer+ name="FLUX.2 Klein partial pipeline",+ )+ with pytest.raises(ValueError, match="No VAE source"):+ invocation.invoke(_make_context(config))++ def test_single_file_sdnq_requires_explicit_source(self):+ invocation = Flux2KleinModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(format=ModelFormat.SDNQQuantized, submodels=None, name="FLUX.2 single file")+ with pytest.raises(ValueError, match="No VAE source"):+ invocation.invoke(_make_context(config))diff --git a/tests/app/invocations/test_flux2_model_loader_source_guards.py b/tests/app/invocations/test_flux2_model_loader_source_guards.pyindex 1021fd0dcd..7e312076ef 100644--- a/tests/app/invocations/test_flux2_model_loader_source_guards.py+++ b/tests/app/invocations/test_flux2_model_loader_source_guards.py@@ -298,5 +298,8 @@ def test_vae_source_must_still_be_diffusers(source_format: ModelFormat) -> None:})- with pytest.raises(ValueError, match="must be a Diffusers format model"):+ # The Klein loader also accepts a self-contained SDNQ pipeline as a source, so its message names+ # the accepted shape ("Diffusers-style FLUX.2 pipeline") rather than the diffusers format alone.+ # Single-file / GGUF sources are still rejected, which is what this test is about.+ with pytest.raises(ValueError, match="must be a Diffusers-style FLUX.2 pipeline"):invocation.invoke(context)diff --git a/tests/app/invocations/test_flux_model_loader_self_contained.py b/tests/app/invocations/test_flux_model_loader_self_contained.pynew file mode 100644index 0000000000..b3d423c70a--- /dev/null+++ b/tests/app/invocations/test_flux_model_loader_self_contained.py@@ -0,0 +1,119 @@+"""The FLUX.1 model loader must accept a complete SDNQ pipeline on its own.++`docs/.../sdnq-quantization.mdx` promises "one install pulls everything you need (transformer ++encoders + VAE)", but the node required separate T5, CLIP and VAE identifiers regardless, forcing+users to install duplicates of components the pipeline already shipped. Models that genuinely cannot+supply the parts (single-file / GGUF / BnB) must still say so, and say which parts are missing.+"""++from types import SimpleNamespace+from unittest.mock import MagicMock++import pytest++from invokeai.app.invocations.flux_model_loader import FluxModelLoaderInvocation+from invokeai.app.invocations.model import ModelIdentifierField+from invokeai.backend.model_manager.configs.main import Main_SDNQ_Diffusers_FLUX_Config+from invokeai.backend.model_manager.taxonomy import (+ BaseModelType,+ FluxVariantType,+ ModelFormat,+ ModelType,+ SubModelType,+)++_FLUX1_PIPELINE_SUBMODELS = {+ SubModelType.Transformer: object(),+ SubModelType.VAE: object(),+ SubModelType.TextEncoder: object(),+ SubModelType.Tokenizer: object(),+ SubModelType.TextEncoder2: object(),+ SubModelType.Tokenizer2: object(),+}+++def _identifier(key: str, model_type: ModelType = ModelType.Main) -> ModelIdentifierField:+ return ModelIdentifierField(key=key, hash=f"hash:{key}", name=key, base=BaseModelType.Flux, type=model_type)+++def _context(config) -> MagicMock:+ context = MagicMock()+ context.models.exists.return_value = True+ context.models.get_config.return_value = config+ return context+++def _sdnq_pipeline(submodels: dict | None = None) -> Main_SDNQ_Diffusers_FLUX_Config:+ # A real config object, because the invocation asserts on its type before reading `variant`.+ return Main_SDNQ_Diffusers_FLUX_Config.model_construct(+ format=ModelFormat.SDNQQuantized,+ submodels=_FLUX1_PIPELINE_SUBMODELS if submodels is None else submodels,+ variant=FluxVariantType.Dev,+ )+++def _single_file() -> SimpleNamespace:+ return SimpleNamespace(format=ModelFormat.Checkpoint, submodels=None, variant="dev")+++def _invoke(main, **components):+ invocation = FluxModelLoaderInvocation.model_construct(+ model=main,+ t5_encoder_model=components.get("t5"),+ clip_embed_model=components.get("clip"),+ vae_model=components.get("vae"),+ )+ return invocation+++def test_a_complete_sdnq_pipeline_supplies_every_component_itself() -> None:+ main = _identifier("sdnq-pipeline")++ output = _invoke(main).invoke(_context(_sdnq_pipeline()))++ # Every part resolves back to the pipeline install, at the right submodel slot.+ assert output.vae.vae.key == "sdnq-pipeline"+ assert output.vae.vae.submodel_type is SubModelType.VAE+ assert output.clip.tokenizer.submodel_type is SubModelType.Tokenizer+ assert output.clip.text_encoder.submodel_type is SubModelType.TextEncoder+ assert output.t5_encoder.tokenizer.submodel_type is SubModelType.Tokenizer2+ assert output.t5_encoder.text_encoder.submodel_type is SubModelType.TextEncoder2+ assert output.transformer.transformer.submodel_type is SubModelType.Transformer+++def test_an_explicit_selection_still_wins_over_the_pipeline() -> None:+ """Supplying a component explicitly must keep overriding the bundled one."""+ main = _identifier("sdnq-pipeline")+ external_vae = _identifier("my-vae", ModelType.VAE)++ output = _invoke(main, vae=external_vae).invoke(_context(_sdnq_pipeline()))++ assert output.vae.vae.key == "my-vae"+ # ...while the parts left unset still come from the pipeline.+ assert output.clip.tokenizer.key == "sdnq-pipeline"+++def test_a_single_file_model_without_components_names_all_the_missing_parts() -> None:+ """Models that cannot supply the parts must still be rejected, and say what to select."""+ invocation = _invoke(_identifier("flux-gguf"))++ with pytest.raises(ValueError) as excinfo:+ invocation.invoke(_context(_single_file()))++ message = str(excinfo.value)+ assert "T5 Encoder" in message and "CLIP Embed" in message and "VAE" in message+++def test_an_incomplete_sdnq_pipeline_without_t5_still_requires_one() -> None:+ """A FLUX.1 pipeline needs two encoders; missing the T5 pair is not self-contained."""+ partial = {+ k: v+ for k, v in _FLUX1_PIPELINE_SUBMODELS.items()+ if k not in (SubModelType.TextEncoder2, SubModelType.Tokenizer2)+ }+ invocation = _invoke(_identifier("sdnq-no-t5"))++ with pytest.raises(ValueError) as excinfo:+ invocation.invoke(_context(_sdnq_pipeline(partial)))++ assert "T5 Encoder" in str(excinfo.value)diff --git a/tests/app/invocations/test_flux_vae_decode.py b/tests/app/invocations/test_flux_vae_decode.pynew file mode 100644index 0000000000..8f52ae794d--- /dev/null+++ b/tests/app/invocations/test_flux_vae_decode.py@@ -0,0 +1,68 @@+"""Tests for the FLUX VAE decode path's handling of the diffusers ``AutoencoderKL`` config.++``shift_factor`` is optional on ``AutoencoderKL``. The FLUX VAE sets one, but a plain SD-style+config leaves it ``None``, and the decode used to add it to the latents unconditionally.+"""++from contextlib import contextmanager+from types import SimpleNamespace+from unittest.mock import MagicMock++import pytest+import torch+from diffusers.models.autoencoders.autoencoder_kl import AutoencoderKL++from invokeai.app.invocations.flux_vae_decode import FluxVaeDecodeInvocation+++def _loaded_vae(shift_factor: float | None, scaling_factor: float = 0.3611) -> MagicMock:+ """A LoadedModel wrapping a diffusers AutoencoderKL whose config may lack a shift factor."""+ vae = MagicMock(spec=AutoencoderKL)+ param = torch.zeros(1, dtype=torch.float32)+ vae.parameters.side_effect = lambda: iter([param])+ config = SimpleNamespace(scaling_factor=scaling_factor)+ if shift_factor is not None:+ config.shift_factor = shift_factor+ vae.config = config+ # decode() returns a tuple when return_dict=False; one 3-channel image is enough.+ vae.decode.return_value = (torch.zeros(1, 3, 8, 8),)++ vae_info = MagicMock()+ vae_info.model = vae+ vae_info.compute_device = torch.device("cpu")++ @contextmanager+ def _on_device(working_mem_bytes=None):+ yield (None, vae)++ vae_info.model_on_device = _on_device+ return vae_info++[email protected]("shift_factor", [None, 0.1159])+def test_decode_handles_a_config_with_or_without_a_shift_factor(shift_factor: float | None) -> None:+ """A config lacking `shift_factor` used to raise `TypeError: unsupported operand ... NoneType`."""+ vae_info = _loaded_vae(shift_factor)+ latents = torch.ones(1, 16, 1, 1)++ image = FluxVaeDecodeInvocation._vae_decode(+ FluxVaeDecodeInvocation.model_construct(), vae_info=vae_info, latents=latents+ )++ assert image.size == (8, 8)+ # The shift is applied only when the config carries one; otherwise the latents are scale-only.+ passed = vae_info.model.decode.call_args.args[0]+ expected = latents / 0.3611 + (shift_factor or 0.0)+ assert torch.allclose(passed, expected)+++def test_decode_treats_an_explicit_none_shift_factor_as_no_shift() -> None:+ """diffusers sets the attribute to None rather than omitting it when it is not configured."""+ vae_info = _loaded_vae(None)+ vae_info.model.config.shift_factor = None+ latents = torch.ones(1, 16, 1, 1)++ FluxVaeDecodeInvocation._vae_decode(FluxVaeDecodeInvocation.model_construct(), vae_info=vae_info, latents=latents)++ passed = vae_info.model.decode.call_args.args[0]+ assert torch.allclose(passed, latents / 0.3611)diff --git a/tests/app/invocations/test_z_image_model_loader.py b/tests/app/invocations/test_z_image_model_loader.pynew file mode 100644index 0000000000..0840027271--- /dev/null+++ b/tests/app/invocations/test_z_image_model_loader.py@@ -0,0 +1,153 @@+"""Tests for ZImageModelLoaderInvocation submodel-source resolution.++Focus: a freshly installed SDNQ Z-Image pipeline (format=sdnq_quantized with submodels) is+self-contained and must generate without the user manually selecting a VAE / Qwen3 component+source. In that case the loader must fall back to the main model itself for the VAE and Qwen3+encoder/tokenizer submodels.+"""++from types import SimpleNamespace+from unittest.mock import MagicMock++import pytest++from invokeai.app.invocations.model import ModelIdentifierField+from invokeai.app.invocations.z_image_model_loader import ZImageModelLoaderInvocation+from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, SubModelType+++def _make_main_model() -> ModelIdentifierField:+ return ModelIdentifierField(+ key="z-image-sdnq-key",+ hash="blake3:fakehash",+ name="Z-Image Turbo SDNQ",+ base=BaseModelType.ZImage,+ type=ModelType.Main,+ )+++def _make_context(config) -> MagicMock:+ context = MagicMock()+ context.models.get_config.return_value = config+ return context+++class TestZImageSelfContainedSDNQ:+ def test_sdnq_pipeline_with_submodels_falls_back_to_main_model(self):+ main_model = _make_main_model()+ invocation = ZImageModelLoaderInvocation(model=main_model)+ # SDNQ pipeline config exposing all required submodels — self-contained.+ config = SimpleNamespace(+ format=ModelFormat.SDNQQuantized,+ submodels={+ SubModelType.Transformer: object(),+ SubModelType.VAE: object(),+ SubModelType.TextEncoder: object(),+ SubModelType.Tokenizer: object(),+ },+ name="Z-Image Turbo SDNQ",+ )+ context = _make_context(config)++ output = invocation.invoke(context)++ # Transformer, VAE and Qwen3 encoder/tokenizer all resolve to the main model's key.+ assert output.transformer.transformer.key == main_model.key+ assert output.transformer.transformer.submodel_type is SubModelType.Transformer+ assert output.vae.vae.key == main_model.key+ assert output.vae.vae.submodel_type is SubModelType.VAE+ assert output.qwen3_encoder.text_encoder.key == main_model.key+ assert output.qwen3_encoder.text_encoder.submodel_type is SubModelType.TextEncoder+ assert output.qwen3_encoder.tokenizer.key == main_model.key+ assert output.qwen3_encoder.tokenizer.submodel_type is SubModelType.Tokenizer++ def test_sdnq_without_submodels_still_requires_source(self):+ """A single-file SDNQ Z-Image model (no submodels) is not self-contained."""+ invocation = ZImageModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(format=ModelFormat.SDNQQuantized, submodels=None, name="Z-Image single file")+ context = _make_context(config)++ with pytest.raises(ValueError, match="No VAE source"):+ invocation.invoke(context)++ def test_partial_sdnq_pipeline_is_not_self_contained(self):+ """A pipeline that only exposes some submodels (e.g. just the transformer) must not be+ treated as self-contained — the loader would fail on the missing vae / text_encoder folders."""+ invocation = ZImageModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(+ format=ModelFormat.SDNQQuantized,+ submodels={SubModelType.Transformer: object()}, # missing VAE / TextEncoder / Tokenizer+ name="Z-Image partial pipeline",+ )+ context = _make_context(config)++ with pytest.raises(ValueError, match="No VAE source"):+ invocation.invoke(context)++ def test_validate_diffusers_format_rejects_partial_sdnq_source(self):+ """A partial SDNQ pipeline selected as the explicit Qwen3 Source must be rejected — otherwise+ the invocation would emit VAE/text_encoder/tokenizer requests against missing subfolders."""+ invocation = ZImageModelLoaderInvocation(model=_make_main_model())+ source = ModelIdentifierField(+ key="src", hash="h", name="partial", base=BaseModelType.ZImage, type=ModelType.Main+ )+ partial = SimpleNamespace(+ format=ModelFormat.SDNQQuantized,+ submodels={SubModelType.Transformer: object()},+ name="Z-Image partial pipeline",+ )+ context = _make_context(partial)++ with pytest.raises(ValueError, match="must be a Diffusers-style Z-Image pipeline"):+ invocation._validate_diffusers_format(context, source, "Qwen3 Source")++ def test_non_sdnq_model_still_requires_source(self):+ """A GGUF Z-Image model must still require an explicit VAE / Qwen3 source."""+ invocation = ZImageModelLoaderInvocation(model=_make_main_model())+ config = SimpleNamespace(format=ModelFormat.GGUFQuantized, submodels=None, name="Z-Image GGUF")+ context = _make_context(config)++ with pytest.raises(ValueError, match="No VAE source"):+ invocation.invoke(context)+++class TestQwen3SourceFieldTemplate:+ """The generic node/workflow model pickers filter candidates by the field template's+ ui_model_base / ui_model_type / ui_model_format hints. Since _validate_diffusers_format now+ accepts SDNQ pipeline configs (with submodels) as a Qwen3 source, the qwen3_source_model field+ must NOT pin ui_model_format=diffusers — otherwise SDNQ Z-Image pipelines are filtered out of+ the picker even though the backend supports them.+ """++ def test_qwen3_source_field_has_no_format_filter(self):+ schema = ZImageModelLoaderInvocation.model_json_schema()+ field = schema["properties"]["qwen3_source_model"]++ # No format constraint: an SDNQ z-image main model (format=sdnq_quantized) is not filtered.+ assert "ui_model_format" not in field+ # Still scoped to Z-Image main models so unrelated models don't show up.+ assert field["ui_model_base"] == [BaseModelType.ZImage.value]+ assert field["ui_model_type"] == [ModelType.Main.value]++ def test_sdnq_pipeline_passes_field_template_filter(self):+ """Reproduce the picker's filter predicate and confirm an SDNQ pipeline is kept."""+ schema = ZImageModelLoaderInvocation.model_json_schema()+ field = schema["properties"]["qwen3_source_model"]++ sdnq_pipeline_config = {+ "base": BaseModelType.ZImage.value,+ "type": ModelType.Main.value,+ "format": ModelFormat.SDNQQuantized.value,+ }++ # Mirror the filter in ModelIdentifierFieldInputComponent / WorkflowFieldRenderer.+ def is_filtered_out(config: dict) -> bool:+ if "ui_model_base" in field and config["base"] not in field["ui_model_base"]:+ return True+ if "ui_model_type" in field and config["type"] not in field["ui_model_type"]:+ return True+ if "ui_model_format" in field and config["format"] not in field["ui_model_format"]:+ return True+ return False++ assert not is_filtered_out(sdnq_pipeline_config)diff --git a/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_folder_identification.py b/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_folder_identification.pynew file mode 100644index 0000000000..5388dcb357--- /dev/null+++ b/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_folder_identification.py@@ -0,0 +1,248 @@+"""Tests that Qwen3Encoder_SDNQ_Folder_Config only accepts real Qwen3 encoder folders.++An SDNQ transformer / VAE / other component folder also has a quantization_config.json with+quant_method="sdnq". Without verifying the folder is actually a Qwen3 encoder, such a folder would+be classified as type=qwen3_encoder and only fail later in the loader when Qwen-specific weights+are missing. These tests point the factory at non-Qwen3 SDNQ folders and assert they do NOT resolve+to Qwen3Encoder_SDNQ_Folder_Config, while a real SDNQ Qwen3 encoder folder still does.+"""++import json+from pathlib import Path++import pytest+import torch+from safetensors.torch import load_file, save_file++from invokeai.backend.model_manager.configs.factory import ModelConfigFactory+from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.configs.qwen3_encoder import (+ Qwen3Encoder_Qwen3Encoder_Config,+ Qwen3Encoder_SDNQ_Folder_Config,+)+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk+from invokeai.backend.model_manager.taxonomy import ModelType++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "file_size": 1000,+ "name": "sdnq-qwen3",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}+++def _write_sdnq_marker(folder: Path) -> None:+ (folder / "quantization_config.json").write_text(+ json.dumps({"quant_method": "sdnq", "weights_dtype": "uint4", "group_size": 128}), encoding="utf-8"+ )+++def _make_sdnq_transformer_folder(root: Path) -> Path:+ """A standalone SDNQ transformer folder (e.g. a Z-Image / FLUX.2 transformer)."""+ root.mkdir(parents=True, exist_ok=True)+ (root / "config.json").write_text(json.dumps({"_class_name": "ZImageTransformer2DModel"}), encoding="utf-8")+ _write_sdnq_marker(root)+ save_file(+ {+ "transformer_blocks.0.attn.to_q.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "transformer_blocks.0.attn.to_q.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(root / "diffusion_pytorch_model.safetensors"),+ )+ return root+++def _make_sdnq_vae_folder(root: Path) -> Path:+ """A standalone SDNQ VAE folder."""+ root.mkdir(parents=True, exist_ok=True)+ (root / "config.json").write_text(json.dumps({"_class_name": "AutoencoderKL"}), encoding="utf-8")+ _write_sdnq_marker(root)+ save_file(+ {+ "decoder.conv_in.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "decoder.conv_in.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(root / "diffusion_pytorch_model.safetensors"),+ )+ return root+++def _make_sdnq_qwen3_encoder_folder(root: Path) -> Path:+ """A real SDNQ Qwen3 encoder folder."""+ root.mkdir(parents=True, exist_ok=True)+ (root / "config.json").write_text(+ json.dumps({"architectures": ["Qwen3ForCausalLM"], "hidden_size": 2560}), encoding="utf-8"+ )+ _write_sdnq_marker(root)+ save_file(+ {+ "model.embed_tokens.weight": torch.zeros(1000, 2560, dtype=torch.uint8),+ "model.embed_tokens.scale": torch.zeros(1000, 1, dtype=torch.float32),+ "model.layers.0.self_attn.q_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.self_attn.q_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(root / "model.safetensors"),+ )+ return root+++def _make_sdnq_sharded_qwen2_encoder_folder(root: Path) -> Path:+ """A sharded SDNQ Qwen encoder folder declaring the compatible Qwen2ForCausalLM architecture.++ The unquantized config accepts Qwen2ForCausalLM, so the SDNQ folder config must too. It must not+ be rejected by trying to load a sharded state dict (multiple weight files) — the config-class+ name is the authoritative signal here.+ """+ root.mkdir(parents=True, exist_ok=True)+ (root / "config.json").write_text(+ json.dumps({"architectures": ["Qwen2ForCausalLM"], "hidden_size": 2560}), encoding="utf-8"+ )+ _write_sdnq_marker(root)+ save_file(+ {+ "model.embed_tokens.weight": torch.zeros(1000, 2560, dtype=torch.uint8),+ "model.embed_tokens.scale": torch.zeros(1000, 1, dtype=torch.float32),+ },+ str(root / "model-00001-of-00002.safetensors"),+ )+ save_file(+ {+ "model.layers.0.self_attn.q_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.self_attn.q_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(root / "model-00002-of-00002.safetensors"),+ )+ return root+++def _make_configless_sdnq_qwen2_encoder_folder(root: Path, include_visual: bool = False) -> Path:+ """A configless Qwen2 or Qwen2-VL folder that shares generic Qwen state-dict keys."""+ root.mkdir(parents=True, exist_ok=True)+ _write_sdnq_marker(root)+ weights = {+ "model.embed_tokens.weight": torch.zeros(1000, 2560, dtype=torch.uint8),+ "model.embed_tokens.scale": torch.zeros(1000, 1, dtype=torch.float32),+ "model.layers.0.self_attn.q_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.self_attn.q_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ "model.layers.0.self_attn.k_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.self_attn.k_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ "model.layers.0.mlp.gate_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.mlp.gate_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ }+ if include_visual:+ weights["visual.patch_embed.proj.weight"] = torch.zeros(64, 32, dtype=torch.uint8)+ weights["visual.patch_embed.proj.scale"] = torch.zeros(64, 1, dtype=torch.float32)+ save_file(weights, str(root / "model.safetensors"))+ return root+++def _make_configless_sdnq_qwen3_encoder_folder(root: Path) -> Path:+ """A configless Qwen3 folder: same generic Qwen keys as the Qwen2 folder above, plus the+ Qwen3-only q/k-norm weights that tell the two apart."""+ root = _make_configless_sdnq_qwen2_encoder_folder(root)+ weights = load_file(str(root / "model.safetensors"))+ weights["model.layers.0.self_attn.q_norm.weight"] = torch.zeros(128, dtype=torch.float32)+ weights["model.layers.0.self_attn.k_norm.weight"] = torch.zeros(128, dtype=torch.float32)+ save_file(weights, str(root / "model.safetensors"))+ return root+++def _make_sdnq_causal_lm_folder(root: Path) -> Path:+ """An SDNQ complete causal LM (config.json + tokenizer files at root) — a TextLLM, not an+ encoder subfolder."""+ root = _make_sdnq_qwen3_encoder_folder(root)+ (root / "tokenizer.json").write_text("{}", encoding="utf-8")+ (root / "tokenizer_config.json").write_text("{}", encoding="utf-8")+ return root+++class TestQwen3EncoderSDNQFolderIdentification:+ def test_sdnq_transformer_folder_not_classified_as_qwen3(self, tmp_path: Path):+ root = _make_sdnq_transformer_folder(tmp_path / "sdnq-transformer")+ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)+ assert not any(isinstance(m, Qwen3Encoder_SDNQ_Folder_Config) for m in result.all_matches)+ assert result.config is None or result.config.type is not ModelType.Qwen3Encoder++ def test_sdnq_vae_folder_not_classified_as_qwen3(self, tmp_path: Path):+ root = _make_sdnq_vae_folder(tmp_path / "sdnq-vae")+ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)+ assert not any(isinstance(m, Qwen3Encoder_SDNQ_Folder_Config) for m in result.all_matches)+ assert result.config is None or result.config.type is not ModelType.Qwen3Encoder++ def test_real_sdnq_qwen3_encoder_folder_still_accepted(self, tmp_path: Path):+ """The SDNQ folder config must still accept a genuine SDNQ Qwen3 encoder folder."""+ root = _make_sdnq_qwen3_encoder_folder(tmp_path / "sdnq-qwen3")+ mod = ModelOnDisk(root)++ config = Qwen3Encoder_SDNQ_Folder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})+ assert config.type is ModelType.Qwen3Encoder+ assert config.format.value == "sdnq_quantized"++ def test_plain_qwen3_config_rejects_sdnq_folder(self, tmp_path: Path):+ """The unquantized Qwen3 encoder config must reject an SDNQ Qwen3 folder (same Qwen3 class+ name), so it does not compete with Qwen3Encoder_SDNQ_Folder_Config."""+ root = _make_sdnq_qwen3_encoder_folder(tmp_path / "sdnq-qwen3")+ # Use a real ModelOnDisk so the guard's marker + state-dict fallback checks run for real.+ mod = ModelOnDisk(root)+ with pytest.raises(NotAMatchError):+ Qwen3Encoder_Qwen3Encoder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})++ def test_sdnq_complete_causal_lm_not_classified_as_qwen3_encoder(self, tmp_path: Path):+ """An SDNQ root folder with config.json + tokenizer files (a complete causal LM / TextLLM)+ must not be claimed as a Qwen3 *encoder* — mirrors the guard in the unquantized config."""+ root = _make_sdnq_causal_lm_folder(tmp_path / "sdnq-causal-lm")+ mod = ModelOnDisk(root)+ with pytest.raises(NotAMatchError):+ Qwen3Encoder_SDNQ_Folder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})++ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)++ def test_sdnq_qwen2_causal_lm_encoder_is_rejected(self, tmp_path: Path):+ """A folder declaring Qwen2ForCausalLM must NOT resolve to the SDNQ folder config: the SDNQ+ encoder loader only builds Qwen3ForCausalLM, so accepting Qwen2 would produce a folder the+ loader's strict incomplete-load guard rejects (missing Qwen3 q/k-norm params)."""+ root = _make_sdnq_sharded_qwen2_encoder_folder(tmp_path / "sdnq-qwen2-sharded")+ mod = ModelOnDisk(root)+ with pytest.raises(NotAMatchError):+ Qwen3Encoder_SDNQ_Folder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})++ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)++ @pytest.mark.parametrize("include_visual", [False, True], ids=["qwen2", "qwen2-vl"])+ def test_configless_qwen2_encoder_is_rejected(self, tmp_path: Path, include_visual: bool):+ """Without a config.json the generic Qwen keys (model.layers.* / model.embed_tokens.weight)+ are the only signal, and Qwen2 and Qwen2-VL folders carry exactly those. The loader builds a+ text-only Qwen3ForCausalLM, so both must be rejected at identification time."""+ root = _make_configless_sdnq_qwen2_encoder_folder(tmp_path / "sdnq-configless-qwen2", include_visual)+ mod = ModelOnDisk(root)++ with pytest.raises(NotAMatchError):+ Qwen3Encoder_SDNQ_Folder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})++ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)++ def test_configless_qwen3_encoder_is_still_accepted(self, tmp_path: Path):+ """The counterpart to the rejections above: a configless folder carrying the Qwen3-only+ q/k-norm weights is a genuine Qwen3 encoder and must still be accepted."""+ root = _make_configless_sdnq_qwen3_encoder_folder(tmp_path / "sdnq-configless-qwen3")+ mod = ModelOnDisk(root)++ config = Qwen3Encoder_SDNQ_Folder_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})+ assert config.type is ModelType.Qwen3Encoder+ assert config.format.value == "sdnq_quantized"++ def test_factory_resolves_sdnq_qwen3_folder_deterministically(self, tmp_path: Path):+ """With the plain config rejecting SDNQ, the factory resolves the folder unambiguously to+ the SDNQ config (previously a non-deterministic tie between the two Qwen3 configs)."""+ root = _make_sdnq_qwen3_encoder_folder(tmp_path / "sdnq-qwen3")+ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)+ assert isinstance(result.config, Qwen3Encoder_SDNQ_Folder_Config)+ assert not any(isinstance(m, Qwen3Encoder_Qwen3Encoder_Config) for m in result.all_matches)diff --git a/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_single_file_identification.py b/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_single_file_identification.pynew file mode 100644index 0000000000..3d5f443c3f--- /dev/null+++ b/tests/backend/model_manager/configs/test_qwen3_encoder_sdnq_single_file_identification.py@@ -0,0 +1,86 @@+"""Tests that Qwen3Encoder_SDNQ_Config (single-file) only accepts a real Qwen3 encoder.++A single-file SDNQ Qwen checkpoint has no config.json, so identification must key on the state dict.+`_has_qwen3_keys` alone is generic across Qwen2 / Qwen3 / Qwen-VL (same `model.layers.*` /+`model.embed_tokens.weight` layout). Because the SDNQ Qwen3 encoder loader always builds a text-only+`Qwen3ForCausalLM`, identification must reject anything it cannot load:++- a Qwen2 causal LM (no Qwen3 QK-norm params -> missing weights), and+- a Qwen-VL model (bundles a visual tower -> unexpected weights),++while still accepting a genuine Qwen3 checkpoint carrying its q_norm/k_norm parameters.+"""++from pathlib import Path++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.factory import ModelConfigFactory+from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.configs.qwen3_encoder import Qwen3Encoder_SDNQ_Config+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "file_size": 1000,+ "name": "sdnq-qwen3-single",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}+++def _write_sdnq_single_file(path: Path, *, qk_norm: bool, visual_tower: bool = False) -> Path:+ """Write a single-file SDNQ Qwen checkpoint (uint8 weight + fp32 scale pairs).++ qk_norm=True adds the Qwen3-only q_norm/k_norm weights; visual_tower=True adds Qwen-VL visual.*+ keys. Both switches let a single builder produce the Qwen3 / Qwen2 / Qwen-VL cases.+ """+ sd: dict[str, torch.Tensor] = {+ "model.embed_tokens.weight": torch.zeros(1000, 2560, dtype=torch.uint8),+ "model.embed_tokens.scale": torch.zeros(1000, 1, dtype=torch.float32),+ "model.layers.0.self_attn.q_proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "model.layers.0.self_attn.q_proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ }+ if qk_norm:+ # Qwen3 QK-normalization — the discriminator vs. Qwen2. Norms are not SDNQ-quantized.+ sd["model.layers.0.self_attn.q_norm.weight"] = torch.ones(128, dtype=torch.float32)+ sd["model.layers.0.self_attn.k_norm.weight"] = torch.ones(128, dtype=torch.float32)+ if visual_tower:+ sd["visual.blocks.0.attn.qkv.weight"] = torch.zeros(64, 32, dtype=torch.uint8)+ sd["visual.blocks.0.attn.qkv.scale"] = torch.zeros(64, 1, dtype=torch.float32)+ path.parent.mkdir(parents=True, exist_ok=True)+ save_file(sd, str(path))+ return path+++def test_real_qwen3_sdnq_single_file_accepted(tmp_path: Path):+ path = _write_sdnq_single_file(tmp_path / "qwen3.safetensors", qk_norm=True)+ mod = ModelOnDisk(path)+ config = Qwen3Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": path.as_posix()})+ assert config.format.value == "sdnq_quantized"+++def test_qwen2_sdnq_single_file_rejected(tmp_path: Path):+ """A Qwen2 checkpoint lacks q_norm/k_norm; the loader would fail on the missing Qwen3 params."""+ path = _write_sdnq_single_file(tmp_path / "qwen2.safetensors", qk_norm=False)+ mod = ModelOnDisk(path)+ with pytest.raises(NotAMatchError):+ Qwen3Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": path.as_posix()})++ result = ModelConfigFactory.from_model_on_disk(path, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Config)+++def test_qwen_vl_sdnq_single_file_rejected(tmp_path: Path):+ """A Qwen-VL checkpoint bundles a visual tower; the text-only loader cannot consume it."""+ path = _write_sdnq_single_file(tmp_path / "qwen_vl.safetensors", qk_norm=True, visual_tower=True)+ mod = ModelOnDisk(path)+ with pytest.raises(NotAMatchError):+ Qwen3Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": path.as_posix()})++ result = ModelConfigFactory.from_model_on_disk(path, allow_unknown=True)+ assert not isinstance(result.config, Qwen3Encoder_SDNQ_Config)diff --git a/tests/backend/model_manager/configs/test_sdnq_flux1_submodel_discovery.py b/tests/backend/model_manager/configs/test_sdnq_flux1_submodel_discovery.pynew file mode 100644index 0000000000..7a89942f57--- /dev/null+++ b/tests/backend/model_manager/configs/test_sdnq_flux1_submodel_discovery.py@@ -0,0 +1,215 @@+"""Tests for FLUX.1 SDNQ pipeline submodel discovery.++`model_index.json` advertises which components a pipeline *should* have and what class each one is.+Neither is a fact about the folder: a partial download keeps a complete index over missing or empty+component directories, and the advertised class is a claim the folder can contradict. Discovery must+key on what actually ships, and must record the path it really found — the index names components+with arbitrary keys, so a pipeline that calls its CLIP encoder something other than `text_encoder`+must still load from the folder that exists.+"""++import json+from pathlib import Path+from unittest.mock import MagicMock++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.main import Main_SDNQ_Diffusers_FLUX_Config+from invokeai.backend.model_manager.taxonomy import SubModelType++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "file_size": 1000,+ "name": "sdnq-flux1",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}++# index key -> (advertised class, the class the folder's own config declares)+_WEIGHT_BEARING = {+ "text_encoder": ("CLIPTextModel", {"architectures": ["CLIPTextModel"]}),+ "text_encoder_2": ("T5EncoderModel", {"architectures": ["T5EncoderModel"]}),+ "vae": ("AutoencoderKL", {"_class_name": "AutoencoderKL"}),+}+_TOKENIZERS = {+ "tokenizer": "CLIPTokenizer",+ "tokenizer_2": "T5TokenizerFast",+}+++def _write_component(root: Path, name: str, config: dict, *, weights: bool, populated: bool = True) -> None:+ component = root / name+ component.mkdir(parents=True, exist_ok=True)+ if not populated:+ return+ if weights:+ (component / "config.json").write_text(json.dumps(config), encoding="utf-8")+ save_file({"weight": torch.zeros(4, 4)}, str(component / "model.safetensors"))+ else:+ (component / "tokenizer_config.json").write_text(json.dumps(config), encoding="utf-8")+ (component / "tokenizer.json").write_text(json.dumps({}), encoding="utf-8")+++def _make_flux1_pipeline(+ root: Path,+ *,+ component_keys: dict[str, str] | None = None,+ omit: str | None = None,+ empty: str | None = None,+) -> Path:+ """A FLUX.1 SDNQ pipeline folder.++ `component_keys` renames index keys (index key -> folder name) to exercise a nonstandard layout.+ `omit` drops a component's folder entirely; `empty` creates it without files.+ """+ keys = component_keys or {}+ root.mkdir(parents=True, exist_ok=True)++ index: dict[str, object] = {"_class_name": "FluxPipeline", "transformer": ["diffusers", "FluxTransformer2DModel"]}+ for name, (advertised, _) in _WEIGHT_BEARING.items():+ index[keys.get(name, name)] = ["transformers", advertised]+ for name, advertised in _TOKENIZERS.items():+ index[keys.get(name, name)] = ["transformers", advertised]+ (root / "model_index.json").write_text(json.dumps(index), encoding="utf-8")++ transformer = root / "transformer"+ transformer.mkdir()+ (transformer / "config.json").write_text(+ json.dumps({"_class_name": "FluxTransformer2DModel", "guidance_embeds": True, "in_channels": 64}),+ encoding="utf-8",+ )+ (transformer / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ save_file({"w": torch.zeros(4, 4)}, str(transformer / "diffusion_pytorch_model.safetensors"))++ for name, (_, declared) in _WEIGHT_BEARING.items():+ folder = keys.get(name, name)+ if omit == name:+ continue+ _write_component(root, folder, declared, weights=True, populated=empty != name)+ for name, advertised in _TOKENIZERS.items():+ folder = keys.get(name, name)+ if omit == name:+ continue+ _write_component(root, folder, {"tokenizer_class": advertised}, weights=False, populated=empty != name)++ return root+++def _mod(root: Path) -> MagicMock:+ mod = MagicMock()+ mod.path = root+ mod.name = "sdnq-flux1"+ return mod+++def _discover(root: Path) -> Main_SDNQ_Diffusers_FLUX_Config:+ return Main_SDNQ_Diffusers_FLUX_Config.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})+++_ALL_SLOTS = {+ SubModelType.Transformer,+ SubModelType.TextEncoder,+ SubModelType.TextEncoder2,+ SubModelType.VAE,+ SubModelType.Tokenizer,+ SubModelType.Tokenizer2,+}++_SLOT_FOR_COMPONENT = {+ "text_encoder": SubModelType.TextEncoder,+ "text_encoder_2": SubModelType.TextEncoder2,+ "vae": SubModelType.VAE,+ "tokenizer": SubModelType.Tokenizer,+ "tokenizer_2": SubModelType.Tokenizer2,+}+++def test_a_complete_pipeline_records_every_component(tmp_path: Path) -> None:+ config = _discover(_make_flux1_pipeline(tmp_path / "complete"))++ assert config.submodels is not None+ assert set(config.submodels) == _ALL_SLOTS++[email protected]("component", sorted(_SLOT_FOR_COMPONENT))+def test_a_component_whose_directory_is_missing_is_not_recorded(tmp_path: Path, component: str) -> None:+ """A partial download keeps the full index; the missing component must not be advertised as present."""+ config = _discover(_make_flux1_pipeline(tmp_path / f"missing-{component}", omit=component))++ assert config.submodels is not None+ assert _SLOT_FOR_COMPONENT[component] not in config.submodels++[email protected]("component", sorted(_SLOT_FOR_COMPONENT))+def test_a_component_whose_directory_is_empty_is_not_recorded(tmp_path: Path, component: str) -> None:+ """An interrupted download leaves the folders created but empty — nothing there to load."""+ config = _discover(_make_flux1_pipeline(tmp_path / f"empty-{component}", empty=component))++ assert config.submodels is not None+ assert _SLOT_FOR_COMPONENT[component] not in config.submodels+++def test_a_component_that_contradicts_its_advertised_class_is_not_recorded(tmp_path: Path) -> None:+ root = _make_flux1_pipeline(tmp_path / "mismatched-vae")+ (root / "vae" / "config.json").write_text(json.dumps({"_class_name": "T5EncoderModel"}), encoding="utf-8")++ config = _discover(root)++ assert config.submodels is not None+ assert SubModelType.VAE not in config.submodels+++def test_a_weight_bearing_component_that_names_no_class_is_not_recorded(tmp_path: Path) -> None:+ root = _make_flux1_pipeline(tmp_path / "undeclared-encoder")+ (root / "text_encoder" / "config.json").write_text(json.dumps({"hidden_size": 768}), encoding="utf-8")++ config = _discover(root)++ assert config.submodels is not None+ assert SubModelType.TextEncoder not in config.submodels+++def test_nonstandard_index_keys_are_recorded_at_the_path_they_actually_live_at(tmp_path: Path) -> None:+ """The index may name a component anything. Discovery records the folder it found, so loading+ follows it instead of reconstructing a conventional name that does not exist here."""+ keys = {"text_encoder": "clip_encoder", "vae": "autoencoder"}+ root = _make_flux1_pipeline(tmp_path / "nonstandard", component_keys=keys)++ config = _discover(root)++ assert config.submodels is not None+ assert set(config.submodels) == _ALL_SLOTS+ assert config.submodels[SubModelType.TextEncoder].path_or_prefix.endswith("clip_encoder")+ assert config.submodels[SubModelType.VAE].path_or_prefix.endswith("autoencoder")+ # And the conventional folders genuinely do not exist, so a reconstructing loader would miss.+ assert not (root / "text_encoder").exists()+ assert not (root / "vae").exists()+++def test_a_serialized_submodel_map_does_not_survive_a_deleted_component(tmp_path: Path) -> None:+ """Rehydration must revalidate against current files.++ A config persisted while the pipeline was complete carries the full submodel map. Replaying it+ would keep reporting a component that has since been deleted, so the pipeline would still look+ self-contained and the failure would only surface when a loader opens the missing folder.+ """+ root = _make_flux1_pipeline(tmp_path / "rehydrate")+ complete = _discover(root)+ assert complete.submodels is not None and SubModelType.VAE in complete.submodels++ # The component goes away after the config was written.+ for entry in (root / "vae").iterdir():+ entry.unlink()+ (root / "vae").rmdir()++ rehydrated = Main_SDNQ_Diffusers_FLUX_Config.from_model_on_disk(+ _mod(root),+ {**_REQUIRED_FIELDS, "path": root.as_posix(), "submodels": complete.submodels},+ )++ assert rehydrated.submodels is not None+ assert SubModelType.VAE not in rehydrated.submodelsdiff --git a/tests/backend/model_manager/configs/test_sdnq_flux2_identification.py b/tests/backend/model_manager/configs/test_sdnq_flux2_identification.pynew file mode 100644index 0000000000..e09b2b5292--- /dev/null+++ b/tests/backend/model_manager/configs/test_sdnq_flux2_identification.py@@ -0,0 +1,107 @@+"""Tests for SDNQ FLUX.2 single-file model identification.++A single-file SDNQ FLUX.2 transformer must identify as ``Main_SDNQ_Flux2_Config`` (base=flux2),+not as ``Main_SDNQ_FLUX_Config`` (base=flux) and not as unknown.++The only supported single-file layout is *bare diffusers* (``transformer_blocks.*`` /+``context_embedder.*``): SDNQ tooling quantizes diffusers state dicts, and the single-file SDNQ+FLUX.2 loader (``Flux2SDNQCheckpointModel._load_from_singlefile``) reads exactly those bare keys with+no BFL→diffusers conversion and no ``model.diffusion_model.`` prefix stripping. ``Main_SDNQ_Flux2_Config``+therefore accepts only the bare diffusers layout and must REJECT a BFL / ComfyUI+(``model.diffusion_model.double_blocks.*``) checkpoint — otherwise identification would classify a+checkpoint the loader then fails to load with missing/unexpected keys.++``Main_SDNQ_FLUX_Config`` (base=flux) must also reject FLUX.2 state dicts in either layout, so an+ambiguous checkpoint is never handed to the FLUX.1 loader.+"""++from pathlib import Path+from unittest.mock import MagicMock, patch++import pytest+import torch++from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.taxonomy import BaseModelType++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "path": "/fake/models/test.safetensors",+ "file_size": 1000,+ "name": "flux-2-klein-4b-sdnq",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}++# 3 × Qwen3-4B hidden size (2560) — the FLUX.2 Klein 4B context dimension.+_KLEIN_4B_CONTEXT_DIM = 7680+++def _make_mock_mod(filename: str, state_dict: dict) -> MagicMock:+ mod = MagicMock()+ mod.path = Path(f"/fake/models/{filename}")+ mod.name = filename+ mod.load_state_dict.return_value = state_dict+ return mod+++def _bare_flux2_sdnq_state_dict() -> dict:+ """FLUX.2 SDNQ transformer in the bare diffusers layout (the real shipped single-file layout),+ with an SDNQ weight+scale pair."""+ return {+ "transformer_blocks.0.attn.to_q.weight": torch.zeros(3072, 3072, dtype=torch.uint8),+ "transformer_blocks.0.attn.to_q.scale": torch.zeros(3072, 24, 1),+ "context_embedder.weight": torch.zeros(3072, _KLEIN_4B_CONTEXT_DIM),+ "x_embedder.weight": torch.zeros(3072, 128),+ "img_in.weight": torch.zeros(3072, 128),+ }+++def _prefixed_flux2_sdnq_state_dict() -> dict:+ """FLUX.2 SDNQ transformer in BFL / ComfyUI prefixed layout — not a real single-file SDNQ+ artifact, kept only to exercise the FLUX.1-config rejection guard."""+ return {+ "model.diffusion_model.double_blocks.0.img_attn.qkv.weight": torch.zeros(9216, 3072, dtype=torch.uint8),+ "model.diffusion_model.double_blocks.0.img_attn.qkv.scale": torch.zeros(9216, 24, 1),+ "model.diffusion_model.context_embedder.weight": torch.zeros(3072, _KLEIN_4B_CONTEXT_DIM),+ "model.diffusion_model.img_in.weight": torch.zeros(3072, 128),+ }+++@patch("invokeai.backend.model_manager.configs.main.raise_if_not_file")+@patch("invokeai.backend.model_manager.configs.main.raise_for_override_fields")+class TestSDNQFlux2Identification:+ def test_bare_diffusers_identifies_as_flux2(self, _rfo, _rif):+ """A bare diffusers-layout SDNQ FLUX.2 checkpoint (the layout the loader supports) identifies+ as base=flux2."""+ from invokeai.backend.model_manager.configs.main import Main_SDNQ_Flux2_Config++ mod = _make_mock_mod("flux-2-klein-4b-sdnq.safetensors", _bare_flux2_sdnq_state_dict())+ config = Main_SDNQ_Flux2_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS})+ assert config.base is BaseModelType.Flux2++ def test_prefixed_bfl_layout_is_rejected(self, _rfo, _rif):+ """A BFL / ComfyUI (model.diffusion_model.double_blocks.*) SDNQ FLUX.2 checkpoint must NOT be+ accepted: the single-file SDNQ FLUX.2 loader only consumes the bare diffusers layout (no BFL+ prefix stripping / conversion), so identification must reject it rather than classify a+ checkpoint the loader then fails to load."""+ from invokeai.backend.model_manager.configs.main import Main_SDNQ_Flux2_Config++ mod = _make_mock_mod("flux-2-klein-4b-sdnq.safetensors", _prefixed_flux2_sdnq_state_dict())+ with pytest.raises(NotAMatchError):+ Main_SDNQ_Flux2_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS})++ @pytest.mark.parametrize(+ "state_dict_factory",+ [_bare_flux2_sdnq_state_dict, _prefixed_flux2_sdnq_state_dict],+ ids=["bare-diffusers", "prefixed"],+ )+ def test_flux1_config_rejects_flux2(self, _rfo, _rif, state_dict_factory):+ """The FLUX.1 SDNQ config must NOT accept a FLUX.2 state dict (would load with wrong loader)."""+ from invokeai.backend.model_manager.configs.main import Main_SDNQ_FLUX_Config++ mod = _make_mock_mod("flux-2-klein-4b-sdnq.safetensors", state_dict_factory())+ with pytest.raises(NotAMatchError):+ Main_SDNQ_FLUX_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS})diff --git a/tests/backend/model_manager/configs/test_sdnq_pipeline_submodel_discovery.py b/tests/backend/model_manager/configs/test_sdnq_pipeline_submodel_discovery.pynew file mode 100644index 0000000000..81d0b21afb--- /dev/null+++ b/tests/backend/model_manager/configs/test_sdnq_pipeline_submodel_discovery.py@@ -0,0 +1,626 @@+"""Tests that SDNQ pipeline submodel discovery recognizes the compatible Qwen encoder/tokenizer+classes the loader can actually load.++_get_submodels() must record the TextEncoder / Tokenizer submodels for the text-only Qwen causal-LM+classes and the slow/fast Qwen2 tokenizer classes; otherwise a valid SDNQ pipeline whose+model_index.json advertises e.g. Qwen2ForCausalLM or Qwen2TokenizerFast is mis-recorded as partial+and is_self_contained_sdnq_pipeline() wrongly returns False, forcing separate VAE/Qwen3 sources.++It must NOT record a TextEncoder for Qwen2VLForConditionalGeneration: that is a multimodal Qwen-VL+model (with a visual tower), but the SDNQ pipeline loaders instantiate a text-only Qwen3ForCausalLM,+so treating it as self-contained would mark the pipeline complete even though the loader would fail+on the visual-tower weights.+"""++import json+from pathlib import Path+from unittest.mock import MagicMock++import pytest+import torch+from safetensors.torch import save_file++from invokeai.app.invocations.model import is_self_contained_sdnq_pipeline+from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.configs.main import (+ Main_SDNQ_Diffusers_Flux2_Config,+ Main_SDNQ_Diffusers_ZImage_Config,+)+from invokeai.backend.model_manager.taxonomy import Flux2VariantType, SubModelType++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "file_size": 1000,+ "name": "sdnq-pipeline",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}++# Only Qwen3ForCausalLM is loadable by the pipeline loader (it builds a text-only Qwen3ForCausalLM).+# Qwen2ForCausalLM (missing Qwen3 q/k-norm params) and the multimodal Qwen2VLForConditionalGeneration+# (visual tower) are not loadable and must not be recorded as self-contained TextEncoders.+_ENCODER_CLASSES = ["Qwen3ForCausalLM"]+_UNLOADABLE_ENCODER_CLASSES = ["Qwen2ForCausalLM", "Qwen2VLForConditionalGeneration"]+++def _write_sdnq_transformer(root: Path, transformer_config: dict, class_name: str = "Flux2Transformer2DModel") -> None:+ transformer_dir = root / "transformer"+ transformer_dir.mkdir()+ # Real diffusers component configs carry `_class_name` (save_config writes it). Discovery requires+ # a weight-bearing component to name itself, so the fixture must too.+ (transformer_dir / "config.json").write_text(+ json.dumps({"_class_name": class_name, **transformer_config}), encoding="utf-8"+ )+ (transformer_dir / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ save_file(+ {+ "transformer_blocks.0.attn.to_q.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "transformer_blocks.0.attn.to_q.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(transformer_dir / "diffusion_pytorch_model.safetensors"),+ )+++# The component folders discovery must find populated on disk before recording a submodel.+# model_index.json advertising them is not enough — a partial download can keep the index while its+# component folders are missing, and an interrupted one leaves them created but empty.+_PIPELINE_COMPONENT_DIRS = ("vae", "text_encoder", "tokenizer")+++# What each component's own config declares about itself, as `save_pretrained` would write it:+# `architectures` for transformers models, `_class_name` for diffusers ones. `AutoencoderKL` is+# accepted for both pipelines (FLUX.2 also allows the `AutoencoderKLFlux2` spelling).+_COMPONENT_SELF_DECLARED_CONFIG = {+ "vae": {"_class_name": "AutoencoderKL"},+ "text_encoder": {"architectures": ["Qwen3ForCausalLM"]},+}+++def _write_component_dirs(+ root: Path, components: tuple[str, ...] = _PIPELINE_COMPONENT_DIRS, *, populated: bool = True+) -> None:+ """Create the given component subfolders.++ With ``populated=True`` each folder gets the files its loader needs (config + weights, or the+ tokenizer's config for the weightless tokenizer folder). ``populated=False`` creates the bare+ directories an interrupted download leaves behind — discovery must not record those.++ The weight-bearing configs name their own class, because that is what a real `save_pretrained`+ writes and what discovery now requires: "some config plus some weights" is the shape an unrelated+ model has too, so it is no longer accepted on its own.+ """+ for name in components:+ component_dir = root / name+ component_dir.mkdir(exist_ok=True)+ if not populated:+ continue+ if name == "tokenizer":+ (component_dir / "tokenizer_config.json").write_text(+ json.dumps({"tokenizer_class": "Qwen2TokenizerFast"}), encoding="utf-8"+ )+ (component_dir / "tokenizer.json").write_text(json.dumps({}), encoding="utf-8")+ continue+ (component_dir / "config.json").write_text(+ json.dumps(_COMPONENT_SELF_DECLARED_CONFIG.get(name, {})), encoding="utf-8"+ )+ save_file({"weight": torch.zeros(4, 4, dtype=torch.float32)}, str(component_dir / "model.safetensors"))+++def _write_qwen_vl_text_encoder(root: Path) -> None:+ """Write a text_encoder/ folder that actually contains a Qwen-VL model: a config declaring the+ Qwen-VL architecture and SDNQ weights that include both language (model.*) and visual-tower+ (visual.*) keys. The pipeline loader's text-only Qwen3ForCausalLM cannot consume these."""+ te_dir = root / "text_encoder"+ te_dir.mkdir(exist_ok=True)+ (te_dir / "config.json").write_text(+ json.dumps({"architectures": ["Qwen2VLForConditionalGeneration"], "hidden_size": 2560}), encoding="utf-8"+ )+ (te_dir / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ save_file(+ {+ "model.embed_tokens.weight": torch.zeros(1000, 2560, dtype=torch.uint8),+ "model.embed_tokens.scale": torch.zeros(1000, 1, dtype=torch.float32),+ "visual.patch_embed.proj.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "visual.patch_embed.proj.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(te_dir / "model.safetensors"),+ )+++def _make_flux2_pipeline(+ root: Path,+ encoder_class: str,+ components: tuple[str, ...] = _PIPELINE_COMPONENT_DIRS,+ *,+ populated: bool = True,+) -> Path:+ root.mkdir(parents=True, exist_ok=True)+ (root / "model_index.json").write_text(+ json.dumps(+ {+ "_class_name": "Flux2KleinPipeline",+ "transformer": ["diffusers", "Flux2Transformer2DModel"],+ "text_encoder": ["transformers", encoder_class],+ "tokenizer": ["transformers", "Qwen2TokenizerFast"],+ "vae": ["diffusers", "AutoencoderKLFlux2"],+ }+ ),+ encoding="utf-8",+ )+ _write_sdnq_transformer(root, {"attention_head_dim": 128, "num_attention_heads": 24, "joint_attention_dim": 7680})+ _write_component_dirs(root, components, populated=populated)+ return root+++def _make_zimage_pipeline(+ root: Path,+ encoder_class: str,+ components: tuple[str, ...] = _PIPELINE_COMPONENT_DIRS,+ *,+ populated: bool = True,+) -> Path:+ root.mkdir(parents=True, exist_ok=True)+ (root / "model_index.json").write_text(+ json.dumps(+ {+ "_class_name": "ZImagePipeline",+ "transformer": ["diffusers", "ZImageTransformer2DModel"],+ "text_encoder": ["transformers", encoder_class],+ "tokenizer": ["transformers", "Qwen2TokenizerFast"],+ "vae": ["diffusers", "AutoencoderKL"],+ }+ ),+ encoding="utf-8",+ )+ _write_sdnq_transformer(root, {"_class_name": "ZImageTransformer2DModel"})+ scheduler_dir = root / "scheduler"+ scheduler_dir.mkdir()+ (scheduler_dir / "scheduler_config.json").write_text(json.dumps({"shift": 3.0}), encoding="utf-8")+ _write_component_dirs(root, components, populated=populated)+ return root+++def _mod(root: Path) -> MagicMock:+ mod = MagicMock()+ mod.path = root+ mod.name = "sdnq-klein-4b" # no "base" substring -> distilled variant+ return mod+++def _assert_complete_pipeline(config) -> None:+ assert config.submodels is not None+ assert SubModelType.Transformer in config.submodels+ assert SubModelType.TextEncoder in config.submodels+ assert SubModelType.Tokenizer in config.submodels+ assert SubModelType.VAE in config.submodels+ assert is_self_contained_sdnq_pipeline(config)++[email protected]("encoder_class", _ENCODER_CLASSES)+def test_flux2_sdnq_pipeline_records_compatible_encoder_and_fast_tokenizer(tmp_path: Path, encoder_class: str):+ root = _make_flux2_pipeline(tmp_path / "flux2", encoder_class)+ config = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ _assert_complete_pipeline(config)++[email protected]("encoder_class", _ENCODER_CLASSES)+def test_zimage_sdnq_pipeline_records_compatible_encoder_and_fast_tokenizer(tmp_path: Path, encoder_class: str):+ root = _make_zimage_pipeline(tmp_path / "zimage", encoder_class)+ config = Main_SDNQ_Diffusers_ZImage_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ _assert_complete_pipeline(config)+++def _assert_pipeline_not_self_contained(config) -> None:+ # The VAE and Tokenizer are still recorded, but the unloadable text encoder is NOT — so the+ # pipeline is not self-contained and readiness/invocation must require an explicit text-only Qwen3+ # source instead of selecting the main model (which the loader could not load).+ assert config.submodels is not None+ assert SubModelType.TextEncoder not in config.submodels+ assert SubModelType.VAE in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)++[email protected]("encoder_class", _UNLOADABLE_ENCODER_CLASSES)+def test_flux2_sdnq_pipeline_with_unloadable_encoder_is_not_self_contained(tmp_path: Path, encoder_class: str):+ root = _make_flux2_pipeline(tmp_path / "flux2-unloadable", encoder_class)+ _write_qwen_vl_text_encoder(root)+ config = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ _assert_pipeline_not_self_contained(config)++[email protected]("encoder_class", _UNLOADABLE_ENCODER_CLASSES)+def test_zimage_sdnq_pipeline_with_unloadable_encoder_is_not_self_contained(tmp_path: Path, encoder_class: str):+ root = _make_zimage_pipeline(tmp_path / "zimage-unloadable", encoder_class)+ _write_qwen_vl_text_encoder(root)+ config = Main_SDNQ_Diffusers_ZImage_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ _assert_pipeline_not_self_contained(config)+++# --- Partial download: complete model_index.json but component folders missing on disk ---+# is_self_contained_sdnq_pipeline must key on what actually ships, not on what the index advertises,+# otherwise the loaders later request fixed vae/ text_encoder/ tokenizer/ subfolders that aren't there.++[email protected]("missing", ["vae", "text_encoder", "tokenizer"])+def test_flux2_sdnq_pipeline_with_missing_component_dir_is_not_self_contained(tmp_path: Path, missing: str):+ present = tuple(c for c in _PIPELINE_COMPONENT_DIRS if c != missing)+ root = _make_flux2_pipeline(tmp_path / f"flux2-missing-{missing}", "Qwen3ForCausalLM", components=present)+ config = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ assert config.submodels is not None+ assert not is_self_contained_sdnq_pipeline(config)+ # The absent component is not recorded, even though model_index.json still advertises it.+ submodel_for = {+ "vae": SubModelType.VAE,+ "text_encoder": SubModelType.TextEncoder,+ "tokenizer": SubModelType.Tokenizer,+ }+ assert submodel_for[missing] not in config.submodels++[email protected]("missing", ["vae", "text_encoder", "tokenizer"])+def test_zimage_sdnq_pipeline_with_missing_component_dir_is_not_self_contained(tmp_path: Path, missing: str):+ present = tuple(c for c in _PIPELINE_COMPONENT_DIRS if c != missing)+ root = _make_zimage_pipeline(tmp_path / f"zimage-missing-{missing}", "Qwen3ForCausalLM", components=present)+ config = Main_SDNQ_Diffusers_ZImage_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )+ assert config.submodels is not None+ assert not is_self_contained_sdnq_pipeline(config)+ submodel_for = {+ "vae": SubModelType.VAE,+ "text_encoder": SubModelType.TextEncoder,+ "tokenizer": SubModelType.Tokenizer,+ }+ assert submodel_for[missing] not in config.submodels+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-empty-components"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-empty-components"),+ ],+)+def test_sdnq_pipeline_with_empty_component_dirs_is_not_self_contained(tmp_path: Path, factory, root_name: str):+ """An interrupted download leaves the component folders created but empty. Their mere existence+ must not make the pipeline self-contained — the loaders would find nothing to read."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM", populated=False)+ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert not is_self_contained_sdnq_pipeline(config)+ assert config.submodels is not None+ for submodel in (SubModelType.VAE, SubModelType.TextEncoder, SubModelType.Tokenizer):+ assert submodel not in config.submodels+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-missing-index-transformer"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-missing-index-transformer"),+ ],+)+def test_sdnq_pipeline_without_index_transformer_is_not_self_contained(tmp_path: Path, factory, root_name: str):+ """A malformed index can advertise the components while omitting the transformer every loader+ requests. The components alone must not satisfy the self-contained check."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")+ model_index = json.loads((root / "model_index.json").read_text(encoding="utf-8"))+ del model_index["transformer"]+ (root / "model_index.json").write_text(json.dumps(model_index), encoding="utf-8")++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config.submodels is not None+ assert SubModelType.Transformer not in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)+++# --- Mismatched components: the index advertises a loadable class over a folder holding something else ---+# model_index.json is a claim about each folder, not a fact about it. A repo can advertise the one+# class the loader supports and ship a different model, which passes both the class-name check and the+# file-presence check. The pipeline is then recorded as self-contained and the mismatch only surfaces+# at generation time, when the loader builds the advertised class against an incompatible state dict.+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-mismatched-encoder"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-mismatched-encoder"),+ ],+)+def test_sdnq_pipeline_with_a_mismatched_text_encoder_folder_is_not_self_contained(+ tmp_path: Path, factory, root_name: str+):+ """Index says Qwen3ForCausalLM; the folder holds a multimodal Qwen-VL model."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")+ _write_qwen_vl_text_encoder(root)++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ _assert_pipeline_not_self_contained(config)+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-mismatched-vae"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-mismatched-vae"),+ ],+)+def test_sdnq_pipeline_with_a_mismatched_vae_folder_is_not_self_contained(tmp_path: Path, factory, root_name: str):+ """Index says the VAE slot holds an AutoencoderKL; the folder declares an unrelated model."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")+ (root / "vae" / "config.json").write_text(json.dumps({"_class_name": "Qwen2ForCausalLM"}), encoding="utf-8")++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config.submodels is not None+ assert SubModelType.VAE not in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)+++ ("factory", "root_name", "component"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-undeclared-encoder", "text_encoder"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-undeclared-encoder", "text_encoder"),+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-undeclared-vae", "vae"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-undeclared-vae", "vae"),+ ],+)+def test_sdnq_pipeline_with_a_weight_bearing_component_that_names_no_class_is_not_self_contained(+ tmp_path: Path, factory, root_name: str, component: str+):+ """Silence is not evidence.++ "Some config.json plus some weight file" is exactly the shape an unrelated model has, so a+ weight-bearing component that names no class cannot be confirmed and must not be recorded.+ Accepting it would leave the hole open for every mismatched component whose config happens to+ omit the key — which is the reviewer's "any directory containing a config file and weight file".+ """+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")+ (root / component / "config.json").write_text(json.dumps({"hidden_size": 2560}), encoding="utf-8")++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ submodel = SubModelType.TextEncoder if component == "text_encoder" else SubModelType.VAE+ assert config.submodels is not None+ assert submodel not in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-undeclared-tokenizer"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-undeclared-tokenizer"),+ ],+)+def test_sdnq_pipeline_tokenizer_without_a_declared_class_is_still_recorded(tmp_path: Path, factory, root_name: str):+ """The tokenizer stays lenient: it carries no weights, so nothing can be mis-instantiated against+ it, and `tokenizer_class` is less consistently written than `_class_name`/`architectures`."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")+ (root / "tokenizer" / "tokenizer_config.json").write_text(json.dumps({}), encoding="utf-8")++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ _assert_complete_pipeline(config)++[email protected]("suffix", [".gguf", ".bin", ".pt"])+ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-nonsafetensors-encoder"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-nonsafetensors-encoder"),+ ],+)+def test_a_quantized_component_without_safetensors_is_not_recorded(+ tmp_path: Path, factory, root_name: str, suffix: str+):+ """`sdnq_sd_loader` globs `*.safetensors` and raises when it finds none.++ A folder that declares the right class and holds a `.gguf`/`.bin` looks populated to a generic+ file check, so the pipeline was recorded as self-contained and the failure moved to load time.+ """+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / f"{root_name}{suffix}", "Qwen3ForCausalLM")++ encoder = root / "text_encoder"+ (encoder / "model.safetensors").unlink()+ # Marking it SDNQ is what routes it to the safetensors-only loader.+ (encoder / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ (encoder / f"model{suffix}").write_bytes(b"\x00")++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config.submodels is not None+ assert SubModelType.TextEncoder not in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-bin-vae"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-bin-vae"),+ ],+)+def test_an_unquantized_component_may_still_ship_a_non_safetensors_weight(tmp_path: Path, factory, root_name: str):+ """SDNQ exports leave the VAE unquantized; it goes through `from_pretrained`, which reads more+ than safetensors. Narrowing every component to safetensors would reject those pipelines."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")++ vae = root / "vae"+ (vae / "model.safetensors").unlink()+ (vae / "diffusion_pytorch_model.bin").write_bytes(b"\x00") # no quantization_config.json here++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config.submodels is not None+ assert SubModelType.VAE in config.submodels++[email protected]("suffix", [".gguf", ".bin"])+ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-unmarked-encoder"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-unmarked-encoder"),+ ],+)+def test_a_component_the_loader_always_reads_with_sdnq_needs_safetensors_even_without_a_marker(+ tmp_path: Path, factory, root_name: str, suffix: str+):+ """`quantization_config.json` is not what decides this — the loader is.++ FLUX.2 and Z-Image build their Qwen3 text encoder with `sdnq_sd_loader` unconditionally. A+ component carrying SDNQ weight/scale keys but no marker file reads as unquantized, so a `.bin`+ or `.gguf` used to pass discovery and then fail in a loader that was always going to want+ safetensors.+ """+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / f"{root_name}{suffix}", "Qwen3ForCausalLM")++ encoder = root / "text_encoder"+ (encoder / "model.safetensors").unlink()+ (encoder / f"model{suffix}").write_bytes(b"\x00") # SDNQ-shaped content, but no marker file++ config = factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config.submodels is not None+ assert SubModelType.TextEncoder not in config.submodels+ assert not is_self_contained_sdnq_pipeline(config)+++# --- FLUX.2 variant identification ---+# `_get_variant_or_raise` compared the transformer geometry by hand and had no [dev] branch, so a+# [dev] pipeline fell into the `else` and was silently identified as Klein4B. Reading the geometry+# through `flux2_variant.py` — the source of truth the checkpoint / diffusers / LoRA paths already+# use — makes it identify as itself. Supporting [dev] SDNQ pipelines end to end is separate work.++_FLUX2_DEV_TRANSFORMER_CONFIG = {+ # 3 x Mistral Small 3.1 5120, and 48 heads x 128 head_dim -> see configs/flux2_variant.py+ "joint_attention_dim": 15360,+ "attention_head_dim": 128,+ "num_attention_heads": 48,+}+++def _make_flux2_dev_pipeline(root: Path, *, encoder_class: str = "Mistral3ForConditionalGeneration") -> Path:+ root.mkdir(parents=True, exist_ok=True)+ (root / "model_index.json").write_text(+ json.dumps(+ {+ "_class_name": "Flux2Pipeline",+ "transformer": ["diffusers", "Flux2Transformer2DModel"],+ "text_encoder": ["transformers", encoder_class],+ "tokenizer": ["transformers", "LlamaTokenizerFast"],+ "vae": ["diffusers", "AutoencoderKLFlux2"],+ }+ ),+ encoding="utf-8",+ )+ _write_sdnq_transformer(root, _FLUX2_DEV_TRANSFORMER_CONFIG)++ for name, declared in (+ ("vae", {"_class_name": "AutoencoderKL"}),+ ("text_encoder", {"architectures": [encoder_class]}),+ ):+ folder = root / name+ folder.mkdir(exist_ok=True)+ (folder / "config.json").write_text(json.dumps(declared), encoding="utf-8")+ save_file({"weight": torch.zeros(4, 4)}, str(folder / "model.safetensors"))+ tokenizer = root / "tokenizer"+ tokenizer.mkdir(exist_ok=True)+ (tokenizer / "tokenizer_config.json").write_text(+ json.dumps({"tokenizer_class": "LlamaTokenizerFast"}), encoding="utf-8"+ )+ (tokenizer / "tokenizer.json").write_text(json.dumps({}), encoding="utf-8")+ return root+++def test_an_sdnq_flux2_dev_pipeline_is_identified_as_dev_not_klein(tmp_path: Path) -> None:+ root = _make_flux2_dev_pipeline(tmp_path / "flux2-dev")++ config = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )++ assert config.variant is Flux2VariantType.Dev+++def test_a_klein_pipeline_is_still_identified_as_klein(tmp_path: Path) -> None:+ """Guard against the Dev branch swallowing the Klein geometries."""+ root = _make_flux2_pipeline(tmp_path / "flux2-klein-still", "Qwen3ForCausalLM")++ config = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(+ _mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()}+ )++ assert config.variant is Flux2VariantType.Klein4B+++# --- Identification must not accept a transformer the loader cannot read ---+# `_validate_has_sdnq_transformer` checked only that the folder *looked* SDNQ. Discovery then left+# `Transformer` out of `submodels` (no readable weights), but the config was still created — so the+# model installed and the failure surfaced when a loader opened the transformer path to generate.+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-weightless-transformer"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-weightless-transformer"),+ ],+)+def test_a_transformer_with_a_marker_but_no_weights_is_rejected(tmp_path: Path, factory, root_name: str):+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")++ # Config and SDNQ marker stay; the weights go away.+ for weight in (root / "transformer").glob("*.safetensors"):+ weight.unlink()++ with pytest.raises(NotAMatchError):+ factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})+++ ("factory", "root_name"),+ [+ (Main_SDNQ_Diffusers_Flux2_Config, "flux2-nonsafetensors-transformer"),+ (Main_SDNQ_Diffusers_ZImage_Config, "zimage-nonsafetensors-transformer"),+ ],+)+def test_a_transformer_whose_only_weight_is_unreadable_is_rejected(tmp_path: Path, factory, root_name: str):+ """`sdnq_sd_loader` reads safetensors only, so a `.bin` transformer is not loadable either."""+ maker = _make_flux2_pipeline if factory is Main_SDNQ_Diffusers_Flux2_Config else _make_zimage_pipeline+ root = maker(tmp_path / root_name, "Qwen3ForCausalLM")++ for weight in (root / "transformer").glob("*.safetensors"):+ weight.unlink()+ (root / "transformer" / "diffusion_pytorch_model.bin").write_bytes(b"\x00")++ with pytest.raises(NotAMatchError):+ factory.from_model_on_disk(_mod(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})diff --git a/tests/backend/model_manager/configs/test_sdnq_t5_encoder_identification.py b/tests/backend/model_manager/configs/test_sdnq_t5_encoder_identification.pynew file mode 100644index 0000000000..158f4f88b4--- /dev/null+++ b/tests/backend/model_manager/configs/test_sdnq_t5_encoder_identification.py@@ -0,0 +1,145 @@+"""Tests for SDNQ T5 encoder identification and tokenizer/encoder directory resolution.++T5Encoder_SDNQ_Config accepts two layouts:++1. **Standalone bundle** — ``path`` is the pipeline root; T5 lives under ``text_encoder_2/`` and the+ tokenizer under a sibling ``tokenizer_2/``.+2. **Inline submodel** — ``path`` *is* the ``text_encoder_2`` folder; the tokenizer is a *sibling*+ ``tokenizer_2/`` of that folder.++The encoder loader already resolves the encoder dir by layout, but the tokenizer must be resolved+the same way (``path / "tokenizer_2"`` is wrong for the inline layout). And an install with no+resolvable ``tokenizer_2/`` must be rejected at identification, so it never registers as a selectable+T5 that then fails mid-workflow when a Tokenizer2 is requested.+"""++import json+from pathlib import Path++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.configs.t5_encoder import T5Encoder_SDNQ_Config+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "file_size": 1000,+ "name": "sdnq-t5",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}+++def _write_t5_encoder_dir(te_dir: Path) -> None:+ te_dir.mkdir(parents=True, exist_ok=True)+ (te_dir / "config.json").write_text(json.dumps({"architectures": ["T5EncoderModel"]}), encoding="utf-8")+ (te_dir / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ save_file(+ {+ "encoder.block.0.layer.0.SelfAttention.q.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "encoder.block.0.layer.0.SelfAttention.q.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(te_dir / "model.safetensors"),+ )+++def _write_tokenizer_dir(tok_dir: Path) -> None:+ tok_dir.mkdir(parents=True, exist_ok=True)+ (tok_dir / "tokenizer_config.json").write_text("{}", encoding="utf-8")+++def _make_standalone_bundle(root: Path, *, with_tokenizer: bool = True) -> Path:+ """path is the pipeline root; T5 under text_encoder_2/, tokenizer under sibling tokenizer_2/."""+ root.mkdir(parents=True, exist_ok=True)+ _write_t5_encoder_dir(root / "text_encoder_2")+ if with_tokenizer:+ _write_tokenizer_dir(root / "tokenizer_2")+ return root+++def _make_inline_submodel(root: Path, *, with_tokenizer: bool = True) -> Path:+ """path IS the text_encoder_2 folder; tokenizer is a sibling tokenizer_2/ of that folder."""+ te_dir = root / "text_encoder_2"+ _write_t5_encoder_dir(te_dir)+ if with_tokenizer:+ _write_tokenizer_dir(root / "tokenizer_2")+ return te_dir+++def test_standalone_bundle_identifies_and_resolves_dirs(tmp_path: Path):+ root = _make_standalone_bundle(tmp_path / "bundle")+ mod = ModelOnDisk(root)++ config = T5Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})+ assert config.format.value == "sdnq_quantized"+ # tokenizer_2 is a child of the root; encoder is under text_encoder_2/.+ assert T5Encoder_SDNQ_Config.resolve_tokenizer_dir(root) == root / "tokenizer_2"+ assert T5Encoder_SDNQ_Config.resolve_text_encoder_dir(root) == root / "text_encoder_2"+++def test_inline_submodel_identifies_and_resolves_sibling_tokenizer(tmp_path: Path):+ te_dir = _make_inline_submodel(tmp_path / "inline")+ mod = ModelOnDisk(te_dir)++ config = T5Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": te_dir.as_posix()})+ assert config.format.value == "sdnq_quantized"+ # Inline: the tokenizer is the *sibling* tokenizer_2/, not a child of the text_encoder_2 folder.+ assert T5Encoder_SDNQ_Config.resolve_tokenizer_dir(te_dir) == te_dir.parent / "tokenizer_2"+ assert not (te_dir / "tokenizer_2").exists() # the path the old loader used doesn't exist+ assert T5Encoder_SDNQ_Config.resolve_text_encoder_dir(te_dir) == te_dir+++def test_inline_submodel_without_tokenizer_is_rejected(tmp_path: Path):+ te_dir = _make_inline_submodel(tmp_path / "inline-no-tok", with_tokenizer=False)+ mod = ModelOnDisk(te_dir)+ with pytest.raises(NotAMatchError):+ T5Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": te_dir.as_posix()})+ assert T5Encoder_SDNQ_Config.resolve_tokenizer_dir(te_dir) is None+++def test_standalone_bundle_without_tokenizer_is_rejected(tmp_path: Path):+ root = _make_standalone_bundle(tmp_path / "bundle-no-tok", with_tokenizer=False)+ mod = ModelOnDisk(root)+ with pytest.raises(NotAMatchError):+ T5Encoder_SDNQ_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS, "path": root.as_posix()})+ assert T5Encoder_SDNQ_Config.resolve_tokenizer_dir(root) is None+++def _write_sharded_t5_encoder_dir(te_dir: Path, *, split_the_pair: bool) -> None:+ """A sharded SDNQ T5 encoder with **no** quantization marker, so identification has to rely on the+ weight/scale key heuristic alone.++ With ``split_the_pair`` the weight and its scale land in different shards, which is what sharding+ by tensor order actually does — nothing keeps a pair together.+ """+ te_dir.mkdir(parents=True, exist_ok=True)+ (te_dir / "config.json").write_text(json.dumps({"architectures": ["T5EncoderModel"]}), encoding="utf-8")++ weight = {"encoder.block.0.layer.0.SelfAttention.q.weight": torch.zeros(64, 32, dtype=torch.uint8)}+ scale = {"encoder.block.0.layer.0.SelfAttention.q.scale": torch.zeros(64, 1, dtype=torch.float32)}+ other = {"encoder.block.1.layer.0.SelfAttention.q.weight": torch.zeros(64, 32, dtype=torch.uint8)}++ if split_the_pair:+ save_file(weight, str(te_dir / "model-00001-of-00002.safetensors"))+ save_file(scale, str(te_dir / "model-00002-of-00002.safetensors"))+ else:+ save_file({**weight, **scale}, str(te_dir / "model-00001-of-00002.safetensors"))+ save_file(other, str(te_dir / "model-00002-of-00002.safetensors"))++[email protected]("split_the_pair", [False, True])+def test_sharded_sdnq_encoder_is_identified_even_when_the_pair_straddles_shards(tmp_path: Path, split_the_pair: bool):+ """Matching weight/scale per file rejected a valid checkpoint whenever sharding separated them."""+ root = tmp_path / f"sharded-{'split' if split_the_pair else 'together'}"+ root.mkdir(parents=True, exist_ok=True)+ _write_sharded_t5_encoder_dir(root / "text_encoder_2", split_the_pair=split_the_pair)+ _write_tokenizer_dir(root / "tokenizer_2")++ config = T5Encoder_SDNQ_Config.from_model_on_disk(ModelOnDisk(root), {**_REQUIRED_FIELDS, "path": root.as_posix()})++ assert config is not Nonediff --git a/tests/backend/model_manager/configs/test_z_image_sdnq_identification.py b/tests/backend/model_manager/configs/test_z_image_sdnq_identification.pynew file mode 100644index 0000000000..ff8392391a--- /dev/null+++ b/tests/backend/model_manager/configs/test_z_image_sdnq_identification.py@@ -0,0 +1,114 @@+"""Tests that an SDNQ-quantized ZImagePipeline folder identifies as the SDNQ config.++A full ZImagePipeline folder whose ``transformer/quantization_config.json`` has+``quant_method: "sdnq"`` must classify as ``Main_SDNQ_Diffusers_ZImage_Config``, not as the plain+``Main_Diffusers_ZImage_Config``. Both configs accept the same ZImagePipeline class name, and the+factory only breaks ties by model type, so without an explicit SDNQ-rejection guard on the plain+config the pipeline could be classified as plain diffusers — which would then mis-read the packed+uint8 weights and, via the self-contained path in the Z-Image model loader, force the user to+select separate VAE/Qwen3 sources for a single installed pipeline.++This mirrors the SDNQ-rejection guards already present on the FLUX and FLUX.2 diffusers configs.+"""++import json+from pathlib import Path+from unittest.mock import MagicMock++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.factory import ModelConfigFactory+from invokeai.backend.model_manager.configs.identification_utils import NotAMatchError+from invokeai.backend.model_manager.configs.main import (+ Main_Diffusers_ZImage_Config,+ Main_SDNQ_Diffusers_ZImage_Config,+)++_REQUIRED_FIELDS = {+ "hash": "blake3:fakehash",+ "path": "/fake/models/z-image-sdnq",+ "file_size": 1000,+ "name": "z-image-sdnq",+ "description": "test",+ "source": "test",+ "source_type": "path",+ "key": "test-key",+}+++def _make_sdnq_zimage_pipeline_folder(root: Path) -> Path:+ """Create a minimal SDNQ-quantized ZImagePipeline folder on disk."""+ root.mkdir(parents=True, exist_ok=True)+ (root / "model_index.json").write_text(+ json.dumps(+ {+ "_class_name": "ZImagePipeline",+ "transformer": ["diffusers", "ZImageTransformer2DModel"],+ "text_encoder": ["transformers", "Qwen3ForCausalLM"],+ "tokenizer": ["transformers", "Qwen2Tokenizer"],+ "vae": ["diffusers", "AutoencoderKL"],+ "scheduler": ["diffusers", "FlowMatchEulerDiscreteScheduler"],+ }+ ),+ encoding="utf-8",+ )++ transformer_dir = root / "transformer"+ transformer_dir.mkdir()+ (transformer_dir / "config.json").write_text(+ json.dumps({"_class_name": "ZImageTransformer2DModel"}), encoding="utf-8"+ )+ # The SDNQ marker: quant_method == "sdnq".+ (transformer_dir / "quantization_config.json").write_text(+ json.dumps({"quant_method": "sdnq", "weights_dtype": "uint4", "group_size": 128}), encoding="utf-8"+ )+ # Submodel discovery only records a component whose folder actually holds loadable files, so the+ # transformer needs its weights alongside the config.+ save_file(+ {+ "transformer_blocks.0.attn.to_q.weight": torch.zeros(64, 32, dtype=torch.uint8),+ "transformer_blocks.0.attn.to_q.scale": torch.zeros(64, 1, dtype=torch.float32),+ },+ str(transformer_dir / "diffusion_pytorch_model.safetensors"),+ )++ scheduler_dir = root / "scheduler"+ scheduler_dir.mkdir()+ (scheduler_dir / "scheduler_config.json").write_text(json.dumps({"shift": 3.0}), encoding="utf-8")++ return root+++class TestZImageSDNQIdentification:+ def test_plain_diffusers_config_rejects_sdnq_transformer(self, tmp_path: Path):+ """Main_Diffusers_ZImage_Config must NOT accept an SDNQ ZImagePipeline folder."""+ root = _make_sdnq_zimage_pipeline_folder(tmp_path / "z-image-sdnq")+ mod = MagicMock()+ mod.path = root++ with pytest.raises(NotAMatchError):+ Main_Diffusers_ZImage_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS})++ def test_sdnq_config_accepts_sdnq_transformer(self, tmp_path: Path):+ """Main_SDNQ_Diffusers_ZImage_Config must accept the same folder and expose submodels."""+ root = _make_sdnq_zimage_pipeline_folder(tmp_path / "z-image-sdnq")+ mod = MagicMock()+ mod.path = root++ config = Main_SDNQ_Diffusers_ZImage_Config.from_model_on_disk(mod, {**_REQUIRED_FIELDS})+ assert config.format.value == "sdnq_quantized"+ assert config.base.value == "z-image"+ assert config.submodels++ def test_factory_resolves_to_sdnq_config(self, tmp_path: Path):+ """End-to-end: the factory classifies the folder as the SDNQ config, not plain diffusers."""+ root = _make_sdnq_zimage_pipeline_folder(tmp_path / "z-image-sdnq")++ result = ModelConfigFactory.from_model_on_disk(root, allow_unknown=True)++ assert result.config is not None+ assert isinstance(result.config, Main_SDNQ_Diffusers_ZImage_Config)+ # The plain diffusers config must not be among the matches.+ assert not any(isinstance(m, Main_Diffusers_ZImage_Config) for m in result.all_matches)diff --git a/tests/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/test_all_custom_modules.py b/tests/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/test_all_custom_modules.pyindex c8dd2b3b7a..087f1474f6 100644--- a/tests/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/test_all_custom_modules.py+++ b/tests/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/test_all_custom_modules.py@@ -19,6 +19,8 @@ from invokeai.backend.patches.layers.flux_control_lora_layer import FluxControlLfrom invokeai.backend.patches.layers.lokr_layer import LoKRLayerfrom invokeai.backend.patches.layers.lora_layer import LoRALayerfrom invokeai.backend.patches.layers.merged_layer_patch import MergedLayerPatch, Range+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationTypefrom invokeai.backend.util.original_weights_storage import OriginalWeightsStoragefrom tests.backend.model_manager.load.model_cache.torch_module_autocast.custom_modules.test_custom_invoke_linear_8_bit_lt import (build_linear_8bit_lt_layer,@@ -40,6 +42,31 @@ def build_linear_layer_with_ggml_quantized_tensor(orig_layer: torch.nn.Linear |return orig_layer+def build_linear_layer_with_sdnq_quantized_tensor(orig_layer: torch.nn.Linear | None = None):+ """Wrap orig_layer's weight in an SDNQTensor (per-tensor symmetric int8). Bias stays unquantized,+ which matches how SDNQ-quantized checkpoints are typically produced (only Linear weights are quantized)."""+ if orig_layer is None:+ orig_layer = torch.nn.Linear(32, 64)++ weight = orig_layer.weight.data+ orig_dtype = weight.dtype+ abs_max = weight.abs().max()+ # Avoid div-by-zero on degenerate all-zero weights.+ scale_value = (abs_max / 127.0).clamp(min=torch.finfo(torch.float32).tiny)+ scale = scale_value.to(torch.float32).reshape(1)+ quantized = (weight.float() / scale).round().clamp(-127, 127).to(torch.int8)++ sdnq_weight = SDNQTensor(+ data=quantized,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=weight.shape,+ compute_dtype=orig_dtype,+ scale=scale,+ )+ orig_layer.weight = torch.nn.Parameter(sdnq_weight, requires_grad=False)+ return orig_layer++parameterize_all_devices = pytest.mark.parametrize(("device"),[@@ -74,6 +101,7 @@ LayerUnderTest = tuple[torch.nn.Module, torch.Tensor, bool]"embedding","flux_rms_norm","linear_with_ggml_quantized_tensor",+ "linear_with_sdnq_quantized_tensor","invoke_linear_8_bit_lt","invoke_linear_nf4",]@@ -95,6 +123,8 @@ def layer_under_test(request: pytest.FixtureRequest) -> LayerUnderTest:return (RMSNorm(8), torch.randn(1, 8), True)elif layer_type == "linear_with_ggml_quantized_tensor":return (build_linear_layer_with_ggml_quantized_tensor(), torch.randn(1, 32), True)+ elif layer_type == "linear_with_sdnq_quantized_tensor":+ return (build_linear_layer_with_sdnq_quantized_tensor(), torch.randn(1, 32), True)elif layer_type == "invoke_linear_8_bit_lt":return (build_linear_8bit_lt_layer(), torch.randn(1, 32), False)elif layer_type == "invoke_linear_nf4":@@ -547,6 +577,7 @@ def test_linear_sidecar_patches_with_autocast_from_cpu_to_device(device: str, pa@pytest.fixture(params=["linear_ggml_quantized",+ "linear_sdnq_quantized","invoke_linear_8_bit_lt","invoke_linear_nf4",]@@ -559,6 +590,10 @@ def quantized_linear_layer_under_test(request: pytest.FixtureRequest):orig_layer = torch.nn.Linear(in_features, out_features)if layer_type == "linear_ggml_quantized":return orig_layer, build_linear_layer_with_ggml_quantized_tensor(orig_layer)+ elif layer_type == "linear_sdnq_quantized":+ # Re-build so SDNQ gets its own clean orig_layer (the helper modifies in place).+ sdnq_layer = build_linear_layer_with_sdnq_quantized_tensor(copy.deepcopy(orig_layer))+ return orig_layer, sdnq_layerelif layer_type == "invoke_linear_8_bit_lt":return orig_layer, build_linear_8bit_lt_layer(orig_layer)elif layer_type == "invoke_linear_nf4":diff --git a/tests/backend/model_manager/load/test_load_default_helpers.py b/tests/backend/model_manager/load/test_load_default_helpers.pynew file mode 100644index 0000000000..0346d448cd--- /dev/null+++ b/tests/backend/model_manager/load/test_load_default_helpers.py@@ -0,0 +1,130 @@+"""Two invariants that belong to model loading in general, not to any one loader.++Both were repeatedly got wrong per-loader, so they now live at the single choke point every loader+passes through (`put_in_eval_mode`) or in one shared resolver (`resolve_submodel_path`).+"""++from pathlib import Path+from types import SimpleNamespace++import pytest+import torch++from invokeai.backend.model_manager.load.load_default import put_in_eval_mode, resolve_submodel_path+from invokeai.backend.model_manager.taxonomy import SubModelType+++class TestPutInEvalMode:+ def test_a_hand_built_module_tree_comes_back_in_inference_mode(self) -> None:+ """`init_empty_weights` + `load_state_dict` leaves `training` True, unlike `from_pretrained`."""+ module = torch.nn.Sequential(torch.nn.Linear(2, 2), torch.nn.Dropout(0.5), torch.nn.BatchNorm1d(2))+ module.train()+ assert module.training++ returned = put_in_eval_mode(module)++ assert returned is module+ assert all(not child.training for child in module.modules())++ def test_it_is_idempotent(self) -> None:+ """Loaders that already call `.eval()` themselves must be unaffected."""+ module = torch.nn.Linear(2, 2).eval()++ assert not put_in_eval_mode(module).training++ @pytest.mark.parametrize(+ "value",+ [+ "a tokenizer stand-in",+ {"scheduler": "config"},+ SimpleNamespace(name="an IP-Adapter wrapper"),+ None,+ ],+ )+ def test_non_modules_pass_through_untouched(self, value) -> None:+ """Loaders also return tokenizers, schedulers and plain wrappers."""+ assert put_in_eval_mode(value) is value+++class TestResolveSubmodelPath:+ def _config(self, submodels: dict | None) -> SimpleNamespace:+ return SimpleNamespace(path="/models/pipeline", submodels=submodels)++ def test_it_prefers_the_path_discovery_recorded(self) -> None:+ """`model_index.json` may name a component anything; discovery records the folder it found."""+ config = self._config(+ {SubModelType.TextEncoder: SimpleNamespace(path_or_prefix="/models/pipeline/clip_encoder")}+ )++ resolved = resolve_submodel_path(config, SubModelType.TextEncoder, Path("/models/pipeline/text_encoder"))++ assert resolved == Path("/models/pipeline/clip_encoder")++ def test_it_falls_back_when_the_slot_was_not_discovered(self) -> None:+ """Configs persisted before submodel discovery existed carry no map."""+ fallback = Path("/models/pipeline/text_encoder")++ assert resolve_submodel_path(self._config(None), SubModelType.TextEncoder, fallback) == fallback+ assert resolve_submodel_path(self._config({}), SubModelType.TextEncoder, fallback) == fallback++ def test_it_falls_back_for_a_slot_the_map_does_not_cover(self) -> None:+ """A partial pipeline records only some components; the rest keep the conventional name."""+ config = self._config({SubModelType.VAE: SimpleNamespace(path_or_prefix="/models/pipeline/autoencoder")})+ fallback = Path("/models/pipeline/text_encoder")++ assert resolve_submodel_path(config, SubModelType.TextEncoder, fallback) == fallback++ def test_it_tolerates_a_config_without_a_submodels_attribute(self) -> None:+ """Most model configs have no `submodels` field at all."""+ fallback = Path("/models/single-file")++ assert resolve_submodel_path(SimpleNamespace(path="/x"), SubModelType.Transformer, fallback) == fallback+++class TestGetSizeFs:+ """Cache admission must size the folder loading will actually read.++ `make_room()` runs before the component is constructed, so a size of 0 reserves nothing and the+ real multi-GB read lands on top of whatever was already resident.+ """++ def _loader(self):+ from invokeai.backend.model_manager.load.load_default import ModelLoader++ return ModelLoader.__new__(ModelLoader)++ def _component(self, root: Path, name: str, size: int) -> Path:+ folder = root / name+ folder.mkdir(parents=True)+ (folder / "config.json").write_text("{}", encoding="utf-8")+ (folder / "model.safetensors").write_bytes(b"\x00" * size)+ return folder++ def test_it_sizes_a_nonstandard_component_key(self, tmp_path: Path) -> None:+ self._component(tmp_path, "clip_encoder", 4096)+ config = SimpleNamespace(+ path=str(tmp_path),+ repo_variant=None,+ submodels={+ SubModelType.TextEncoder: SimpleNamespace(path_or_prefix=(tmp_path / "clip_encoder").as_posix())+ },+ )++ size = self._loader().get_size_fs(config, tmp_path, SubModelType.TextEncoder)++ assert size >= 4096++ def test_the_conventional_layout_is_unchanged(self, tmp_path: Path) -> None:+ self._component(tmp_path, "text_encoder", 2048)+ config = SimpleNamespace(path=str(tmp_path), repo_variant=None, submodels=None)++ size = self._loader().get_size_fs(config, tmp_path, SubModelType.TextEncoder)++ assert size >= 2048++ def test_a_missing_component_still_sizes_to_zero(self, tmp_path: Path) -> None:+ """A diffusers pipeline that merely lacks a subfolder must keep returning 0."""+ (tmp_path / "model_index.json").write_text("{}", encoding="utf-8")+ config = SimpleNamespace(path=str(tmp_path), repo_variant=None, submodels=None)++ assert self._loader().get_size_fs(config, tmp_path, SubModelType.TextEncoder) == 0diff --git a/tests/backend/model_manager/load/test_sdnq_vae_shard_detection.py b/tests/backend/model_manager/load/test_sdnq_vae_shard_detection.pynew file mode 100644index 0000000000..436c3a0e84--- /dev/null+++ b/tests/backend/model_manager/load/test_sdnq_vae_shard_detection.py@@ -0,0 +1,49 @@+"""Tests that SDNQ VAE detection handles sharded / arbitrarily named safetensors folders.++The shared sdnq_sd_loader supports sharded directories, so a VAE whose SDNQ weight and its scale are+split across standard shard files must still be detected as SDNQ (and routed to _load_sdnq_vae),+not fall through to the generic diffusers loader which cannot reconstruct SDNQTensor values.+"""++import json+from pathlib import Path++import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.load.model_loaders.vae import _is_sdnq_vae_folder+++def test_detects_sdnq_across_two_shards_without_marker(tmp_path: Path):+ # weight in shard 1, its scale in shard 2 — a per-shard scan would miss the pair.+ save_file(+ {"decoder.conv_in.weight": torch.zeros(64, 32, dtype=torch.uint8)},+ str(tmp_path / "diffusion_pytorch_model-00001-of-00002.safetensors"),+ )+ save_file(+ {"decoder.conv_in.scale": torch.zeros(64, 1, dtype=torch.float32)},+ str(tmp_path / "diffusion_pytorch_model-00002-of-00002.safetensors"),+ )+ assert _is_sdnq_vae_folder(tmp_path)+++def test_detects_sdnq_via_quantization_config_marker(tmp_path: Path):+ (tmp_path / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}), encoding="utf-8")+ save_file(+ {"decoder.conv_in.weight": torch.zeros(64, 32, dtype=torch.uint8)},+ str(tmp_path / "diffusion_pytorch_model-00001-of-00003.safetensors"),+ )+ assert _is_sdnq_vae_folder(tmp_path)+++def test_plain_sharded_vae_is_not_detected_as_sdnq(tmp_path: Path):+ # No scale siblings and no marker -> not SDNQ.+ save_file(+ {"decoder.conv_in.weight": torch.zeros(64, 32, dtype=torch.float32)},+ str(tmp_path / "diffusion_pytorch_model-00001-of-00002.safetensors"),+ )+ save_file(+ {"decoder.conv_out.weight": torch.zeros(3, 32, dtype=torch.float32)},+ str(tmp_path / "diffusion_pytorch_model-00002-of-00002.safetensors"),+ )+ assert not _is_sdnq_vae_folder(tmp_path)diff --git a/tests/backend/quantization/sdnq/__init__.py b/tests/backend/quantization/sdnq/__init__.pynew file mode 100644index 0000000000..c076f8e442--- /dev/null+++ b/tests/backend/quantization/sdnq/__init__.py@@ -0,0 +1 @@+# Tests for SDNQ (SD.Next Quantization) supportdiff --git a/tests/backend/quantization/sdnq/test_sdnq_dequant_broadcast.py b/tests/backend/quantization/sdnq/test_sdnq_dequant_broadcast.pynew file mode 100644index 0000000000..d4f95f2767--- /dev/null+++ b/tests/backend/quantization/sdnq/test_sdnq_dequant_broadcast.py@@ -0,0 +1,70 @@+"""Tests that per-group dequantization accepts 2D scale/zero-point tensors.++SDNQ stores per-group scale/zero_point as either [out_features, num_groups, 1] or, without the+trailing singleton, [out_features, num_groups]. A 2D param must be normalized before arithmetic;+otherwise it right-aligns against the 3D grouped weight ([out, num_groups, group_size]) and fails+broadcasting.+"""++import torch++from invokeai.backend.quantization.sdnq.utils import dequantize_int5_per_group, dequantize_uint4_per_group+++def test_uint4_per_group_accepts_2d_scale_and_zero_point():+ out_features, in_features, group_size = 4, 8, 4+ num_groups = in_features // group_size # 2+ packed = torch.randint(0, 256, (out_features, in_features // 2), dtype=torch.uint8)+ scale_3d = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01+ zp_3d = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01++ expected = dequantize_uint4_per_group(+ packed, scale_3d, zp_3d, torch.Size([out_features, in_features]), group_size, dtype=torch.float32+ )+ got = dequantize_uint4_per_group(+ packed,+ scale_3d.squeeze(-1),+ zp_3d.squeeze(-1),+ torch.Size([out_features, in_features]),+ group_size,+ dtype=torch.float32,+ )++ assert got.shape == torch.Size([out_features, in_features])+ assert torch.equal(got, expected)+++def test_int5_per_group_accepts_2d_scale_and_zero_point():+ out_features, in_features, group_size = 2, 8, 4+ num_groups = in_features // group_size # 2+ # int5 packs 8 values into 5 bytes: [out, 8] -> packed last dim 5.+ packed = torch.randint(0, 256, (out_features, 5), dtype=torch.uint8)+ scale_3d = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01+ zp_3d = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01++ expected = dequantize_int5_per_group(+ packed, scale_3d, zp_3d, torch.Size([out_features, in_features]), group_size, dtype=torch.float32+ )+ got = dequantize_int5_per_group(+ packed,+ scale_3d.squeeze(-1),+ zp_3d.squeeze(-1),+ torch.Size([out_features, in_features]),+ group_size,+ dtype=torch.float32,+ )++ assert got.shape == torch.Size([out_features, in_features])+ assert torch.equal(got, expected)+++def test_int5_per_group_2d_scale_without_zero_point():+ out_features, in_features, group_size = 2, 8, 4+ num_groups = in_features // group_size+ packed = torch.randint(0, 256, (out_features, 5), dtype=torch.uint8)+ scale_2d = torch.rand(out_features, num_groups, dtype=torch.float32) * 0.01++ got = dequantize_int5_per_group(+ packed, scale_2d, None, torch.Size([out_features, in_features]), group_size, dtype=torch.float32+ )+ assert got.shape == torch.Size([out_features, in_features])diff --git a/tests/backend/quantization/sdnq/test_sdnq_loader.py b/tests/backend/quantization/sdnq/test_sdnq_loader.pynew file mode 100644index 0000000000..a02816ce6a--- /dev/null+++ b/tests/backend/quantization/sdnq/test_sdnq_loader.py@@ -0,0 +1,254 @@+"""Integration tests for SDNQ state dict loader."""++from pathlib import Path++import pytest+import torch++from invokeai.backend.quantization.sdnq.loaders import (+ has_sdnq_keys,+ raise_on_incomplete_sdnq_load,+ sdnq_sd_loader,+)+from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+++class TestSDNQLoader:+ """Tests for SDNQ state dict loading."""++ @pytest.fixture+ def mock_sdnq_file(self, tmp_path: Path) -> Path:+ """Create a mock SDNQ safetensors file."""+ from safetensors.torch import save_file++ # Create mock quantized weights with scale+ tensors = {+ "layer1.weight": torch.randint(-128, 127, (256, 256), dtype=torch.int8),+ "layer1.scale": torch.tensor([0.01], dtype=torch.float32),+ "layer1.bias": torch.randn(256, dtype=torch.float32),+ "layer2.weight": torch.randint(-128, 127, (128, 256), dtype=torch.int8),+ "layer2.scale": torch.tensor([0.02], dtype=torch.float32),+ "layer2.zero_point": torch.tensor([0.5], dtype=torch.float32),+ "norm.weight": torch.randn(256, dtype=torch.float32), # Not quantized+ }++ file_path = tmp_path / "model.safetensors"+ save_file(tensors, str(file_path))+ return file_path++ @pytest.fixture+ def mock_sdnq_file_with_svd(self, tmp_path: Path) -> Path:+ """Create a mock SDNQ safetensors file with SVD correction."""+ from safetensors.torch import save_file++ tensors = {+ "layer.weight": torch.randint(-128, 127, (64, 64), dtype=torch.int8),+ "layer.scale": torch.tensor([0.1], dtype=torch.float32),+ "layer.svd_up": torch.randn(64, 16, dtype=torch.float32),+ "layer.svd_down": torch.randn(16, 64, dtype=torch.float32),+ }++ file_path = tmp_path / "model_svd.safetensors"+ save_file(tensors, str(file_path))+ return file_path++ @pytest.fixture+ def mock_non_sdnq_file(self, tmp_path: Path) -> Path:+ """Create a mock non-SDNQ safetensors file (no scale keys)."""+ from safetensors.torch import save_file++ tensors = {+ "layer.weight": torch.randn(256, 256, dtype=torch.float32),+ "layer.bias": torch.randn(256, dtype=torch.float32),+ }++ file_path = tmp_path / "model_regular.safetensors"+ save_file(tensors, str(file_path))+ return file_path++ def test_load_sdnq_file(self, mock_sdnq_file: Path):+ """Test loading an SDNQ quantized file."""+ sd = sdnq_sd_loader(mock_sdnq_file)++ # Check that quantized weights are wrapped in SDNQTensor+ assert "layer1.weight" in sd+ assert isinstance(sd["layer1.weight"], SDNQTensor)+ assert "layer2.weight" in sd+ assert isinstance(sd["layer2.weight"], SDNQTensor)++ # Check that non-quantized tensors are regular tensors+ assert "layer1.bias" in sd+ assert isinstance(sd["layer1.bias"], torch.Tensor)+ assert not isinstance(sd["layer1.bias"], SDNQTensor)++ assert "norm.weight" in sd+ assert isinstance(sd["norm.weight"], torch.Tensor)+ assert not isinstance(sd["norm.weight"], SDNQTensor)++ def test_symmetric_vs_asymmetric(self, mock_sdnq_file: Path):+ """Test that symmetric and asymmetric quantization is detected."""+ sd = sdnq_sd_loader(mock_sdnq_file)++ # layer1 is symmetric (no zero_point)+ layer1_weight = sd["layer1.weight"]+ assert isinstance(layer1_weight, SDNQTensor)+ assert not layer1_weight.is_asymmetric++ # layer2 is asymmetric (has zero_point)+ layer2_weight = sd["layer2.weight"]+ assert isinstance(layer2_weight, SDNQTensor)+ assert layer2_weight.is_asymmetric++ def test_svd_loading(self, mock_sdnq_file_with_svd: Path):+ """Test that SVD correction matrices are loaded."""+ sd = sdnq_sd_loader(mock_sdnq_file_with_svd)++ layer_weight = sd["layer.weight"]+ assert isinstance(layer_weight, SDNQTensor)+ assert layer_weight.has_svd++ def test_has_sdnq_keys_positive(self, mock_sdnq_file: Path):+ """Test has_sdnq_keys returns True for SDNQ files."""+ from safetensors.torch import load_file++ sd = load_file(str(mock_sdnq_file))+ assert has_sdnq_keys(sd)++ def test_has_sdnq_keys_negative(self, mock_non_sdnq_file: Path):+ """Test has_sdnq_keys returns False for non-SDNQ files."""+ from safetensors.torch import load_file++ sd = load_file(str(mock_non_sdnq_file))+ assert not has_sdnq_keys(sd)++ def test_compute_dtype_propagation(self, mock_sdnq_file: Path):+ """Test that compute_dtype is set correctly on SDNQTensor."""+ sd = sdnq_sd_loader(mock_sdnq_file, compute_dtype=torch.bfloat16)++ layer1_weight = sd["layer1.weight"]+ assert isinstance(layer1_weight, SDNQTensor)+ assert layer1_weight.compute_dtype == torch.bfloat16++ # Verify dequantization produces correct dtype+ dequantized = layer1_weight.get_dequantized_tensor()+ assert dequantized.dtype == torch.bfloat16++ def test_dequantization_produces_correct_shape(self, mock_sdnq_file: Path):+ """Test that dequantized tensors have correct shape."""+ sd = sdnq_sd_loader(mock_sdnq_file)++ layer1_weight = sd["layer1.weight"]+ assert isinstance(layer1_weight, SDNQTensor)+ assert layer1_weight.shape == torch.Size([256, 256])++ dequantized = layer1_weight.get_dequantized_tensor()+ assert dequantized.shape == torch.Size([256, 256])++ def test_scale_keys_not_in_output(self, mock_sdnq_file: Path):+ """Test that scale/zero_point keys are not in the output dict."""+ sd = sdnq_sd_loader(mock_sdnq_file)++ # Scale and zero_point should be absorbed into SDNQTensor+ assert "layer1.scale" not in sd+ assert "layer2.scale" not in sd+ assert "layer2.zero_point" not in sd++ def test_empty_directory_raises(self, tmp_path: Path):+ """Test that loading from empty directory raises ValueError."""+ with pytest.raises(ValueError, match="No safetensors files found"):+ sdnq_sd_loader(tmp_path)++ def test_uint4_group_size_from_scale_overrides_config(self, tmp_path: Path):+ """A uint4 tensor whose actual group size differs from the config value must dequantize.++ SDNQ dynamic-mixed models (e.g. FLUX.2 Klein 4B) quantize some layers with a group size+ that differs from the nominal ``group_size`` in quantization_config.json. Here the config+ advertises group_size=128, but the scale tensor has 4 groups over 256 in-features, i.e. a+ real group size of 64. The loader must trust the scale tensor's group dimension; otherwise+ ``num_groups = in_features // 128 = 2`` disagrees with scale.shape[1] == 4 and the per-group+ reshape/broadcast inside dequantize_uint4_per_group fails.+ """+ import json++ from safetensors.torch import save_file++ out_features = 32+ in_features = 256+ actual_group_size = 64+ num_groups = in_features // actual_group_size # 4++ # uint4 packs 2 values per byte -> packed last dim is in_features // 2.+ packed_weight = torch.randint(0, 256, (out_features, in_features // 2), dtype=torch.uint8)+ # Per-group scale/zero_point shaped [out_features, num_groups, 1] (64-wide groups).+ scale = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01+ zero_point = torch.rand(out_features, num_groups, 1, dtype=torch.float32) * 0.01++ model_dir = tmp_path / "mixed_group_model"+ model_dir.mkdir()+ save_file(+ {+ "layer.weight": packed_weight,+ "layer.scale": scale,+ "layer.zero_point": zero_point,+ },+ str(model_dir / "model.safetensors"),+ )+ # Config advertises group_size=128, which is WRONG for this 64-wide-group tensor.+ (model_dir / "quantization_config.json").write_text(+ json.dumps({"weights_dtype": "uint4", "group_size": 128}),+ encoding="utf-8",+ )++ sd = sdnq_sd_loader(model_dir)++ layer_weight = sd["layer.weight"]+ assert isinstance(layer_weight, SDNQTensor)+ # Group size must be derived from the scale tensor (256 / 4 = 64), not the config's 128.+ assert layer_weight._group_size == actual_group_size++ # Dequantization must succeed and produce the original (unpacked) shape.+ dequantized = layer_weight.get_dequantized_tensor()+ assert dequantized.shape == torch.Size([out_features, in_features])+++class TestRaiseOnIncompleteSdnqLoad:+ """The SDNQ folder loaders build an empty model then load_state_dict(strict=False); this guard+ must turn a silently-incomplete load (a required parameter left on the meta device) into an+ explicit error naming the offending key."""++ def test_missing_required_transformer_weight_raises(self):+ """Removing a required weight from a folder load must raise, naming the missing key.++ Reproduces the loader pattern: build an empty (meta) model, load a state dict with one+ required key removed, then run the guard. Without the guard the model would be returned with+ that parameter still on the meta device and fail cryptically later.+ """+ import accelerate++ with accelerate.init_empty_weights():+ model = torch.nn.Linear(8, 8)++ full_sd = {"weight": torch.zeros(8, 8), "bias": torch.zeros(8)}+ partial_sd = {"weight": full_sd["weight"]} # drop the required "bias"++ missing, unexpected = model.load_state_dict(partial_sd, strict=False, assign=True)+ assert "bias" in missing++ with pytest.raises(ValueError, match="bias"):+ raise_on_incomplete_sdnq_load("SDNQ test transformer", missing, unexpected)++ def test_unexpected_key_raises(self):+ with pytest.raises(ValueError, match="not_a_real_param"):+ raise_on_incomplete_sdnq_load("SDNQ test", missing_keys=[], unexpected_keys=["not_a_real_param"])++ def test_allowed_missing_is_tolerated(self):+ # Tied/re-shared weights (e.g. T5 encoder.embed_tokens, Qwen3 lm_head) must not raise.+ raise_on_incomplete_sdnq_load(+ "SDNQ test",+ missing_keys=["encoder.embed_tokens.weight"],+ unexpected_keys=[],+ allowed_missing={"encoder.embed_tokens.weight"},+ )++ def test_complete_load_does_not_raise(self):+ raise_on_incomplete_sdnq_load("SDNQ test", missing_keys=[], unexpected_keys=[])diff --git a/tests/backend/quantization/sdnq/test_sdnq_tensor.py b/tests/backend/quantization/sdnq/test_sdnq_tensor.pynew file mode 100644index 0000000000..ee991498f9--- /dev/null+++ b/tests/backend/quantization/sdnq/test_sdnq_tensor.py@@ -0,0 +1,232 @@+"""Unit tests for SDNQTensor class."""++import torch++from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationType+++class TestSDNQTensor:+ """Tests for SDNQTensor dequantization and operations."""++ def test_symmetric_dequantization(self):+ """Test symmetric dequantization: result = weight * scale."""+ weight = torch.tensor([[1, 2], [3, 4]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([2, 2]),+ compute_dtype=torch.float32,+ scale=scale,+ )++ dequantized = tensor.get_dequantized_tensor()+ expected = torch.tensor([[0.1, 0.2], [0.3, 0.4]], dtype=torch.float32)+ assert torch.allclose(dequantized, expected, atol=1e-6)++ def test_asymmetric_dequantization(self):+ """Test asymmetric dequantization: result = zero_point + weight * scale.++ Matches the SDNQ upstream convention (Disty0/sdnq: torch.addcmul(zero_point, weight, scale)),+ where zero_point is a post-scale bias rather than a pre-scale integer offset.+ """+ weight = torch.tensor([[10, 20], [30, 40]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)+ zero_point = torch.tensor([5], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_ASYM,+ tensor_shape=torch.Size([2, 2]),+ compute_dtype=torch.float32,+ scale=scale,+ zero_point=zero_point,+ )++ dequantized = tensor.get_dequantized_tensor()+ # zero_point + weight * scale = 5 + [[10, 20], [30, 40]] * 0.1+ expected = torch.tensor([[6.0, 7.0], [8.0, 9.0]], dtype=torch.float32)+ assert torch.allclose(dequantized, expected, atol=1e-6)++ def test_svd_correction(self):+ """Test SVD correction: result = dequant + svd_up @ svd_down."""+ weight = torch.tensor([[0, 0], [0, 0]], dtype=torch.int8)+ scale = torch.tensor([1.0], dtype=torch.float32)+ svd_up = torch.tensor([[1.0], [2.0]], dtype=torch.float32)+ svd_down = torch.tensor([[1.0, 1.0]], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([2, 2]),+ compute_dtype=torch.float32,+ scale=scale,+ svd_up=svd_up,+ svd_down=svd_down,+ )++ assert tensor.has_svd+ dequantized = tensor.get_dequantized_tensor()+ # SVD correction: [[1], [2]] @ [[1, 1]] = [[1, 1], [2, 2]]+ expected = torch.tensor([[1.0, 1.0], [2.0, 2.0]], dtype=torch.float32)+ assert torch.allclose(dequantized, expected, atol=1e-6)++ def test_shape_properties(self):+ """Test tensor shape properties."""+ weight = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([2, 3]),+ compute_dtype=torch.float32,+ scale=scale,+ )++ assert tensor.shape == torch.Size([2, 3])+ assert tensor.size() == torch.Size([2, 3])+ assert tensor.size(0) == 2+ assert tensor.size(1) == 3+ assert tensor.quantized_shape == torch.Size([2, 3])++ def test_is_asymmetric_property(self):+ """Test is_asymmetric property."""+ weight = torch.tensor([[1]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ # Symmetric (no zero_point)+ tensor_sym = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([1, 1]),+ compute_dtype=torch.float32,+ scale=scale,+ )+ assert not tensor_sym.is_asymmetric++ # Asymmetric (has zero_point)+ tensor_asym = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_ASYM,+ tensor_shape=torch.Size([1, 1]),+ compute_dtype=torch.float32,+ scale=scale,+ zero_point=torch.tensor([0.0]),+ )+ assert tensor_asym.is_asymmetric++ def test_has_svd_property(self):+ """Test has_svd property."""+ weight = torch.tensor([[1]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ # No SVD+ tensor_no_svd = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([1, 1]),+ compute_dtype=torch.float32,+ scale=scale,+ )+ assert not tensor_no_svd.has_svd++ # With SVD+ tensor_with_svd = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([1, 1]),+ compute_dtype=torch.float32,+ scale=scale,+ svd_up=torch.tensor([[1.0]]),+ svd_down=torch.tensor([[1.0]]),+ )+ assert tensor_with_svd.has_svd++ def test_repr(self):+ """Test tensor string representation."""+ weight = torch.tensor([[1, 2], [3, 4]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([2, 2]),+ compute_dtype=torch.float32,+ scale=scale,+ )++ repr_str = repr(tensor)+ assert "SDNQTensor" in repr_str+ assert "int8_sym" in repr_str+ assert "has_svd=False" in repr_str++ def test_compute_dtype_bfloat16(self):+ """Test dequantization with bfloat16 compute dtype."""+ weight = torch.tensor([[1, 2], [3, 4]], dtype=torch.int8)+ scale = torch.tensor([0.5], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([2, 2]),+ compute_dtype=torch.bfloat16,+ scale=scale,+ )++ dequantized = tensor.get_dequantized_tensor()+ assert dequantized.dtype == torch.bfloat16++ def test_requires_grad_noop(self):+ """Test that requires_grad_ is a no-op for inference-only tensor."""+ weight = torch.tensor([[1]], dtype=torch.int8)+ scale = torch.tensor([0.1], dtype=torch.float32)++ tensor = SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size([1, 1]),+ compute_dtype=torch.float32,+ scale=scale,+ )++ # Should return self without error+ result = tensor.requires_grad_(True)+ assert result is tensor++ @staticmethod+ def _make_tensor(values: list[list[int]], scale_value: float) -> SDNQTensor:+ weight = torch.tensor(values, dtype=torch.int8)+ return SDNQTensor(+ data=weight,+ quantization_type=SDNQQuantizationType.INT8_SYM,+ tensor_shape=torch.Size(weight.shape),+ compute_dtype=torch.float32,+ scale=torch.tensor([scale_value], dtype=torch.float32),+ )++ def test_torch_cat_dequantizes_sequence_args(self):+ """torch.cat passes its tensors inside a list; the op must dequantize them instead of+ redispatching onto the SDNQTensors (which would recurse until RecursionError)."""+ a = self._make_tensor([[1, 2], [3, 4]], 0.1)+ b = self._make_tensor([[5, 6], [7, 8]], 0.2)++ result = torch.cat([a, b], dim=0)+ expected = torch.cat([a.get_dequantized_tensor(), b.get_dequantized_tensor()], dim=0)++ assert not isinstance(result, SDNQTensor)+ assert torch.allclose(result, expected, atol=1e-6)++ def test_torch_stack_dequantizes_sequence_args(self):+ """Same as cat, for torch.stack (also receives a list of tensors)."""+ a = self._make_tensor([[1, 2], [3, 4]], 0.1)+ b = self._make_tensor([[5, 6], [7, 8]], 0.2)++ result = torch.stack([a, b], dim=0)+ expected = torch.stack([a.get_dequantized_tensor(), b.get_dequantized_tensor()], dim=0)++ assert not isinstance(result, SDNQTensor)+ assert result.shape == torch.Size([2, 2, 2])+ assert torch.allclose(result, expected, atol=1e-6)diff --git a/tests/backend/quantization/sdnq/test_sdnq_tensor_device.py b/tests/backend/quantization/sdnq/test_sdnq_tensor_device.pynew file mode 100644index 0000000000..25aadd4875--- /dev/null+++ b/tests/backend/quantization/sdnq/test_sdnq_tensor_device.py@@ -0,0 +1,44 @@+"""Tests that moving an SDNQTensor to a device moves all of its payloads, not just quantized_data.++The model cache moves parameters with .to(target_device). If only quantized_data moved, a+"GPU-resident" SDNQ parameter would keep its scale / zero_point / svd tensors in system RAM,+forcing a host->device copy of all of them on every dequantization / inference step.+"""++import torch++from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationType++# Prefer a real cross-device move when CUDA is available; otherwise use the meta device, which still+# exercises the device-realignment logic without needing a GPU.+_TARGET = "cuda" if torch.cuda.is_available() else "meta"+++def _make_sdnq_tensor_with_svd() -> SDNQTensor:+ out_features, in_features, num_groups = 4, 8, 2+ return SDNQTensor(+ data=torch.randint(0, 256, (out_features, in_features // 2), dtype=torch.uint8),+ quantization_type=SDNQQuantizationType.UINT4_ASYM,+ tensor_shape=torch.Size([out_features, in_features]),+ compute_dtype=torch.bfloat16,+ scale=torch.rand(out_features, num_groups, 1, dtype=torch.float32),+ zero_point=torch.rand(out_features, num_groups, 1, dtype=torch.float32),+ svd_up=torch.rand(out_features, 2, dtype=torch.float32),+ svd_down=torch.rand(2, in_features, dtype=torch.float32),+ group_size=4,+ )+++def test_to_device_moves_scale_zero_point_and_svd():+ t = _make_sdnq_tensor_with_svd()+ assert t.quantized_data.device.type == "cpu"++ moved = t.to(torch.device(_TARGET))++ assert isinstance(moved, SDNQTensor)+ assert moved.quantized_data.device.type == _TARGET+ assert moved._scale.device.type == _TARGET+ assert moved._zero_point is not None and moved._zero_point.device.type == _TARGET+ assert moved._svd_up is not None and moved._svd_up.device.type == _TARGET+ assert moved._svd_down is not None and moved._svd_down.device.type == _TARGETdiff --git a/tests/backend/quantization/sdnq/test_sdnq_tensor_size.py b/tests/backend/quantization/sdnq/test_sdnq_tensor_size.pynew file mode 100644index 0000000000..c192766dc0--- /dev/null+++ b/tests/backend/quantization/sdnq/test_sdnq_tensor_size.py@@ -0,0 +1,63 @@+"""Tests that cache byte accounting reflects an SDNQTensor's real storage.++calc_tensor_size() must count the packed uint4/int5 data plus every auxiliary payload (scale,+zero_point, svd), not the wrapper's advertised dequantized shape with a uint8 dtype (which+over-counts packed weights and omits the auxiliary tensors).+"""++import torch++from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor+from invokeai.backend.quantization.sdnq.utils import SDNQQuantizationType+from invokeai.backend.util.calc_tensor_size import calc_tensor_size+++def _nbytes(*tensors: torch.Tensor) -> int:+ return sum(t.nelement() * t.element_size() for t in tensors)+++def test_uint4_with_svd_size_is_packed_plus_auxiliary():+ out_features, in_features, num_groups = 4, 8, 2+ data = torch.randint(0, 256, (out_features, in_features // 2), dtype=torch.uint8) # packed uint4+ scale = torch.rand(out_features, num_groups, 1, dtype=torch.float32)+ zero_point = torch.rand(out_features, num_groups, 1, dtype=torch.float32)+ svd_up = torch.rand(out_features, 2, dtype=torch.float32)+ svd_down = torch.rand(2, in_features, dtype=torch.float32)++ t = SDNQTensor(+ data=data,+ quantization_type=SDNQQuantizationType.UINT4_ASYM,+ tensor_shape=torch.Size([out_features, in_features]),+ compute_dtype=torch.bfloat16,+ scale=scale,+ zero_point=zero_point,+ svd_up=svd_up,+ svd_down=svd_down,+ group_size=4,+ )++ expected = _nbytes(data, scale, zero_point, svd_up, svd_down)+ assert t.sdnq_storage_nbytes() == expected+ assert calc_tensor_size(t) == expected+ # The naive accounting (dequantized shape × uint8) both over-counts and omits the aux payloads.+ assert calc_tensor_size(t) != t.nelement() * t.element_size()+++def test_int5_size_is_packed_plus_scale():+ out_features, in_features, num_groups = 2, 8, 2+ data = torch.randint(0, 256, (out_features, 5), dtype=torch.uint8) # 8 int5 values per 5 bytes+ scale = torch.rand(out_features, num_groups, 1, dtype=torch.float32)++ t = SDNQTensor(+ data=data,+ quantization_type=SDNQQuantizationType.INT5_ASYM,+ tensor_shape=torch.Size([out_features, in_features]),+ compute_dtype=torch.bfloat16,+ scale=scale,+ zero_point=None,+ group_size=4,+ )++ expected = _nbytes(data, scale)+ assert t.sdnq_storage_nbytes() == expected+ assert calc_tensor_size(t) == expecteddiff --git a/tests/backend/quantization/test_sdnq_detection.py b/tests/backend/quantization/test_sdnq_detection.pynew file mode 100644index 0000000000..c34ed9774c--- /dev/null+++ b/tests/backend/quantization/test_sdnq_detection.py@@ -0,0 +1,110 @@+"""Identification and loading must reach the same verdict about an SDNQ folder.++They consult the same directory, so a disagreement is not cosmetic: when identification calls a+markerless export "plain diffusers" and hands it to a diffusers config, the loader then runs+`from_pretrained()` over packed SDNQ weights and either fails or misreads them. This used to be four+near-identical implementations, only one of which looked past the `quantization_config.json` marker.+"""++import json+from pathlib import Path++import pytest+import torch+from safetensors.torch import save_file++from invokeai.backend.model_manager.configs.main import _is_sdnq_folder as configs_detect+from invokeai.backend.model_manager.configs.t5_encoder import _safetensors_dir_has_sdnq_keys+from invokeai.backend.model_manager.load.model_loaders.flux import _is_sdnq_folder as flux_detect+from invokeai.backend.model_manager.load.model_loaders.vae import _is_sdnq_vae_folder as vae_detect+from invokeai.backend.quantization.sdnq.detection import folder_has_sdnq_keys, is_sdnq_folder++# Every place that asks "is this SDNQ?" — they must not drift apart again.+ALL_DETECTORS = (is_sdnq_folder, configs_detect, flux_detect, vae_detect)+++def _write_marker(folder: Path, method: str = "sdnq") -> None:+ (folder / "quantization_config.json").write_text(json.dumps({"quant_method": method}), encoding="utf-8")+++def _sdnq_pair(folder: Path, *, sharded: bool) -> None:+ """An SDNQ weight and its scale, optionally split across shards as real exports do."""+ weight = {"blocks.0.attn.to_q.weight": torch.zeros(8, 4, dtype=torch.uint8)}+ scale = {"blocks.0.attn.to_q.scale": torch.zeros(8, 1, dtype=torch.float32)}+ if sharded:+ save_file(weight, str(folder / "model-00001-of-00002.safetensors"))+ save_file(scale, str(folder / "model-00002-of-00002.safetensors"))+ else:+ save_file({**weight, **scale}, str(folder / "model.safetensors"))++[email protected]("detect", ALL_DETECTORS)[email protected]("sharded", [False, True])+def test_every_detector_recognizes_a_markerless_export(tmp_path: Path, detect, sharded: bool) -> None:+ """The reviewer's case: valid SDNQ weights, no `quantization_config.json`."""+ folder = tmp_path / f"markerless-{sharded}-{detect.__name__}"+ folder.mkdir()+ (folder / "config.json").write_text(json.dumps({"_class_name": "FluxTransformer2DModel"}), encoding="utf-8")+ _sdnq_pair(folder, sharded=sharded)++ assert detect(folder) is True++[email protected]("detect", ALL_DETECTORS)+def test_every_detector_recognizes_the_marker_without_reading_weights(tmp_path: Path, detect) -> None:+ """The marker is definitive and free, so it must not depend on inspectable weights."""+ folder = tmp_path / f"marker-{detect.__name__}"+ folder.mkdir()+ _write_marker(folder)++ assert detect(folder) is True++[email protected]("detect", ALL_DETECTORS)+def test_no_detector_claims_a_plain_diffusers_folder(tmp_path: Path, detect) -> None:+ """Ordinary weights carry no `.scale` sibling; claiming them would break normal models."""+ folder = tmp_path / f"plain-{detect.__name__}"+ folder.mkdir()+ (folder / "config.json").write_text(json.dumps({"_class_name": "AutoencoderKL"}), encoding="utf-8")+ save_file({"encoder.conv_in.weight": torch.zeros(4, 4)}, str(folder / "model.safetensors"))++ assert detect(folder) is False++[email protected]("detect", ALL_DETECTORS)+def test_a_marker_naming_another_method_still_falls_through_to_the_keys(tmp_path: Path, detect) -> None:+ """A `quant_method` of something else is not evidence *against* SDNQ keys being present."""+ folder = tmp_path / f"othermarker-{detect.__name__}"+ folder.mkdir()+ _write_marker(folder, method="gguf")+ _sdnq_pair(folder, sharded=False)++ assert detect(folder) is True++[email protected]("detect", ALL_DETECTORS)+def test_an_empty_or_missing_folder_is_not_sdnq(tmp_path: Path, detect) -> None:+ empty = tmp_path / f"empty-{detect.__name__}"+ empty.mkdir()++ assert detect(empty) is False+ assert detect(tmp_path / "does-not-exist") is False+++def test_the_key_check_is_exposed_on_its_own_for_the_t5_config(tmp_path: Path) -> None:+ """`t5_encoder` needs the key half without the marker shortcut; it must be the same code."""+ folder = tmp_path / "t5"+ folder.mkdir()+ _sdnq_pair(folder, sharded=True)++ assert folder_has_sdnq_keys(folder) is True+ assert _safetensors_dir_has_sdnq_keys(folder) is True+++def test_a_non_safetensors_sdnq_file_is_not_claimed(tmp_path: Path) -> None:+ """`sdnq_sd_loader` reads only safetensors, so calling a `.bin` SDNQ would just move the failure."""+ folder = tmp_path / "binonly"+ folder.mkdir()+ (folder / "model.bin").write_bytes(b"\x00")++ assert is_sdnq_folder(folder) is Falsediff --git a/tests/backend/quantization/test_sdnq_diagnostics_and_eval_mode.py b/tests/backend/quantization/test_sdnq_diagnostics_and_eval_mode.pynew file mode 100644index 0000000000..0a5e9435b0--- /dev/null+++ b/tests/backend/quantization/test_sdnq_diagnostics_and_eval_mode.py@@ -0,0 +1,75 @@+"""SDNQ diagnostics must not cost anything when nobody is listening.++The uint4 diagnostic ran full-tensor reductions (and a `unique()` sort) on the first dequantization+of every model, and wrote to stdout — bypassing the app's log level, format and handlers. It is now+gated on the log level before computing anything, and bounded to a fixed-size sample.++Eval mode lives in `tests/backend/model_manager/load/test_load_default_helpers.py`: it applies to+every loader, not to SDNQ specifically.+"""++import logging++import pytest+import torch++from invokeai.backend.quantization.sdnq import utils as sdnq_utils++[email protected](autouse=True)+def _reset_diagnostic_flag():+ sdnq_utils._uint4_diagnostic_done = False+ yield+ sdnq_utils._uint4_diagnostic_done = False+++def _dequantize_uint4(out_features: int = 4, in_features: int = 64) -> torch.Tensor:+ """Run the uint4 per-group dequantization the diagnostic hangs off."""+ group_size = 32+ num_groups = in_features // group_size+ packed = torch.zeros(out_features, in_features // 2, dtype=torch.uint8) # 2 nibbles per byte+ scale = torch.ones(out_features, num_groups, 1, dtype=torch.float32)+ zero_point = torch.zeros(out_features, num_groups, 1, dtype=torch.float32)+ return sdnq_utils.dequantize_uint4_per_group(+ packed, scale, zero_point, (out_features, in_features), group_size, torch.float32+ )+++def test_the_uint4_diagnostic_writes_nothing_to_stdout(capsys) -> None:+ """stdout bypasses the app's log level, format and handlers — nothing may go there."""+ sdnq_utils.logger.setLevel(logging.DEBUG)++ _dequantize_uint4()++ assert capsys.readouterr().out == ""+++def test_the_uint4_diagnostic_does_no_work_when_debug_logging_is_off(monkeypatch: pytest.MonkeyPatch) -> None:+ """The figures cost more than the dequantization they describe, so they must be level-gated."""+ emitted: list[str] = []+ monkeypatch.setattr(sdnq_utils.logger, "isEnabledFor", lambda level: False)+ monkeypatch.setattr(sdnq_utils.logger, "debug", lambda *a, **k: emitted.append("debug"))++ _dequantize_uint4()++ assert emitted == []+ # The one-shot flag must stay unset, so the diagnostic is still available once debug is turned on.+ assert sdnq_utils._uint4_diagnostic_done is False+++def test_the_uint4_diagnostic_runs_once_and_is_bounded_by_a_fixed_sample(monkeypatch: pytest.MonkeyPatch) -> None:+ """Even with debug on, the diagnostic must not scale with the weight, and must not repeat."""+ assert sdnq_utils._DIAGNOSTIC_SAMPLE_SIZE <= 4096++ emitted: list[tuple] = []+ monkeypatch.setattr(sdnq_utils.logger, "isEnabledFor", lambda level: True)+ monkeypatch.setattr(sdnq_utils.logger, "debug", lambda *a, **k: emitted.append(a))++ big = _dequantize_uint4(out_features=64, in_features=1024)+ _dequantize_uint4(out_features=64, in_features=1024)++ assert len(emitted) == 1, "the diagnostic is one-shot"+ # Every reported element count is the bounded sample, never the tensor's own size.+ reported_counts = [arg for arg in emitted[0] if isinstance(arg, int)]+ assert big.numel() not in reported_counts+ assert sdnq_utils._DIAGNOSTIC_SAMPLE_SIZE in reported_counts