{"record":{"id":"8a69f24641d7a9c0","repo":"invoke-ai/InvokeAI","slug":"pid-decoder-has-lq-proj-hidden-dim-lq-hidden-dim","errorCode":null,"errorMessage":"PiD decoder has lq_proj hidden dim {lq_hidden_dim}, but InvokeAI only supports the legacy 1280-dim architecture (NVIDIA's v1.5 checkpoints are not yet supported).","messagePattern":"PiD decoder has lq_proj hidden dim (.+?), but InvokeAI only supports the legacy 1280-dim architecture \\(NVIDIA's v1\\.5 checkpoints are not yet supported\\)\\.","errorType":"exception","errorClass":"InvalidMatchError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/configs/pid_decoder.py","lineNumber":101,"sourceCode":"    expected = contract[_LATENT_PROJ_KEY]\n    if shape is None or len(shape) != len(expected) or shape[2:] != expected[2:]:\n        raise InvalidMatchError(\n            f\"PiD checkpoint has a malformed {_LATENT_PROJ_KEY}: expected a \"\n            f\"{len(expected)}D conv weight with a {'x'.join(str(d) for d in expected[2:])} kernel, got \"\n            f\"{shape if shape is not None else 'a value with no shape'}\"\n        )\n\n\ndef _raise_if_architecture_unsupported(shapes: _Shapes) -> None:\n    \"\"\"Reject a PiD decoder whose network shape `build_pid_net` cannot construct.\n\n    Runs before the contract check so the diagnosis is the accurate one: a v1.5 checkpoint is intact,\n    and judging it against the legacy contract would report it as a pile of missing and unexpected\n    keys rather than as the newer architecture it is.\n    \"\"\"\n    lq_hidden_dim = shapes[_LATENT_PROJ_KEY][0]  # type: ignore[index]  # rank checked above\n    if lq_hidden_dim != _SUPPORTED_LQ_HIDDEN_DIM:\n        raise InvalidMatchError(\n            f\"PiD decoder has lq_proj hidden dim {lq_hidden_dim}, but InvokeAI only supports the legacy \"\n            f\"{_SUPPORTED_LQ_HIDDEN_DIM}-dim architecture (NVIDIA's v1.5 checkpoints are not yet supported).\"\n        )\n\n\ndef _raise_if_no_backbone_can_accept(shapes: _Shapes) -> None:\n    \"\"\"Reject a PiD decoder that none of the five backbone configs could ever claim.\n\n    The counterpart to `_validate_base`, and the reason the two are separate. `_validate_base` decides\n    *which* backbone a checkpoint belongs to and says \"not this one\" with `NotAMatchError` — four of\n    the five classes are meant to say exactly that about every valid checkpoint. A rejection here is\n    backbone-independent, so all five would raise it for the same reason, leaving the file with no\n    match at all and letting the factory register it through the `Unknown_Config` fallback: a PiD\n    decoder on record as a model nothing can load. Hence `InvalidMatchError`.\n\n    Runs before the contract check because a decoder for an unsupported backbone would otherwise be\n    reported as a shape mismatch on one weight, which is true and useless.\n    \"\"\"","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/pid_decoder.py#L83-L119","documentation":"InvokeAI's PiD decoder identification checks the first dimension of `lq_proj.latent_proj.0.weight` (PidNet's `lq_hidden_dim`). Only the legacy 512-dim network can be constructed; NVIDIA's v1.5 checkpoints use 1024 (plus extra modules) and are rejected as `InvalidMatchError` before the key-contract check so the diagnosis names the architecture, not a pile of missing keys.","triggerScenarios":"Loading/installing a NVIDIA PiD v1.5 checkpoint (.pth with a 1024-dim lq_proj) via the model manager; `from_model_on_disk` runs `_raise_if_architecture_unsupported` after the shape-discriminator check.","commonSituations":"User downloaded the latest PiD v1.5 weights from HuggingFace nvidia/PiD; library updated weights but InvokeAI only supports the earlier legacy architecture release.","solutions":["Use the legacy (non-v1.5) PiD checkpoint with the 512-dim architecture","Wait for/upgrade to an InvokeAI release that supports the v1.5 (1024-dim + PiT injection) architecture","If you are certain, convert the v1.5 weights to the legacy layout — generally not possible due to added modules (PiT injection, scalar gates)","Do not override `base`/format expecting it to help; the check is architecture-based and will still reject"],"exampleFix":"// before: nvidia/PiD v1.5 checkpoint -> lq_proj.latent_proj.0.weight shape [1024, C, 3, 3]\n// after: download the legacy checkpoint -> shape [512, C, 3, 3]\n# e.g. pick the pre-v1.5 release from https://huggingface.co/nvidia/PiD","handlingStrategy":"validation","validationCode":"import torch\nsd = torch.load(ckpt_path, map_location='cpu')\nkey = next(k for k in sd if 'lq_proj' in k and 'latent_proj' in k)\nlq_hidden_dim = sd[key].shape[0]\nif lq_hidden_dim != 512:\n    raise SystemExit(f'Unsupported PiD v1.5 checkpoint (hidden dim {lq_hidden_dim}); use the legacy 512-dim release.')","typeGuard":"def is_legacy_pid_decoder(sd: dict) -> bool:\n    key = next((k for k in sd if 'lq_proj' in k and 'latent_proj' in k), None)\n    return key is not None and getattr(sd[key], 'shape', None) is not None and sd[key].shape[0] == 512","tryCatchPattern":"from invokeai.backend.model_manager.configs.identification_utils import InvalidMatchError\ntry:\n    install_model(path)\nexcept InvalidMatchError as e:\n    if 'v1.5 checkpoints are not yet supported' in str(e):\n        logger.warning('PiD v1.5 not supported; download the legacy 512-dim checkpoint.')\n    else:\n        raise","preventionTips":["Pin to the legacy (pre-v1.5) PiD releases on nvidia/PiD","Check dim 0 of lq_proj.latent_proj.0.weight == 512 before installing","Track InvokeAI release notes for v1.5 (1024-dim) support before upgrading weights"],"tags":["checkpoint","model-loader","unsupported-architecture"],"backgroundTag":"unsupported-model-architecture","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}