{"record":{"id":"d80bee2d14ba4921","repo":"invoke-ai/InvokeAI","slug":"state-dict-has-anima-controlnet-lllite-keys-but-no","errorCode":null,"errorMessage":"state dict has Anima ControlNet-LLLite keys but no lllite_conditioning1.conv1.weight","messagePattern":"state dict has Anima ControlNet-LLLite keys but no lllite_conditioning1\\.conv1\\.weight","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/configs/controlnet.py","lineNumber":335,"sourceCode":"        raise_for_override_fields(cls, override_fields)\n\n        cls._validate_looks_like_anima_lllite(mod)\n\n        args = dict(override_fields)\n        if \"cond_in_channels\" not in args:\n            args[\"cond_in_channels\"] = cls._get_cond_in_channels(mod)\n        return cls(**args)\n\n    @classmethod\n    def _get_cond_in_channels(cls, mod: ModelOnDisk) -> int:\n        # Mirrors AnimaControlNetLLLite.from_state_dict: prefer the saved `lllite.*` hyperparam, falling back to\n        # the conv1 weight shape (ch_half, cond_in_channels, 4, 4).\n        meta_value = mod.metadata().get(\"lllite.cond_in_channels\")\n        if meta_value is not None:\n            return int(meta_value)\n        conv1_weight = mod.load_state_dict().get(\"lllite_conditioning1.conv1.weight\")\n        if conv1_weight is None:\n            raise NotAMatchError(\"state dict has Anima ControlNet-LLLite keys but no lllite_conditioning1.conv1.weight\")\n        return int(conv1_weight.shape[1])\n\n    @classmethod\n    def _validate_looks_like_anima_lllite(cls, mod: ModelOnDisk) -> None:\n        state_dict = mod.load_state_dict()\n        if not _has_anima_lllite_keys(state_dict):\n            raise NotAMatchError(\"state dict does not look like an Anima ControlNet-LLLite model\")\n","sourceCodeStart":317,"sourceCodeEnd":343,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/controlnet.py#L317-L343","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-download the checkpoint and verify its file size/hash against the source","Check the state dict for 'lllite_conditioning1.conv1.weight' before probing","Add 'lllite.cond_in_channels' to the model's metadata so the conv1 key is not needed","If it is a non-Anima LLLite variant, do not register it as Anima ControlNet-LLLite"],"exampleFix":"// before\n# probing a partially downloaded anima_lllite.safetensors\nprobe(model_path)  # NotAMatchError\n// after\nfrom safetensors import safe_open\nwith safe_open(model_path, framework=\"pt\") as f:\n    keys = list(f.keys())\nassert \"lllite_conditioning1.conv1.weight\" in keys  # verify before probing\nprobe(model_path)","handlingStrategy":"validation","validationCode":"from safetensors import safe_open\n\ndef has_anima_conv1(path) -> bool:\n    with safe_open(path, framework=\"pt\") as f:\n        return \"lllite_conditioning1.conv1.weight\" in f.keys()","typeGuard":null,"tryCatchPattern":"try:\n    config = probe(mod)\nexcept NotAMatchError as e:\n    if \"lllite_conditioning1.conv1.weight\" in str(e):\n        logger.warning(\"Anima LLLite checkpoint incomplete; re-download\")\n    else:\n        raise","preventionTips":["Verify checkpoint file size/hash after download","Prefer metadata (lllite.cond_in_channels) when repacking models","Never manually rename state-dict keys of LLLite checkpoints","Check safetensors keys before importing into InvokeAI"],"tags":["python","controlnet","state-dict","model-probing"],"backgroundTag":"missing-state-dict-key","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}