invoke-ai/InvokeAI · warning · NotAMatchError
model looks like an Anima LoRA, not a Stable Diffusion LoRA
Error message
model looks like an Anima LoRA, not a Stable Diffusion LoRA
What it means
When detecting the base of a Stable Diffusion LoRA, `_get_base_or_raise` first rules out Anima LoRAs: their `lora_te_` text-encoder key shapes would make `lora_token_vector_length()` misreport the base as SD2/SDXL. If Cosmos-DiT Kohya or PEFT key patterns are found, the model is identified as an Anima LoRA and `NotAMatchError` is raised so the SD LoRA config classes reject it.
Source
Thrown at invokeai/backend/model_manager/configs/lora.py:651
)
if not has_key_with_lora_prefix and not has_key_with_lora_suffix:
raise NotAMatchError("model does not match LyCORIS LoRA heuristics")
@classmethod
def _get_base_or_raise(cls, mod: ModelOnDisk) -> BaseModelType:
if _get_flux_lora_format(mod):
if _is_flux2_lora(mod):
return BaseModelType.Flux2
return BaseModelType.Flux
state_dict = mod.load_state_dict()
str_keys = [k for k in state_dict.keys() if isinstance(k, str)]
# Rule out Anima LoRAs — their lora_te_ keys have shapes that
# lora_token_vector_length() misidentifies as SD2/SDXL.
if has_cosmos_dit_kohya_keys(str_keys) or has_cosmos_dit_peft_keys(str_keys):
raise NotAMatchError("model looks like an Anima LoRA, not a Stable Diffusion LoRA")
# If we've gotten here, we assume that the model is a Stable Diffusion model
token_vector_length = lora_token_vector_length(state_dict)
if token_vector_length == 768:
return BaseModelType.StableDiffusion1
elif token_vector_length == 1024:
return BaseModelType.StableDiffusion2
elif token_vector_length == 1280:
return BaseModelType.StableDiffusionXL # recognizes format at https://civitai.com/models/224641
elif token_vector_length == 2048:
return BaseModelType.StableDiffusionXL
# Some SDXL LoRAs (e.g. self-attention-only "slider" LoRAs) target only the UNet
# and lack the cross-attention / text-encoder keys that lora_token_vector_length()
# needs. Fall back to detecting SDXL from the UNet's deep transformer-block structure.
elif _state_dict_looks_like_sdxl_unet_lora(state_dict):
return BaseModelType.StableDiffusionXL
else:
raise NotAMatchError(f"unrecognized token vector length {token_vector_length}")View on GitHub (pinned to 0b6a024f2f)
Solutions
- Confirm the LoRA's source model — if it's Anima, use it only with Anima checkpoints / a config that supports it
- Re-export or convert the Anima LoRA to standard SD/SDXL LoRA key format if it was mislabeled
- Remove the Anima LoRA from the SD LoRA import path and register it under the correct model type
- Upgrade InvokeAI to a version with dedicated Anima LoRA support
Example fix
// before: importing an Anima (Cosmos-DiT keys) file as SD LoRA SD_LoRA_Config.from_model_on_disk(anima_lora_dir) # NotAMatchError // after: use a config/matcher for Anima, or convert keys to lora_te_/lora_unet_ SD format Anima_LoRA_Config.from_model_on_disk(anima_lora_dir)
Defensive patterns
Strategy: validation
Validate before calling
from invokeai.backend.model_manager.util.lora_conversions import has_cosmos_dit_kohya_keys, has_cosmos_dit_peft_keys
sd = mod.load_state_dict()
keys = [k for k in sd.keys() if isinstance(k, str)]
if has_cosmos_dit_kohya_keys(keys) or has_cosmos_dit_peft_keys(keys):
print("Anima LoRA — do not import as SD LoRA") Type guard
def is_anima_lora(keys: list[str]) -> bool:
from invokeai.backend.model_manager.util.lora_conversions import has_cosmos_dit_kohya_keys, has_cosmos_dit_peft_keys
return has_cosmos_dit_kohya_keys(keys) or has_cosmos_dit_peft_keys(keys) Try / catch
try:
cfg = StableDiffusionLoRAConfig.from_model_on_disk(mod)
except NotAMatchError as e:
if "Anima" in str(e):
print("use Anima-compatible tooling or convert the LoRA") Prevention
- Keep Anima LoRAs out of SD autoimport folders
- Check key naming (Cosmos-DiT patterns) before import
- Convert Anima LoRAs to SD key format if SD use is intended
When it happens
Trigger: `from_model_on_disk` on an SD-family LoRA probe where the state dict contains `has_cosmos_dit_kohya_keys` or `has_cosmos_dit_peft_keys` patterns (Anima LoRA weights) — i.e. importing an Anima LoRA through the Stable Diffusion LoRA config path.
Common situations: Autoimport folder containing Anima LoRAs alongside SD LoRAs; downloading an Anima LoRA believing it is SD1.5/SDXL-compatible; a converted Anima LoRA retaining Cosmos-DiT key naming.
Related errors
- model does not match Anima LoRA heuristics
- Unsupported control_lllite type: {type(control_lllite)}
- The Anima ControlNet-LLLite model '{lllite_field.control_mod
- This Anima ControlNet-LLLite adapter is an inpainting adapte
- Unsupported Anima ControlNet-LLLite adapter: expected 3 or 4
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/40dcd9a01f025f76.
Report an issue: GitHub.