{"record":{"id":"5187245e25e6196c","repo":"invoke-ai/InvokeAI","slug":"to-extract-the-vae-and-qwen3-vl-encoder-the-mode","errorCode":null,"errorMessage":"To extract the VAE and Qwen3-VL encoder, the {model_name} model must be in Diffusers format. The selected model '{config.name}' is in {config.format.value} format — provide a standalone VAE and Qwen3-VL Encoder instead.","messagePattern":"To extract the VAE and Qwen3-VL encoder, the (.+?) model must be in Diffusers format\\. The selected model '(.+?)' is in (.+?) format — provide a standalone VAE and Qwen3-VL Encoder instead\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/krea2_model_loader.py","lineNumber":124,"sourceCode":"            text_encoder = self.qwen3_vl_encoder_model.model_copy(update={\"submodel_type\": SubModelType.TextEncoder})\n        else:\n            self._validate_diffusers_format(context, self.model, \"Krea-2\")\n            tokenizer = self.model.model_copy(update={\"submodel_type\": SubModelType.Tokenizer})\n            text_encoder = self.model.model_copy(update={\"submodel_type\": SubModelType.TextEncoder})\n\n        return Krea2ModelLoaderOutput(\n            transformer=TransformerField(transformer=transformer, loras=[]),\n            qwen3_vl_encoder=Qwen3VLEncoderField(tokenizer=tokenizer, text_encoder=text_encoder, loras=[]),\n            vae=VAEField(vae=vae),\n        )\n\n    def _validate_diffusers_format(\n        self, context: InvocationContext, model: ModelIdentifierField, model_name: str\n    ) -> None:\n        \"\"\"Validate that a model is in Diffusers format (required to extract VAE / encoder submodels).\"\"\"\n        config = context.models.get_config(model)\n        if config.format != ModelFormat.Diffusers:\n            raise ValueError(\n                f\"To extract the VAE and Qwen3-VL encoder, the {model_name} model must be in Diffusers format. \"\n                f\"The selected model '{config.name}' is in {config.format.value} format — provide a standalone \"\n                \"VAE and Qwen3-VL Encoder instead.\"\n            )\n","sourceCodeStart":106,"sourceCodeEnd":129,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/krea2_model_loader.py#L106-L129","documentation":"When no standalone VAE or Qwen3-VL encoder is provided, Krea2ModelLoader extracts them as submodels of the main model, which only works if the main model is stored in Diffusers format. Single-file/checkpoint formats cannot yield these submodels, so _validate_diffusers_format raises this ValueError.","triggerScenarios":"Calling invoke() (via _validate_diffusers_format) with vae_model unset and/or qwen3_vl_encoder_model unset while the main model config.format is not ModelFormat.Diffusers (e.g. a single-file safetensors/checkpoint Krea-2 model).","commonSituations":"Using a single-file Krea-2 checkpoint download without converting to Diffusers layout; users who downloaded compact checkpoint versions instead of full Diffusers repos; older installed models predating Diffusers-format import.","solutions":["Provide standalone VAE and Qwen3-VL encoder models in the vae_model and qwen3_vl_encoder_model fields.","Convert the main model to Diffusers format (re-import from a full Diffusers repo or use the model manager's convert action) and keep submodel extraction.","Download the Diffusers-format variant of the Krea-2 model and install it in place of the checkpoint."],"exampleFix":"// before\nKrea2ModelLoader(model=krea2_single_file_checkpoint)  # no vae/encoder given\n// after\nKrea2ModelLoader(model=krea2_single_file_checkpoint, vae_model=qwen_image_vae, qwen3_vl_encoder_model=qwen3_vl_encoder)","handlingStrategy":"validation","validationCode":"main_cfg = context.models.get_config(model_field)\nneeds_extraction = vae_field is None or encoder_field is None\nif needs_extraction and main_cfg.format is not ModelFormat.Diffusers:\n    raise ValueError(f\"{main_cfg.name} must be Diffusers format to extract VAE/encoder\")","typeGuard":"from invokeai.backend.model_manager.config import ModelFormat\n\ndef supports_submodel_extraction(cfg) -> bool:\n    return cfg.format is ModelFormat.Diffusers","tryCatchPattern":"try:\n    output = loader.invoke(context)\nexcept ValueError as e:\n    if \"must be in Diffusers format\" in str(e):\n        output = loader.model_copy(update={\n            \"vae_model\": default_qwen_vae,\n            \"qwen3_vl_encoder_model\": default_qwen3vl_encoder,\n        }).invoke(context)\n    else:\n        raise","preventionTips":["Install Krea-2 models in Diffusers format so submodel extraction always works","Keep standalone VAE and Qwen3-VL encoder models registered as fallbacks","Check config.format before omitting vae_model/encoder fields in generated workflows"],"tags":["invokeai","model-format","diffusers","model-loading"],"backgroundTag":"unsupported-model-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}