{"record":{"id":"cf927adb5551ee48","repo":"invoke-ai/InvokeAI","slug":"state-dict-does-not-look-like-a-wan-transformer","errorCode":null,"errorMessage":"state dict does not look like a Wan transformer","messagePattern":"state dict does not look like a Wan transformer","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":2203,"sourceCode":"    format: Literal[ModelFormat.GGUFQuantized] = Field(default=ModelFormat.GGUFQuantized)\n    variant: WanVariantType = Field()\n    expert: Literal[\"high\", \"low\", \"none\"] = Field(\n        default=\"none\",\n        description=\"For Wan 2.2 A14B's dual-expert MoE: 'high' for the high-noise expert, \"\n        \"'low' for the low-noise expert. 'none' for single-transformer models (TI2V-5B).\",\n    )\n\n    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:\n        raise_if_not_file(mod)\n        raise_for_override_fields(cls, override_fields)\n\n        sd = mod.load_state_dict()\n\n        if not _has_ggml_tensors(sd):\n            raise NotAMatchError(\"state dict does not look like GGUF quantized\")\n        if not _has_wan_keys(sd):\n            raise NotAMatchError(\"state dict does not look like a Wan transformer\")\n        if not _has_wan_transformer_block_weights(sd):\n            raise NotAMatchError(\n                \"state dict has no undecorated transformer block weights — it looks like a Wan LoRA \"\n                \"or adapter rather than a full transformer\"\n            )\n        unsupported_reason = _find_unsupported_wan_variant_marker(sd)\n        if unsupported_reason is not None:\n            raise NotAMatchError(unsupported_reason)\n        gguf_name = mod.metadata().get(\"general.name\", \"\")\n        normalized_identity = \"\".join(\n            character for character in f\"{mod.path.stem} {gguf_name}\".lower() if character.isalnum()\n        )\n        if \"wan21\" in normalized_identity:\n            raise NotAMatchError(\"Wan 2.1 GGUF models are not supported by the Wan 2.2 loader\")\n        # A misnamed Wan 2.1 GGUF slips past the name check above; the architectural\n        # markers don't care what the file is called.\n        wan_2_1_reason = _find_wan_2_1_marker(sd)\n        if wan_2_1_reason is not None:","sourceCodeStart":2185,"sourceCodeEnd":2221,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L2185-L2221","documentation":"Raised by Main_GGUF_Wan_Config.from_model_on_disk when the state dict is GGUF-quantized (has GGMLTensors) but contains no keys matching Wan transformer architecture patterns (_has_wan_keys fails). The GGUF wrapper itself matched, so the file is a quantized model of some other architecture (FLUX, Qwen, SDXL, UMT5, VAE, etc.).","triggerScenarios":"Importing a non-Wan GGUF (e.g. FLUX.1-dev-Q4_K_M.gguf) into a scan folder where the Wan config is tried; importing a Wan text-encoder or VAE GGUF whose keys don't match transformer patterns; a Wan LoRA/CLIP GGUF routed to the main-model configs.","commonSituations":"Bulk-downloading mixed GGUF repos and dropping everything into InvokeAI's autoimport directory; confusing Wan transformer GGUFs with Wan UMT5-XXL text-encoder GGUFs.","solutions":["Verify the GGUF actually is a Wan 2.2 DiT transformer (filename/metadata like Wan2.2-I2V-A14B / TI2V-5B), not a text encoder, VAE, or another architecture","Move non-Wan GGUFs out of the Wan/autoimport path or import them with the correct model type (text encoder / VAE / etc.)","Re-download the file if it was mislabeled by the publisher"],"exampleFix":"// before\n# umt5-xxl-encoder-Q8_0.gguf dropped in autoimport as a main model\n// after\n# place the UMT5 GGUF with the text-encoder models and import as its proper type;\n# keep only Wan2.2-*.gguf DiT files for the Wan transformer loader","handlingStrategy":"validation","validationCode":"from invokeai.backend.model_manager.model_on_disk import ModelOnDisk\nfrom invokeai.backend.model_manager.configs.main import _has_ggml_tensors, _has_wan_keys\n\nsd = ModelOnDisk(path).load_state_dict()\nassert _has_ggml_tensors(sd), 'not GGUF'\nassert _has_wan_keys(sd), 'GGUF is not a Wan transformer — check what architecture this file actually is'","typeGuard":"def is_wan_gguf(sd: dict) -> bool:\n    return _has_ggml_tensors(sd) and _has_wan_keys(sd)","tryCatchPattern":"try:\n    import_model(path, model_type='main')\nexcept NotAMatchError as e:\n    if 'Wan transformer' in str(e):\n        print(f'{path.name} is not a Wan DiT; import it with its correct model type')\n    else:\n        raise","preventionTips":["Only place Wan transformer GGUFs in the main-model autoimport folder","Do not put Wan UMT5 text-encoder GGUFs or VAE GGUFs in the transformer folder","Check GGUF general.name metadata before importing from bulk downloads"],"tags":["model-manager","gguf","wan","model-identification"],"backgroundTag":"wrong-model-architecture-file","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}