{"record":{"id":"86cc93c4dde752a7","repo":"invoke-ai/InvokeAI","slug":"state-dict-contains-no-lllite-modules-no-lllite","errorCode":null,"errorMessage":"State dict contains no LLLite modules (no 'lllite_dit_blocks_*' keys).","messagePattern":"State dict contains no LLLite modules \\(no 'lllite_dit_blocks_\\*' keys\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/anima/control_net_lllite.py","lineNumber":434,"sourceCode":"        Hyperparams come from ``lllite.*`` metadata when present, with\n        state-dict-shape fallbacks. ``inpaint_masked_input`` is metadata-only\n        (not derivable from shapes; defaults to False).\n        \"\"\"\n        meta = metadata or {}\n\n        if any(k.startswith(_LEGACY_MODULES_PREFIX) for k in state_dict):\n            raise ValueError(\n                f\"State dict appears to be in a legacy ControlNet-LLLite weight format (keys starting \"\n                f\"with '{_LEGACY_MODULES_PREFIX}'). Only the v2 named-key format is supported.\"\n            )\n\n        module_names: set[str] = set()\n        for key in state_dict:\n            head, dot, _tail = key.partition(\".\")\n            if dot and MODULE_NAME_PATTERN.match(head):\n                module_names.add(head)\n        if not module_names:\n            raise ValueError(\"State dict contains no LLLite modules (no 'lllite_dit_blocks_*' keys).\")\n\n        def sort_key(name: str) -> tuple[int, int]:\n            match = MODULE_NAME_PATTERN.match(name)\n            assert match is not None\n            return int(match.group(1)), _SUFFIX_ORDER.index(match.group(2))\n\n        sorted_names = sorted(module_names, key=sort_key)\n        module_specs: list[tuple[str, int]] = []\n        for name in sorted_names:\n            down_key = f\"{name}.down.weight\"\n            if down_key not in state_dict:\n                raise ValueError(f\"LLLite module '{name}' is missing key '{down_key}'\")\n            module_specs.append((name, state_dict[down_key].shape[1]))\n\n        conv1_weight = state_dict[f\"{_SAVED_COND_PREFIX}conv1.weight\"]\n        conv3_weight = state_dict[f\"{_SAVED_COND_PREFIX}conv3.weight\"]\n        proj_weight = state_dict[f\"{_SAVED_COND_PREFIX}proj.weight\"]\n        resblock_indices = {","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/anima/control_net_lllite.py#L416-L452","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the file is a ControlNet-LLLite checkpoint: print(list(sd.keys())[:10]).","Check metadata (format/version fields) of the safetensors file.","Re-download the checkpoint (may be truncated/corrupt).","Re-export the model in the v2 named-key format if it's from another tool."],"exampleFix":"# before\nsd = load_file(\"model.safetensors\")\ncnet = ControlNetLLLiteDiT.from_state_dict(sd, meta)  # ValueError\n# after\nsd = load_file(\"controlnet_lllite.safetensors\")\nassert any(k.startswith(\"lllite_dit_blocks_\") for k in sd), \"not a LLLite checkpoint\"\ncnet = ControlNetLLLiteDiT.from_state_dict(sd, meta)","handlingStrategy":"validation","validationCode":"def is_lllite_checkpoint(state_dict: dict) -> bool:\n    names = {\n        k.partition(\".\")[0]\n        for k in state_dict\n        if \".\" in k and k.partition(\".\")[0].startswith(\"lllite_dit_blocks_\")\n    }\n    return bool(names)","typeGuard":"def has_lllite_modules(sd: dict) -> bool:\n    return any(k.startswith(\"lllite_dit_blocks_\") for k in sd)","tryCatchPattern":"try:\n    cnet = ControlNetLLLiteDiT.from_state_dict(sd, metadata)\nexcept ValueError as e:\n    if \"no LLLite modules\" in str(e):\n        raise ValueError(\"file is not a ControlNet-LLLite checkpoint; check the model path\") from e\n    raise","preventionTips":["Log the first few state-dict keys when a load fails.","Keep ControlNet and base-model files in clearly separated paths.","Verify file checksums/size after download.","Confirm checkpoint type (base model vs LoRA vs ControlNet) before load."],"tags":["controlnet","checkpoint","validation","missing-keys"],"backgroundTag":"missing-checkpoint-keys","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}