invoke-ai/InvokeAI · error · ValueError

State dict contains no LLLite modules (no 'lllite_dit_blocks

Error message

State dict contains no LLLite modules (no 'lllite_dit_blocks_*' keys).

What it means

from_state_dict discovers LLLite modules by scanning state-dict keys whose head matches the lllite_dit_blocks_* pattern. If no keys match, the state dict contains no usable LLLite weights and ValueError is raised — usually the file isn't a ControlNet-LLLite checkpoint at all.

Source

Thrown at invokeai/backend/anima/control_net_lllite.py:434

        Hyperparams come from ``lllite.*`` metadata when present, with
        state-dict-shape fallbacks. ``inpaint_masked_input`` is metadata-only
        (not derivable from shapes; defaults to False).
        """
        meta = metadata or {}

        if any(k.startswith(_LEGACY_MODULES_PREFIX) for k in state_dict):
            raise ValueError(
                f"State dict appears to be in a legacy ControlNet-LLLite weight format (keys starting "
                f"with '{_LEGACY_MODULES_PREFIX}'). Only the v2 named-key format is supported."
            )

        module_names: set[str] = set()
        for key in state_dict:
            head, dot, _tail = key.partition(".")
            if dot and MODULE_NAME_PATTERN.match(head):
                module_names.add(head)
        if not module_names:
            raise ValueError("State dict contains no LLLite modules (no 'lllite_dit_blocks_*' keys).")

        def sort_key(name: str) -> tuple[int, int]:
            match = MODULE_NAME_PATTERN.match(name)
            assert match is not None
            return int(match.group(1)), _SUFFIX_ORDER.index(match.group(2))

        sorted_names = sorted(module_names, key=sort_key)
        module_specs: list[tuple[str, int]] = []
        for name in sorted_names:
            down_key = f"{name}.down.weight"
            if down_key not in state_dict:
                raise ValueError(f"LLLite module '{name}' is missing key '{down_key}'")
            module_specs.append((name, state_dict[down_key].shape[1]))

        conv1_weight = state_dict[f"{_SAVED_COND_PREFIX}conv1.weight"]
        conv3_weight = state_dict[f"{_SAVED_COND_PREFIX}conv3.weight"]
        proj_weight = state_dict[f"{_SAVED_COND_PREFIX}proj.weight"]
        resblock_indices = {

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Confirm the file is a ControlNet-LLLite checkpoint: print(list(sd.keys())[:10]).
  2. Check metadata (format/version fields) of the safetensors file.
  3. Re-download the checkpoint (may be truncated/corrupt).
  4. Re-export the model in the v2 named-key format if it's from another tool.

Example fix

# before
sd = load_file("model.safetensors")
cnet = ControlNetLLLiteDiT.from_state_dict(sd, meta)  # ValueError
# after
sd = load_file("controlnet_lllite.safetensors")
assert any(k.startswith("lllite_dit_blocks_") for k in sd), "not a LLLite checkpoint"
cnet = ControlNetLLLiteDiT.from_state_dict(sd, meta)
Defensive patterns

Strategy: validation

Validate before calling

def is_lllite_checkpoint(state_dict: dict) -> bool:
    names = {
        k.partition(".")[0]
        for k in state_dict
        if "." in k and k.partition(".")[0].startswith("lllite_dit_blocks_")
    }
    return bool(names)

Type guard

def has_lllite_modules(sd: dict) -> bool:
    return any(k.startswith("lllite_dit_blocks_") for k in sd)

Try / catch

try:
    cnet = ControlNetLLLiteDiT.from_state_dict(sd, metadata)
except ValueError as e:
    if "no LLLite modules" in str(e):
        raise ValueError("file is not a ControlNet-LLLite checkpoint; check the model path") from e
    raise

Prevention

When it happens

Trigger: Calling from_state_dict with a base-model checkpoint, a LoRA file, a truncated/empty state dict, or keys under an unexpected prefix so the pattern scan finds nothing.

Common situations: Passing the wrong .safetensors file (model instead of ControlNet), loading a LoRA in place of a ControlNet, partially downloaded files, or a v3/other format with different key naming.

Related errors


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