invoke-ai/InvokeAI · error · TypeError
Expected QwenVLEncoder_Checkpoint_Config, got {type(config).
Error message
Expected QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}. What it means
The checkpoint-format Qwen VL encoder loader only accepts QwenVLEncoder_Checkpoint_Config. Any other config type reaching its _load_model raises this TypeError naming the actual type, because its helpers load tokenizer/text-encoder weights from a single checkpoint file rather than a diffusers folder.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/qwen_image.py:347
@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.QwenVLEncoder, format=ModelFormat.Checkpoint)
class QwenVLEncoderCheckpointLoader(ModelLoader):
"""Loads a single-file Qwen2.5-VL encoder checkpoint (e.g. ComfyUI fp8_scaled).
The checkpoint bundles the language model and the visual tower into one
safetensors file. Tokenizer + processor are pulled from HuggingFace
(`Qwen/Qwen2.5-VL-7B-Instruct`) on first use, with offline cache fallback.
"""
DEFAULT_HF_REPO = "Qwen/Qwen2.5-VL-7B-Instruct"
def _load_model(
self,
config: AnyModelConfig,
submodel_type: Optional[SubModelType] = None,
) -> AnyModel:
if not isinstance(config, QwenVLEncoder_Checkpoint_Config):
raise TypeError(f"Expected QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}.")
match submodel_type:
case SubModelType.Tokenizer:
return self._load_tokenizer_with_offline_fallback()
case SubModelType.TextEncoder:
return self._load_text_encoder_from_singlefile(config)
raise ValueError(
f"Only Tokenizer and TextEncoder submodels are supported. "
f"Received: {submodel_type.value if submodel_type else 'None'}"
)
def _load_tokenizer_with_offline_fallback(self) -> AnyModel:
from transformers import AutoTokenizer
from invokeai.backend.util.logging import InvokeAILogger
logger = InvokeAILogger.get_logger(self.__class__.__name__)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Use QwenVLEncoder_Checkpoint_Config when calling this loader, with path pointing at the single checkpoint file.
- If the model is a diffusers folder, route it to the diffusers-registered QwenVLEncoder loader.
- Re-scan or edit the model record so format and config class agree with the on-disk layout.
Example fix
// before config = QwenVLEncoder_Diffusers_Config(path="encoder_dir/") enc = checkpoint_loader._load_model(config, SubModelType.TextEncoder) // after config = QwenVLEncoder_Checkpoint_Config(path="encoder.safetensors") enc = checkpoint_loader._load_model(config, SubModelType.TextEncoder)
Defensive patterns
Strategy: type-guard
Validate before calling
from invokeai.backend.model_manager.config import QwenVLEncoder_Checkpoint_Config
if not isinstance(config, QwenVLEncoder_Checkpoint_Config):
raise TypeError(f"Checkpoint QwenVL loader needs QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}") Type guard
def is_checkpoint_qwenvl_config(config: AnyModelConfig) -> bool:
return isinstance(config, QwenVLEncoder_Checkpoint_Config) Try / catch
try:
enc = loader._load_model(config, SubModelType.TextEncoder)
except TypeError as e:
if "QwenVLEncoder_Checkpoint_Config" in str(e):
enc = diffusers_qwenvl_loader._load_model(config, SubModelType.TextEncoder)
else:
raise Prevention
- Ensure checkpoint-format encoders use QwenVLEncoder_Checkpoint_Config
- Point the config path at the single checkpoint file, not a folder
- Keep format and config class consistent in model records
When it happens
Trigger: Passing a QwenVLEncoder_Diffusers_Config (or any other config) into the checkpoint-registered loader's _load_model, e.g. via a model record whose format says checkpoint but whose config is diffusers-derived.
Common situations: Model record format/config mismatch after import; diffusers-folder encoder incorrectly registered as checkpoint; scripts constructing the wrong config class.
Related errors
- Only CheckpointConfigBase models are currently supported her
- Expected QwenVLEncoder_Diffusers_Config, got {type(config)._
- Expected Main_GGUF_QwenImage_Config, got {type(config).__nam
- Expected Main_Checkpoint_QwenImage_Config, got {type(config)
- Only Tokenizer and TextEncoder submodels are supported. Rece
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/d6e5ff4d294eb90b.
Report an issue: GitHub.