{"record":{"id":"fb2f97d340669177","repo":"invoke-ai/InvokeAI","slug":"transformer-is-sdnq-quantized-use-main-sdnq-diffu-fb2f97","errorCode":null,"errorMessage":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_ZImage_Config","messagePattern":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_ZImage_Config","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":1379,"sourceCode":"        raise_if_not_dir(mod)\n\n        raise_for_override_fields(cls, override_fields)\n\n        # This check implies the base type - no further validation needed.\n        raise_for_class_name(\n            common_config_paths(mod.path),\n            {\n                \"ZImagePipeline\",\n            },\n        )\n\n        # Reject SDNQ-quantized pipelines so Main_SDNQ_Diffusers_ZImage_Config matches them instead.\n        # Without this both configs accept the same ZImagePipeline folder and identification can\n        # latch onto the plain diffusers one (which would then mis-read packed uint8 weights as bf16\n        # and crash at inference). It also breaks the self-contained SDNQ path, since a pipeline\n        # mis-identified as plain diffusers would force the user to select separate VAE/Qwen3 sources.\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_ZImage_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) -> ZImageVariantType:\n        \"\"\"Determine Z-Image variant from the scheduler config.\n\n        Z-Image variants are distinguished by the scheduler shift value:\n        - Turbo (distilled): shift = 3.0\n        - Base (undistilled): shift = 6.0","sourceCodeStart":1361,"sourceCodeEnd":1397,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L1361-L1397","documentation":"The plain Z-Image diffusers config raises NotAMatchError when the pipeline's `transformer/` folder is SDNQ-quantized, deferring to Main_SDNQ_Diffusers_ZImage_Config. Without this guard, both configs accept the same ZImagePipeline folder and identification may pick the plain one, which would mis-read packed uint8 weights as bf16 and crash at inference, and would also break the self-contained SDNQ path by forcing users to select separate VAE/Qwen3 sources.","triggerScenarios":"Identifying a ZImagePipeline folder where `mod.path/transformer` is a directory detected as SDNQ-quantized by _is_sdnq_folder, via the scan/install path calling from_model_on_disk.","commonSituations":"Auto-registering an SDNQ-quantized Z-Image pipeline download; typically resolves as a correct SDNQ classification. Only surfaces as a problem if the SDNQ Z-Image config is absent (outdated InvokeAI).","solutions":["No action required — the error routes the model to Main_SDNQ_Diffusers_ZImage_Config.","If registration fails afterward, upgrade InvokeAI to a version that ships the SDNQ Z-Image config.","For plain diffusers loading, use non-quantized Z-Image weights."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef is_sdnq_zimage(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_zimage(Path(model_dir)):\n    expect_config = \"Main_SDNQ_Diffusers_ZImage_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_ZImage_Config.from_model_on_disk(mod)\nexcept NotAMatchError:\n    cfg = Main_SDNQ_Diffusers_ZImage_Config.from_model_on_disk(mod)","preventionTips":["Update InvokeAI so the SDNQ Z-Image config is registered before importing quantized pipelines.","Keep the whole ZImagePipeline folder (including VAE/Qwen3 components) intact.","Check transformer/quantization_config.json before choosing an import path."],"tags":["model-identification","quantization","sdnq","z-image"],"backgroundTag":"quantized-model-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}