{"record":{"id":"8d15de4e1bcf4755","repo":"invoke-ai/InvokeAI","slug":"source-has-len-unexpected-weights-that-wantra","errorCode":null,"errorMessage":"{source} has {len(unexpected)} weights that WanTransformer3DModel has nowhere to put (modules: {', '.join(modules[:8])}). This is a Wan variant with extra conditioning branches — Animate, S2V, Fun-Camera and similar — which InvokeAI cannot run faithfully; loading it anyway would silently ignore that conditioning.","messagePattern":"(.+?) has (.+?) weights that WanTransformer3DModel has nowhere to put \\(modules: (.+?)\\)\\. This is a Wan variant with extra conditioning branches — Animate, S2V, Fun-Camera and similar — which InvokeAI cannot run faithfully; loading it anyway would silently ignore that conditioning\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/wan.py","lineNumber":301,"sourceCode":"    correctly-shaped ``WanTransformer3DModel``, report zero missing keys, and then\n    generate with the entire branch they were built around silently absent.\n\n    ``configs.main._find_unsupported_wan_variant_marker`` turns away the families we\n    know by name; this is the generic backstop, so a derivative nobody has enumerated\n    yet produces an error instead of quietly degraded output.\n\n    Benign extras — bundled VAE/text-encoder weights and merged-LoRA residue — have\n    already been removed by ``_drop_benign_extra_keys``, so anything reaching here is\n    genuinely unplaceable.\n    \"\"\"\n    if incompatible_keys.missing_keys:\n        raise RuntimeError(f\"{source} is missing model parameters: {sorted(incompatible_keys.missing_keys)[:10]}\")\n\n    unexpected = [key for key in incompatible_keys.unexpected_keys if isinstance(key, str)]\n    if unexpected:\n        # Report the distinct top-level module names rather than hundreds of keys.\n        modules = sorted({key.split(\".\")[0] for key in unexpected})\n        raise RuntimeError(\n            f\"{source} has {len(unexpected)} weights that WanTransformer3DModel has nowhere to put \"\n            f\"(modules: {', '.join(modules[:8])}). This is a Wan variant with extra conditioning \"\n            \"branches — Animate, S2V, Fun-Camera and similar — which InvokeAI cannot run faithfully; \"\n            \"loading it anyway would silently ignore that conditioning.\"\n        )\n\n\ndef _tensor_shape(tensor: Any) -> tuple[int, ...]:\n    \"\"\"Logical shape of a tensor, unwrapping GGMLTensor's packed storage.\n\n    A GGMLTensor's ``.shape`` describes the packed quantized blob, not the weight,\n    so the logical dimensions live on ``.tensor_shape``.\n    \"\"\"\n    shape = tensor.tensor_shape if isinstance(tensor, GGMLTensor) else tensor.shape\n    return tuple(int(dim) for dim in shape)\n\n\ndef _build_wan_transformer_config(sd: dict, source: str) -> dict:","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/wan.py#L283-L319","documentation":"The checkpoint contains extra weights that the target WanTransformer3DModel has no parameters for, and they are not benign (bundled VAE/text-encoder or merged-LoRA residue). InvokeAI deliberately refuses to load, because silently dropping extra conditioning branches (Animate, S2V, Fun-Camera, etc.) would ignore conditioning the model was trained with.","triggerScenarios":"Loading a Wan Animate / S2V / Fun-Camera / Fun-Control variant checkpoint that contains additional conditioning branch modules not present in base WanTransformer3DModel, via the single-file checkpoint loader.","commonSituations":"Downloading a community Wan Animate or S2V combined checkpoint and importing it as a plain Wan checkpoint; using a checkpoint trained for a Wan variant InvokeAI does not yet support.","solutions":["Use a base Wan checkpoint (no extra conditioning branches) instead of the Animate/S2V/Fun variant.","Check InvokeAI release notes for supported Wan variants; upgrade if your variant is newly supported.","Extract only the base transformer weights from the combined checkpoint if the variant is truly incompatible.","Run the variant with the original toolchain (e.g., the official Wan repo) that implements those branches."],"exampleFix":"// before\nmodel_path = \"wan2.1_fun_camera_14b.safetensors\"  # extra conditioning branches\n\n// after\nmodel_path = \"wan2.1_t2v_14b.safetensors\"  # base variant InvokeAI supports","handlingStrategy":"validation","validationCode":"EXTRA_BRANCH_MODULES = {'control_adapter', 'pose_branch', 'camera_embedding', 'ref_conv'}  # example top-level names\nfrom safetensors import safe_open\n\ndef validate_no_extra_branches(path):\n    with safe_open(path, framework='pt') as f:\n        modules = {k.split('.')[0] for k in f.keys()}\n    extra = modules - KNOWN_WAN_MODULES\n    if extra:\n        raise ValueError(f\"{path} contains unsupported Wan variant modules: {sorted(extra)}\")","typeGuard":null,"tryCatchPattern":"try:\n    model = loader.load_model(config, SubModelType.Transformer)\nexcept RuntimeError as e:\n    if 'nowhere to put' in str(e):\n        raise UnsupportedWanVariant(str(e))  # surface to user; do not retry\n    raise","preventionTips":["Check checkpoint names/docs for Animate/S2V/Fun-Camera/Fun-Control markers before importing as base Wan.","Prefer base t2v/i2v Wan checkpoints in InvokeAI.","Track InvokeAI release notes for newly supported Wan variants.","Inspect top-level state-dict module names before registering unfamiliar checkpoints."],"tags":["state-dict","unsupported-model","wan","checkpoint"],"backgroundTag":"unexpected-state-dict-keys","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}