invoke-ai/InvokeAI · error · ValueError
Unsupported lora format: {state_dict.keys()}
Error message
Unsupported lora format: {state_dict.keys()} What it means
any_lora_layer_from_state_dict sniffs a state dict's keys to decide which LoRA layer class to build (LoRALayer, IA3Layer, NormLayer, FullLayer). If none of the known key signatures (e.g. 'lora_down.weight'/'lora_up.weight', 'on_input', 'w_norm') are present, it raises ValueError naming the actual keys found. This means the per-layer state dict is not in any LoRA format InvokeAI recognizes.
Source
Thrown at invokeai/backend/patches/layers/utils.py:35
# https://github.com/KohakuBlueleaf/LyCORIS/tree/8ad8000efb79e2b879054da8c9356e6143591bad/lycoris/modules
if "dora_scale" in state_dict:
return DoRALayer.from_state_dict_values(state_dict)
elif "lora_up.weight" in state_dict:
# LoRA a.k.a LoCon
return LoRALayer.from_state_dict_values(state_dict)
elif "hada_w1_a" in state_dict:
return LoHALayer.from_state_dict_values(state_dict)
elif "lokr_w1" in state_dict or "lokr_w1_a" in state_dict:
return LoKRLayer.from_state_dict_values(state_dict)
elif "diff" in state_dict:
# Full a.k.a Diff
return FullLayer.from_state_dict_values(state_dict)
elif "on_input" in state_dict:
return IA3Layer.from_state_dict_values(state_dict)
elif "w_norm" in state_dict:
return NormLayer.from_state_dict_values(state_dict)
else:
raise ValueError(f"Unsupported lora format: {state_dict.keys()}")
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Inspect the printed keys in the message and compare them to the recognized signatures in invokeai/backend/patches/layers/utils.py; rename or convert keys to a supported format.
- Use the correct converter function for the LoRA's source format (flux_control, flux_diffusers, flux_kohya, flux_onetrainer, flux_xlabs) instead of feeding raw keys.
- Re-export the LoRA from the training tool in a standard (diffusers/PEFT or Kohya) format.
Example fix
// before
layer = any_lora_layer_from_state_dict({"down.weight": w, "up.weight": u}) # ValueError
// after
layer = any_lora_layer_from_state_dict({"lora_down.weight": w, "lora_up.weight": u}) Defensive patterns
Strategy: validation
Validate before calling
KNOWN = {"lora_down.weight", "lora_A.weight", "on_input", "w_norm"}
if not (set(layer_sd) & KNOWN):
raise ValueError(f"pre-check: layer not a supported LoRA layer: {sorted(layer_sd)}") Type guard
def is_supported_lora_layer(sd: dict) -> bool:
keys = set(sd)
return bool(keys & {"lora_down.weight", "lora_A.weight", "on_input", "w_norm"}) Try / catch
try:
layer = any_lora_layer_from_state_dict(sd)
except ValueError as e:
logger.error("Unsupported LoRA layer keys: %s", e)
layer = None Prevention
- Always convert third-party LoRAs through the matching flux_*_lora_conversion_utils before applying patches.
- Log state-dict keys on failure to compare against recognized signatures.
- Pin InvokeAI version known to support the trainer format you use.
When it happens
Trigger: Calling any_lora_layer_from_state_dict (directly or via lora_model_from_flux_* converters or _make_layer_patch) with a per-layer dict whose keys match no known pattern - e.g. missing 'lora_down.weight'/'lora_A.weight' prefixes, or an arbitrary dict passed in.
Common situations: Loading a LoRA trained/saved in an unsupported format or by a tool InvokeAI doesn't convert (wrong exporter, PEFT vs Kohya key naming mismatch), or hand-assembled state dicts with typos in key names.
Related errors
- LoRA model is in unsupported FLUX format
- Unknown lora: {lora_key}!
- Unknown lora: {lora_key}!
- LoRA '{lora_key}' is for {stored_config.base.value if stored
- LoRA '{lora_key}' has conflicting weights on the transformer
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/23cfac7671c48e35.
Report an issue: GitHub.