{"record":{"id":"b3f2ee79a356f0b1","repo":"invoke-ai/InvokeAI","slug":"transformer-is-sdnq-quantized-use-main-sdnq-diffu","errorCode":null,"errorMessage":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_FLUX_Config","messagePattern":"transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_FLUX_Config","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":954,"sourceCode":"    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:\n        raise_if_not_dir(mod)\n\n        raise_for_override_fields(cls, override_fields)\n\n        # Check for FLUX-specific pipeline or transformer class names\n        raise_for_class_name(\n            common_config_paths(mod.path),\n            {\n                \"FluxPipeline\",\n                \"FluxFillPipeline\",\n                \"FluxTransformer2DModel\",\n            },\n        )\n\n        # Reject SDNQ-quantized pipelines so Main_SDNQ_Diffusers_FLUX_Config matches instead.\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_FLUX_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) -> FluxVariantType:\n        \"\"\"Determine the FLUX variant from the transformer config.\n\n        FLUX variants are distinguished by:\n        - in_channels: 64 for Dev/Schnell, 384 for DevFill\n        - guidance_embeds: True for Dev, False for Schnell","sourceCodeStart":936,"sourceCodeEnd":972,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L936-L972","documentation":"During model identification, Main_Diffusers_FLUX_Config.from_model_on_disk inspects the pipeline folder and raises NotAMatchError when the `transformer/` subfolder contains SDNQ-quantized weights. The plain diffusers FLUX config cannot load packed quantized weights correctly, so the folder must be classified by the dedicated Main_SDNQ_Diffusers_FLUX_Config instead. This is a deliberate guard that makes identification fall through to the correct config class rather than mis-registering the model.","triggerScenarios":"Registering/identifying a FLUX.1 diffusers pipeline where `mod.path/transformer` is a directory and `_is_sdnq_folder()` detects SDNQ quantization (e.g. quantization_config.json / packed uint8 weights) inside it, via ModelManager install/scan APIs that call from_model_on_disk.","commonSituations":"Downloading an SDNQ-quantized FLUX checkpoint from HuggingFace into a full pipeline folder and letting InvokeAI auto-identify it; the error is internal to identification, so users typically only see the model correctly classified as SDNQ afterward.","solutions":["Take no corrective action on your folder: this error is an internal control signal that makes the SDNQ config claim the model.","If you actually wanted non-quantized FLUX, re-download the original bf16/safetensors weights without SDNQ quantization.","If the model fails to register at all, verify the `transformer/` subfolder is a genuine SDNQ folder and that Main_SDNQ_Diffusers_FLUX_Config is present/registered in your InvokeAI version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef is_sdnq_flux_pipeline(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_flux_pipeline(Path(model_dir)):\n    expect_config = \"Main_SDNQ_Diffusers_FLUX_Config\"  # not Main_Diffusers_FLUX_Config","typeGuard":"def is_sdnq_transformer(folder: Path) -> bool:\n    return folder.is_dir() and (folder / \"quantization_config.json\").is_file()","tryCatchPattern":"from invokeai.backend.model_manager.configs.main import NotAMatchError\ntry:\n    cfg = Main_Diffusers_FLUX_Config.from_model_on_disk(mod)\nexcept NotAMatchError:\n    cfg = Main_SDNQ_Diffusers_FLUX_Config.from_model_on_disk(mod)","preventionTips":["Download the non-quantized FLUX weights if you intend plain diffusers loading.","Keep full pipeline folders intact so auto-identification can route to the SDNQ config.","Check for quantization_config.json in transformer/ before importing."],"tags":["model-identification","quantization","sdnq","flux"],"backgroundTag":"quantized-model-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}