invoke-ai/InvokeAI · error · NotAMatchError
could not determine Wan variant from state dict
Error message
could not determine Wan variant from state dict
What it means
Raised when neither an explicit 'variant' override nor _detect_wan_variant_from_state_dict can classify the Wan GGUF's architecture into a known WanVariantType (T2V_A14B, I2V_A14B, TI2V_5B). The file passed all Wan sanity checks but its tensor shapes don't map to any supported variant.
Source
Thrown at invokeai/backend/model_manager/configs/main.py:2227
unsupported_reason = _find_unsupported_wan_variant_marker(sd)
if unsupported_reason is not None:
raise NotAMatchError(unsupported_reason)
gguf_name = mod.metadata().get("general.name", "")
normalized_identity = "".join(
character for character in f"{mod.path.stem} {gguf_name}".lower() if character.isalnum()
)
if "wan21" in normalized_identity:
raise NotAMatchError("Wan 2.1 GGUF models are not supported by the Wan 2.2 loader")
# A misnamed Wan 2.1 GGUF slips past the name check above; the architectural
# markers don't care what the file is called.
wan_2_1_reason = _find_wan_2_1_marker(sd)
if wan_2_1_reason is not None:
raise NotAMatchError(f"Wan 2.1 GGUF models are not supported by the Wan 2.2 loader: {wan_2_1_reason}")
explicit_variant = override_fields.pop("variant", None)
variant = explicit_variant or _detect_wan_variant_from_state_dict(sd)
if variant is None:
raise NotAMatchError("could not determine Wan variant from state dict")
if variant in (WanVariantType.T2V_A14B, WanVariantType.I2V_A14B) and "wan22" not in normalized_identity:
raise NotAMatchError("Wan A14B GGUF filename or metadata must identify the model as Wan 2.2")
expert = _resolve_wan_expert(mod, override_fields, variant)
return cls(**override_fields, variant=variant, expert=expert)
class Main_Checkpoint_Wan_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):
"""Model config for single-file Wan 2.2 transformer checkpoints (safetensors).
This is the format the community ships on CivitAI and in ComfyUI-oriented
Hugging Face repos: one ``.safetensors`` per transformer, in either the native
upstream key layout or the diffusers one, optionally under a
``model.diffusion_model.`` prefix, and optionally ComfyUI ``fp8_scaled``
quantized. The loader normalises all of those.
As with GGUF, A14B's MoE arrives as two files (one per expert); ``expert``View on GitHub (pinned to 0b6a024f2f)
Solutions
- Re-download the GGUF to rule out truncation, then re-run model scan
- Pass an explicit variant at import time (override the 'variant' field with T2V_A14B, I2V_A14B, or TI2V_5B) if you know the architecture
- Verify against the publisher's repo that the file is one of the supported variants; otherwise wait for InvokeAI support
Example fix
// before # import with no variant hint for an ambiguous wan gguf // after # POST a model record with an explicit variant override, or confirm the file # matches a known release like Wan2.2-TI2V-5B-Q8_0.gguf
Defensive patterns
Strategy: validation
Validate before calling
from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
from invokeai.backend.model_manager.configs.main import _detect_wan_variant_from_state_dict
variant = _detect_wan_variant_from_state_dict(ModelOnDisk(path).load_state_dict())
if variant is None:
print(f'{path.name}: no known Wan variant detected — re-download or supply a variant override') Try / catch
try:
import_model(path)
except NotAMatchError as e:
if 'could not determine Wan variant' in str(e):
import_model(path, variant='ti2v_5b') # pass the known variant explicitly
else:
raise Prevention
- Re-verify file integrity (size/hash) after downloads; truncated GGUFs lose shape info
- Only import published Wan variants (T2V-A14B, I2V-A14B, TI2V-5B)
- Supply a variant override for custom merges whose shapes are ambiguous
When it happens
Trigger: Importing an experimental or truncated Wan GGUF whose transformer dimensions are ambiguous; a heavily modified/distilled Wan build with nonstandard hidden sizes; a file corrupted mid-download so shape-bearing tensors are missing.
Common situations: Preview/beta Wan releases not matching any published config; incomplete HF downloads (download interrupted); custom merges.
Related errors
- state dict does not look like a Wan transformer
- state dict has no undecorated transformer block weights — it
- {unsupported_reason}
- Wan 2.1 GGUF models are not supported by the Wan 2.2 loader
- Wan 2.1 GGUF models are not supported by the Wan 2.2 loader:
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/9314f7d62829641f.
Report an issue: GitHub.