{"record":{"id":"6f50e03bcf872008","repo":"invoke-ai/InvokeAI","slug":"failed-to-load-qwen-vl-architecture-config-single","errorCode":null,"errorMessage":"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}","messagePattern":"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: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/qwen_image.py","lineNumber":429,"sourceCode":"\n        # Cast to compute dtype (skip integer/index tensors)\n        for k in list(sd.keys()):\n            if sd[k].is_floating_point():\n                sd[k] = sd[k].to(model_dtype)\n\n        # Fetch the architecture config from HuggingFace (small, ~5KB).\n        # Offline fallback: tries cache first, downloads only if missing.\n        try:\n            qwen_config = AutoConfig.from_pretrained(self.DEFAULT_HF_REPO, local_files_only=True)\n        except OSError:\n            logger.info(\n                f\"Architecture config for single-file Qwen VL encoder not found in HuggingFace cache; \"\n                f\"downloading from {self.DEFAULT_HF_REPO} (one-time, ~5KB, requires network access).\"\n            )\n            try:\n                qwen_config = AutoConfig.from_pretrained(self.DEFAULT_HF_REPO)\n            except OSError as e:\n                raise RuntimeError(\n                    f\"Failed to load Qwen VL architecture config. Single-file Qwen VL encoder checkpoints \"\n                    f\"do not include the model config; it must be downloaded from HuggingFace \"\n                    f\"({self.DEFAULT_HF_REPO}) on first use. Either restore network access, or install the \"\n                    f\"encoder in the diffusers folder layout (text_encoder/config.json + tokenizer/) \"\n                    f\"instead. Original error: {e}\"\n                ) from e\n        qwen_config.torch_dtype = model_dtype\n\n        new_sd_size = sum(t.nelement() * t.element_size() for t in sd.values())\n        self._ram_cache.make_room(new_sd_size)\n\n        with accelerate.init_empty_weights():\n            model = Qwen2_5_VLForConditionalGeneration(qwen_config)\n\n        # Load weights; allow missing keys for tied lm_head and re-initialised buffers.\n        load_result = model.load_state_dict(sd, strict=False, assign=True)\n        if load_result.unexpected_keys:\n            logger.warning(","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/qwen_image.py#L411-L447","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Install the encoder in diffusers folder layout (text_encoder/config.json + tokenizer/) so the config is local.","Copy a valid config.json for Qwen2.5-VL into the local HF cache and retry."],"exampleFix":"// before: single_file_qwen.safetensors alone -> RuntimeError\n// after: diffusers layout with local config\nmodels/qwen_image/\n  text_encoder/\n    model.safetensors\n    config.json\n  tokenizer/","handlingStrategy":"try-catch","validationCode":"from huggingface_hub import hf_hub_download\ntry:\n    cfg_path = hf_hub_download(\"Qwen/Qwen2.5-VL-7B-Instruct\", \"config.json\", local_files_only=True)\nexcept Exception:\n    logger.warning(\"Qwen VL config not cached and network unavailable\")","typeGuard":null,"tryCatchPattern":"try:\n    enc = loader.load_model(config, submodel_type=SubModelType.TextEncoder)\nexcept RuntimeError as e:\n    if \"architecture config\" in str(e):\n        logger.error(\"Pre-download Qwen config.json or use diffusers layout: %s\", e)\n    raise","preventionTips":["Pre-fetch config.json from Qwen/Qwen2.5-VL-7B-Instruct while online.","Keep text_encoder/config.json alongside the weights in diffusers folder layout.","Verify HF connectivity/proxy settings before bulk model loads."],"tags":["network","config","huggingface","offline","qwen"],"backgroundTag":"hf-model-download-failed","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}