invoke-ai/InvokeAI · error · NotAMatchError

state dict has Anima ControlNet-LLLite keys but no lllite_co

Error message

state dict has Anima ControlNet-LLLite keys but no lllite_conditioning1.conv1.weight

What it means

_get_cond_in_channels determines the conditioning input channels of an Anima ControlNet-LLLite model from lllite_conditioning1.conv1.weight. If metadata 'lllite.cond_in_channels' is absent AND the state dict lacks that conv1 key, it raises NotAMatchError — meaning the file matches the Anima LLLite key pattern partially but is not a complete/valid Anima LLLite checkpoint.

Source

Thrown at invokeai/backend/model_manager/configs/controlnet.py:335

        raise_for_override_fields(cls, override_fields)

        cls._validate_looks_like_anima_lllite(mod)

        args = dict(override_fields)
        if "cond_in_channels" not in args:
            args["cond_in_channels"] = cls._get_cond_in_channels(mod)
        return cls(**args)

    @classmethod
    def _get_cond_in_channels(cls, mod: ModelOnDisk) -> int:
        # Mirrors AnimaControlNetLLLite.from_state_dict: prefer the saved `lllite.*` hyperparam, falling back to
        # the conv1 weight shape (ch_half, cond_in_channels, 4, 4).
        meta_value = mod.metadata().get("lllite.cond_in_channels")
        if meta_value is not None:
            return int(meta_value)
        conv1_weight = mod.load_state_dict().get("lllite_conditioning1.conv1.weight")
        if conv1_weight is None:
            raise NotAMatchError("state dict has Anima ControlNet-LLLite keys but no lllite_conditioning1.conv1.weight")
        return int(conv1_weight.shape[1])

    @classmethod
    def _validate_looks_like_anima_lllite(cls, mod: ModelOnDisk) -> None:
        state_dict = mod.load_state_dict()
        if not _has_anima_lllite_keys(state_dict):
            raise NotAMatchError("state dict does not look like an Anima ControlNet-LLLite model")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Re-download the checkpoint and verify its file size/hash against the source
  2. Check the state dict for 'lllite_conditioning1.conv1.weight' before probing
  3. Add 'lllite.cond_in_channels' to the model's metadata so the conv1 key is not needed
  4. If it is a non-Anima LLLite variant, do not register it as Anima ControlNet-LLLite

Example fix

// before
# probing a partially downloaded anima_lllite.safetensors
probe(model_path)  # NotAMatchError
// after
from safetensors import safe_open
with safe_open(model_path, framework="pt") as f:
    keys = list(f.keys())
assert "lllite_conditioning1.conv1.weight" in keys  # verify before probing
probe(model_path)
Defensive patterns

Strategy: validation

Validate before calling

from safetensors import safe_open

def has_anima_conv1(path) -> bool:
    with safe_open(path, framework="pt") as f:
        return "lllite_conditioning1.conv1.weight" in f.keys()

Try / catch

try:
    config = probe(mod)
except NotAMatchError as e:
    if "lllite_conditioning1.conv1.weight" in str(e):
        logger.warning("Anima LLLite checkpoint incomplete; re-download")
    else:
        raise

Prevention

When it happens

Trigger: from_model_on_disk probing a file whose state dict contains some Anima LLLite keys but is missing lllite_conditioning1.conv1.weight — truncated/corrupted checkpoint, renamed keys, or a different LLLite implementation sharing some key names.

Common situations: Downloaded ControlNet-LLLite file cut short (partial download); model from a different framework (kohya-ss LLLite) with divergent key names; manually renamed keys when converting safetensors.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/d80bee2d14ba4921. Report an issue: GitHub.