{"record":{"id":"e07e789855e29e9e","repo":"invoke-ai/InvokeAI","slug":"transformer-is-sdnq-quantized-use-main-sdnq-diffu-e07e78","errorCode":null,"errorMessage":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_Flux2_Config","messagePattern":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_Flux2_Config","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":1032,"sourceCode":"                \"a loose transformer-only checkout cannot be used as a FLUX.2 main model\"\n            )\n\n        # Check for FLUX.2-specific pipeline class names\n        raise_for_class_name(\n            common_config_paths(mod.path),\n            {\n                \"Flux2KleinPipeline\",\n                \"Flux2Pipeline\",\n                \"Flux2Transformer2DModel\",\n            },\n        )\n\n        # Reject SDNQ-quantized pipelines so the SDNQ-specific config matches them instead.\n        # Without this both configs accept the same folder and identification can latch onto\n        # the wrong one (the plain diffusers loader would then mis-read packed uint8 weights\n        # as bf16 and crash with size-mismatch errors at first inference).\n        if (mod.path / \"transformer\").is_dir() and _is_sdnq_folder(mod.path / \"transformer\"):\n            raise NotAMatchError(\"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_Flux2_Config\")\n\n        variant = override_fields.pop(\"variant\", None) or cls._get_variant_or_raise(mod)\n\n        repo_variant = override_fields.pop(\"repo_variant\", None) or cls._get_repo_variant_or_raise(mod)\n\n        return cls(\n            **override_fields,\n            variant=variant,\n            repo_variant=repo_variant,\n        )\n\n    @classmethod\n    def _get_variant_or_raise(cls, mod: ModelOnDisk) -> Flux2VariantType:\n        \"\"\"Determine the FLUX.2 variant from the transformer config.\n\n        FLUX.2 variants are distinguished by joint_attention_dim (= 3 × text encoder hidden_size):\n        - Klein 4B/4B Base: 7680 (3 × Qwen3-4B 2560)\n        - Klein 9B/9B Base: 12288 (3 × Qwen3-8B 4096)","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L1014-L1050","documentation":"The FLUX.2 diffusers config raises NotAMatchError when the pipeline's `transformer/` folder is SDNQ-quantized, so that Main_SDNQ_Diffusers_Flux2_Config claims the model instead. Without this guard both configs would accept the same folder and identification could latch onto the wrong one; the plain diffusers loader would then misread packed uint8 weights as bf16 and crash with size-mismatch errors at first inference.","triggerScenarios":"Identifying a FLUX.2 pipeline folder where `mod.path/transformer` is a directory containing SDNQ quantization markers, via the model-manager scan/install path that calls from_model_on_disk.","commonSituations":"Auto-registration of an SDNQ-quantized FLUX.2 download; normally invisible to users except as correct SDNQ classification. Becomes a real problem only if the SDNQ FLUX.2 config is missing (older InvokeAI version) and the model then fails to register.","solutions":["Nothing to fix: this steer makes the SDNQ-specific FLUX.2 config match instead.","If registration ultimately fails, upgrade InvokeAI so Main_SDNQ_Diffusers_Flux2_Config is available.","To use plain diffusers loading, obtain the non-quantized (bf16) FLUX.2 weights."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef is_sdnq_flux2(folder: Path) -> bool:\n    t = folder / \"transformer\"\n    return t.is_dir() and ((t / \"quantization_config.json\").exists() or any(t.glob(\"*.sdnq\")))\n\nif is_sdnq_flux2(Path(model_dir)):\n    expect_config = \"Main_SDNQ_Diffusers_Flux2_Config\"","typeGuard":"def is_sdnq_transformer(folder: Path) -> bool:\n    return folder.is_dir() and (folder / \"quantization_config.json\").is_file()","tryCatchPattern":"try:\n    cfg = Main_Diffusers_Flux2_Config.from_model_on_disk(mod)\nexcept NotAMatchError:\n    cfg = Main_SDNQ_Diffusers_Flux2_Config.from_model_on_disk(mod)","preventionTips":["Ensure your InvokeAI version ships Main_SDNQ_Diffusers_Flux2_Config before importing SDNQ FLUX.2 models.","Keep the pipeline folder complete so identification can route to the SDNQ config.","Prefer official quantized releases matched to your InvokeAI version."],"tags":["model-identification","quantization","sdnq","flux2"],"backgroundTag":"quantized-model-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}