{"record":{"id":"60da155eeeaf7213","repo":"invoke-ai/InvokeAI","slug":"only-transformer-submodels-are-supported-for-check","errorCode":null,"errorMessage":"Only Transformer submodels are supported for checkpoint format. Received: {submodel_type}","messagePattern":"Only Transformer submodels are supported for checkpoint format\\. Received: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/flux.py","lineNumber":1586,"sourceCode":"@ModelLoaderRegistry.register(base=BaseModelType.Flux, type=ModelType.Main, format=ModelFormat.SDNQQuantized)\nclass FluxSDNQDiffusersModel(ModelLoader):\n    \"\"\"Class to load SDNQ-quantized Flux models in diffusers format.\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        logger.debug(\n            \"[SDNQ] FluxSDNQDiffusersModel._load_model called with config=%s, submodel=%s\",\n            type(config).__name__,\n            submodel_type,\n        )\n        # Handle single-file SDNQ checkpoint (Main_SDNQ_FLUX_Config)\n        if isinstance(config, Main_SDNQ_FLUX_Config):\n            if submodel_type == SubModelType.Transformer:\n                return self._load_sdnq_transformer_checkpoint(config)\n            raise ValueError(\n                f\"Only Transformer submodels are supported for checkpoint format. Received: {submodel_type}\"\n            )\n\n        # Handle diffusers-format SDNQ model (Main_SDNQ_Diffusers_FLUX_Config)\n        if not isinstance(config, Main_SDNQ_Diffusers_FLUX_Config):\n            raise ValueError(f\"Expected Main_SDNQ_Diffusers_FLUX_Config, got {type(config).__name__}\")\n\n        if submodel_type is None:\n            raise ValueError(\"A submodel type must be provided when loading main pipelines.\")\n\n        # Prefer the path discovery actually found. `model_index.json` names its components with\n        # arbitrary keys, and identification records the key it saw — but reconstructing\n        # `model_path / submodel_type.value` here assumes the key always equals the slot name. A\n        # pipeline whose index calls its CLIP encoder something else is then discovered fine and\n        # loaded from a folder that does not exist. Fall back to the conventional name when a config\n        # predates submodel discovery.\n        model_path = Path(config.path)\n        submodel_path = resolve_submodel_path(config, submodel_type, model_path / submodel_type.value)","sourceCodeStart":1568,"sourceCodeEnd":1604,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/flux.py#L1568-L1604","documentation":"SDNQ FLUX checkpoints in single-file format only contain transformer weights, so the loader supports SubModelType.Transformer exclusively for Main_SDNQ_FLUX_Config. Requesting any other submodel (VAE, tokenizer, text encoder) from this checkpoint raises ValueError listing the received submodel type.","triggerScenarios":"Loading submodels of an SDNQ single-file FLUX main model: e.g. pipeline assembly requesting SubModelType.Vae or TextEncoder from Main_SDNQ_FLUX_Config instead of the transformer.","commonSituations":"A diffusers-style folder layout missing sibling components, so the pipeline tries to pull every component from the single-file checkpoint; custom orchestration code calling load_model with the wrong submodel_type.","solutions":["Load VAE/tokenizers/text encoders from the separate companion components registered alongside the SDNQ checkpoint, not from the checkpoint itself.","Pass SubModelType.Transformer when loading from Main_SDNQ_FLUX_Config.","Re-import the model so all auxiliary components (VAE, text encoders) are registered as their own models."],"exampleFix":"// before\nvae = loader.load_model(sdnq_config, SubModelType.Vae)  # raises\n// after\ntransformer = loader.load_model(sdnq_config, SubModelType.Transformer)\nvae = loader.load_model(separate_vae_config, SubModelType.Vae)","handlingStrategy":"validation","validationCode":"if isinstance(config, Main_SDNQ_FLUX_Config) and submodel_type != SubModelType.Transformer:\n    raise RuntimeError(\"SDNQ single-file checkpoints only provide the transformer; load other components separately\")","typeGuard":"def sdnq_singlefile_supports(config, submodel_type) -> bool:\n    return not isinstance(config, Main_SDNQ_FLUX_Config) or submodel_type == SubModelType.Transformer","tryCatchPattern":"try:\n    model = loader.load_model(config, submodel_type)\nexcept ValueError as e:\n    if \"Only Transformer submodels\" in str(e):\n        raise RuntimeError(\"Fetch VAE/text encoders from their companion models, not the SDNQ checkpoint\") from e\n    raise","preventionTips":["Register VAE and text encoders as standalone models alongside SDNQ checkpoints","Remember single-file formats only bundle transformer weights","Check config class before deciding where to load each submodel from"],"tags":["submodel","sdnq","flux"],"backgroundTag":"unsupported-submodel","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}