invoke-ai/InvokeAI · error · RuntimeError

Failed to load Qwen VL architecture config. Single-file Qwen

Error message

Failed to load Qwen VL architecture config. Single-file Qwen VL encoder checkpoints do not include the model config; it must be downloaded from HuggingFace (Qwen/Qwen2.5-VL-7B-Instruct) on first use. Either restore network access, or install the encoder in the diffusers folder layout (text_encoder/config.json + tokenizer/) instead. Original error: {e}

What it means

Like the tokenizer, the model architecture config (config.json) is not embedded in a single-file Qwen VL encoder checkpoint. InvokeAI attempts AutoConfig.from_pretrained('Qwen/Qwen2.5-VL-7B-Instruct') and, on OSError (offline/unreachable hub), raises this RuntimeError. The config defines the Qwen2.5-VL architecture needed to instantiate the encoder.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/qwen_image.py:429

        # Cast to compute dtype (skip integer/index tensors)
        for k in list(sd.keys()):
            if sd[k].is_floating_point():
                sd[k] = sd[k].to(model_dtype)

        # Fetch the architecture config from HuggingFace (small, ~5KB).
        # Offline fallback: tries cache first, downloads only if missing.
        try:
            qwen_config = AutoConfig.from_pretrained(self.DEFAULT_HF_REPO, local_files_only=True)
        except OSError:
            logger.info(
                f"Architecture config for single-file Qwen VL encoder not found in HuggingFace cache; "
                f"downloading from {self.DEFAULT_HF_REPO} (one-time, ~5KB, requires network access)."
            )
            try:
                qwen_config = AutoConfig.from_pretrained(self.DEFAULT_HF_REPO)
            except OSError as e:
                raise RuntimeError(
                    f"Failed to load Qwen VL architecture config. Single-file Qwen VL encoder checkpoints "
                    f"do not include the model config; it must be downloaded from HuggingFace "
                    f"({self.DEFAULT_HF_REPO}) on first use. Either restore network access, or install the "
                    f"encoder in the diffusers folder layout (text_encoder/config.json + tokenizer/) "
                    f"instead. Original error: {e}"
                ) from e
        qwen_config.torch_dtype = model_dtype

        new_sd_size = sum(t.nelement() * t.element_size() for t in sd.values())
        self._ram_cache.make_room(new_sd_size)

        with accelerate.init_empty_weights():
            model = Qwen2_5_VLForConditionalGeneration(qwen_config)

        # Load weights; allow missing keys for tied lm_head and re-initialised buffers.
        load_result = model.load_state_dict(sd, strict=False, assign=True)
        if load_result.unexpected_keys:
            logger.warning(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Restore network access (or configure proxy / unset HF_HUB_OFFLINE) so AutoConfig.from_pretrained('Qwen/Qwen2.5-VL-7B-Instruct') can download the ~5KB config once.
  2. Install the encoder in diffusers folder layout (text_encoder/config.json + tokenizer/) so the config is local.
  3. Copy a valid config.json for Qwen2.5-VL into the local HF cache and retry.

Example fix

// before: single_file_qwen.safetensors alone -> RuntimeError
// after: diffusers layout with local config
models/qwen_image/
  text_encoder/
    model.safetensors
    config.json
  tokenizer/
Defensive patterns

Strategy: try-catch

Validate before calling

from huggingface_hub import hf_hub_download
try:
    cfg_path = hf_hub_download("Qwen/Qwen2.5-VL-7B-Instruct", "config.json", local_files_only=True)
except Exception:
    logger.warning("Qwen VL config not cached and network unavailable")

Try / catch

try:
    enc = loader.load_model(config, submodel_type=SubModelType.TextEncoder)
except RuntimeError as e:
    if "architecture config" in str(e):
        logger.error("Pre-download Qwen config.json or use diffusers layout: %s", e)
    raise

Prevention

When it happens

Trigger: Loading a single-file Qwen VL encoder with submodel_type=TextEncoder while the architecture config is not in the HF cache and huggingface.co cannot be reached.

Common situations: First use of a single-file Qwen VL encoder on an offline machine; corporate proxy or DNS failure blocking HF; corrupted or pruned HF cache missing the config.json.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/6f50e03bcf872008. Report an issue: GitHub.