{"record":{"id":"3f4d7f72d64dba2f","repo":"invoke-ai/InvokeAI","slug":"only-qwen3encoder-checkpoint-config-models-are-sup","errorCode":null,"errorMessage":"Only Qwen3Encoder_Checkpoint_Config models are supported here.","messagePattern":"Only Qwen3Encoder_Checkpoint_Config models are supported here\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/z_image.py","lineNumber":913,"sourceCode":"            import torch.nn as nn\n\n            model.x_pad_token = nn.Parameter(torch.empty(dim))\n            nn.init.normal_(model.x_pad_token, std=0.02)\n\n        return model\n\n\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.Checkpoint)\nclass Qwen3EncoderCheckpointLoader(ModelLoader):\n    \"\"\"Class to load single-file Qwen3 Encoder models for Z-Image (safetensors format).\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, Qwen3Encoder_Checkpoint_Config):\n            raise ValueError(\"Only Qwen3Encoder_Checkpoint_Config models are supported here.\")\n\n        match submodel_type:\n            case SubModelType.TextEncoder:\n                return self._load_from_singlefile(config)\n            case SubModelType.Tokenizer:\n                # Single-file checkpoints ship no tokenizer files; use the vendored copy.\n                return self._load_bundled_tokenizer()\n\n        raise ValueError(\n            f\"Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_type.value if submodel_type else 'None'}\"\n        )\n\n    def _load_bundled_tokenizer(self) -> AnyModel:\n        \"\"\"Load the Qwen3 tokenizer from the vendored, bundled copy.\n\n        Single-file / GGUF checkpoints do not ship tokenizer files. The Qwen3 BPE\n        tokenizer is identical across the 0.6B / 4B / 8B variants, so we load the\n        self-contained copy vendored in the package — fully offline, no HuggingFace","sourceCodeStart":895,"sourceCodeEnd":931,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/z_image.py#L895-L931","documentation":"The Z-Image single-file (Qwen3 text encoder) checkpoint loader requires the config to be exactly a Qwen3Encoder_Checkpoint_Config instance. Any other config type reaching this loader's _load_model cannot provide the single-file path/keys it needs, so it raises this ValueError as a guard at dispatch time.","triggerScenarios":"ZImageQwen3EncoderCheckpointModel._load_model is invoked with a config that is not Qwen3Encoder_Checkpoint_Config — e.g. a generic main-model config, a GGUF config routed to the checkpoint loader, or a raw dict/config for another loader family.","commonSituations":"Model registered as single-file checkpoint but its DB/yaml record was created under a different config class; a custom loader or script calls _load_model directly with a hand-built config; model format changed on disk without re-registration.","solutions":["Re-register the model so InvokeAI builds a Qwen3Encoder_Checkpoint_Config for it (single-file checkpoint format).","If the file is actually GGUF, route it to the GGUF loader (Qwen3Encoder_GGUF_Config) instead.","If calling programmatically, construct or cast the config as Qwen3Encoder_Checkpoint_Config before calling _load_model.","Check the model's format/type fields in the model manager UI or models.yaml and correct mismatches."],"exampleFix":"// before\nloader._load_model(generic_config, submodel_type=SubModelType.TextEncoder)\n// after\nassert isinstance(config, Qwen3Encoder_Checkpoint_Config), type(config)\nloader._load_model(config, submodel_type=SubModelType.TextEncoder)","handlingStrategy":"type-guard","validationCode":"if not isinstance(config, Qwen3Encoder_Checkpoint_Config):\n    raise TypeError(f\"Expected Qwen3Encoder_Checkpoint_Config, got {type(config).__name__}\")","typeGuard":"def is_qwen3_checkpoint_config(config: AnyModelConfig) -> bool:\n    return isinstance(config, Qwen3Encoder_Checkpoint_Config)","tryCatchPattern":"try:\n    model = loader._load_model(config, submodel_type)\nexcept ValueError as e:\n    if \"Qwen3Encoder_Checkpoint_Config\" in str(e):\n        config = model_manager.get_config(model_id)  # rebuild proper config\n        model = loader._load_model(config, submodel_type)\n    else:\n        raise","preventionTips":["Register single-file Qwen3 encoders with the checkpoint format so the right config class is built.","Route GGUF files to the GGUF loader, not this one.","Avoid hand-constructing configs for loader calls; use the model manager.","After format changes on disk, re-register the model."],"tags":["invokeai","z-image","qwen3","config-type-mismatch"],"backgroundTag":"model-config-type-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}