invoke-ai/InvokeAI · error · ValueError

LLLite module '{name}' is missing key '{down_key}'

Error message

LLLite module '{name}' is missing key '{down_key}'

What it means

Each LLLite module in the v2 format must provide '<name>.down.weight', from which the input dimension (in_dim) is derived. from_state_dict raises ValueError when a discovered module name lacks this key, meaning the checkpoint is incomplete or the keys were renamed inconsistently.

Source

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

        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 = {
            m.group(1) for m in (re.match(rf"^{_SAVED_COND_PREFIX}resblocks\.(\d+)\.", k) for k in state_dict) if m
        }
        has_aspp_keys = any(k.startswith(f"{_SAVED_COND_PREFIX}aspp.") for k in state_dict)

        use_aspp = _meta_bool(meta, "lllite.use_aspp", has_aspp_keys)
        aspp_dilations_meta = meta.get("lllite.aspp_dilations")
        if use_aspp and aspp_dilations_meta:
            aspp_dilations = tuple(int(d) for d in aspp_dilations_meta.split(",") if d.strip())
        else:
            aspp_dilations = ASPP_DEFAULT_DILATIONS

        model = cls(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Verify the key exists: assert f"{name}.down.weight" in sd for every module name.
  2. Re-export or re-save the checkpoint with the full training script.
  3. Restore missing keys from an earlier complete checkpoint.
  4. If intentionally pruning modules, remove ALL keys for that module name so it isn't discovered.

Example fix

# before
names = discover_names(sd)
specs = [(n, sd[f"{n}.up.weight"].shape[1]) for n in names]  # wrong key
# after
for n in names:
    assert f"{n}.down.weight" in sd, f"missing {n}.down.weight"
specs = [(n, sd[f"{n}.down.weight"].shape[1]) for n in names]
Defensive patterns

Strategy: validation

Validate before calling

def validate_lllite_state_dict(state_dict: dict) -> None:
    names = {
        k.partition(".")[0]
        for k in state_dict
        if "." in k and k.partition(".")[0].startswith("lllite_dit_blocks_")
    }
    missing = [n for n in sorted(names) if f"{n}.down.weight" not in state_dict]
    if missing:
        raise ValueError(f"modules missing '{'{}.down.weight'}' key: {missing}")

Type guard

def module_is_complete(name: str, sd: dict) -> bool:
    return f"{name}.down.weight" in sd

Try / catch

try:
    cnet = ControlNetLLLiteDiT.from_state_dict(sd, metadata)
except ValueError as e:
    if "is missing key" in str(e):
        raise ValueError(f"checkpoint is incomplete/corrupt: {e}; re-download or re-export") from e
    raise

Prevention

When it happens

Trigger: State dict contains e.g. 'lllite_dit_blocks_0_up.weight' but not 'lllite_dit_blocks_0_down.weight' — due to partial saves, manual key edits, or mixed-format exports.

Common situations: Interrupted training saves, checkpoints pruned or converted by third-party scripts that dropped keys, or hand-merged safetensors files.

Related errors


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