{"record":{"id":"bf084de4884c993e","repo":"invoke-ai/InvokeAI","slug":"pid-decoder-backbone-backbone-r-is-not-supported","errorCode":null,"errorMessage":"PiD decoder backbone {backbone!r} is not supported. Expected one of: {list(_PER_BACKBONE.keys())}.","messagePattern":"PiD decoder backbone (.+?) is not supported\\. Expected one of: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/pid/decode.py","lineNumber":205,"sourceCode":"    patch_tokens = batch_size * (out_h // patch_size) * (out_w // patch_size)\n    if patch_tokens <= _PID_ACTIVATION_CHUNK_SIZE:\n        # The pixel blocks take the unchunked path at and below the threshold.\n        return unoptimized\n    chunked = int(output_bytes * _PID_DECODE_CHUNKED_SCALING_CONSTANT + _PID_DECODE_CHUNKED_FIXED_BYTES)\n    # The fixed term makes the calibrated chunked formula temporarily greater than the unoptimized\n    # formula just after chunking engages. Keep the unoptimized estimate until the formulas cross;\n    # after that point the chunked estimate is the lower (optimized) reservation.\n    return min(chunked, unoptimized)\n\n\ndef build_pid_net(backbone: BaseModelType) -> PidNet:\n    \"\"\"Build an uninitialised PidNet of the right shape for *backbone*.\n\n    The returned network is on CPU and in float32; the caller is responsible\n    for casting it to the desired dtype/device before loading weights.\n    \"\"\"\n    if backbone not in _PER_BACKBONE:\n        raise ValueError(\n            f\"PiD decoder backbone {backbone!r} is not supported. Expected one of: {list(_PER_BACKBONE.keys())}.\"\n        )\n    kwargs = {**_PID_SR4X_BASE, **_PER_BACKBONE[backbone]}\n    return PidNet(**kwargs)\n\n\n# The one PidNet parameter whose shape depends on the backbone: a Conv2d whose in-channels are the\n# backbone's latent channel count (4 SDXL / 16 FLUX.1, SD3, Qwen-Image / 128 FLUX.2). Every other\n# parameter is name- and shape-identical across all five, which is what lets model identification\n# hold a checkpoint to one contract before it knows which backbone the checkpoint is for.\nBACKBONE_DISCRIMINATOR_KEY = \"lq_proj.latent_proj.0.weight\"\n\n# The backbone the contract is probed from. Any of the five would do — see the docstring below.\n_KEY_CONTRACT_BACKBONE = BaseModelType.Flux\n\n\n@lru_cache(maxsize=None)\ndef required_pid_net_shapes(backbone: BaseModelType = _KEY_CONTRACT_BACKBONE) -> Mapping[str, tuple[int, ...]]:","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/pid/decode.py#L187-L223","documentation":"build_pid_net constructs an uninitialized PidNet sized for a named backbone, looking up per-backbone hyperparameters in _PER_BACKBONE. If the backbone name is not a key of that registry, it raises ValueError listing the supported names. This is a decode-time configuration error: the requested decoder architecture is unknown to this version of the library.","triggerScenarios":"Calling build_pid_net(backbone=...) (also reached via required_pid_net_shapes / load_pid_decoder) with a misspelled, renamed, or not-yet-supported backbone identifier.","commonSituations":"Typo in a model config's backbone field, checkpoint metadata referencing a backbone from a newer/older library version, or a case mismatch (e.g. 'xl' vs 'XL').","solutions":["Use one of the supported names printed in the message (the keys of _PER_BACKBONE)","Fix typos/casing in the backbone field of the model config or loader call","Upgrade the library if the backbone was added in a newer release"],"exampleFix":"// before\nnet = build_pid_net(\"pid_xll\")\n// after\nnet = build_pid_net(\"pid_xl\")  # must be a key of _PER_BACKBONE","handlingStrategy":"validation","validationCode":"from invokeai.backend.pid.decode import _PER_BACKBONE\nassert backbone in _PER_BACKBONE, f\"{backbone!r} not in {list(_PER_BACKBONE)}\"","typeGuard":null,"tryCatchPattern":"try:\n    net = load_pid_decoder(path, backbone=backbone)\nexcept ValueError as e:\n    if \"not supported\" in str(e):\n        logger.error(f\"Bad backbone: {e}\")\n    raise","preventionTips":["Validate backbone names at config load","Keep assets and library versions in sync","Offer autocomplete/whitelist in UIs"],"tags":["configuration","value-error","backbone","model-loading"],"backgroundTag":"unsupported-model-variant","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}