Comfy-Org/ComfyUI · error · ValueError

Unsupported PiD v1.5 latent projection with {latent_proj_in_

Error message

Unsupported PiD v1.5 latent projection with {latent_proj_in_channels} input channels

What it means

PiD v1.5 model detection recognizes only specific latent projection input-channel counts (16 for the standard latent, 32 for Flux2 after 2x latent unpatchify); the variants dict lookup returns None for any other count and detection aborts. Any other channel count means the checkpoint is a PiD variant this ComfyUI version does not know.

Source

Thrown at comfy/model_detection.py:535

                      "lq_hidden_dim": hidden_dim}
        if num_gates > 0:
            dit_config["lq_interval"] = (14 + num_gates - 1) // num_gates
        if pid_v1_5:
            pid_v1_5_variants = {
                16: {  # Flux and QwenImage
                    "lq_latent_channels": 16,
                    "latent_spatial_down_factor": 8,
                    "lq_latent_unpatchify_factor": 1,
                },
                32: {  # Flux2 after 2x latent unpatchify
                    "lq_latent_channels": 128,
                    "latent_spatial_down_factor": 16,
                    "lq_latent_unpatchify_factor": 2,
                },
            }
            variant = pid_v1_5_variants.get(latent_proj_in_channels)
            if variant is None:
                raise ValueError(f"Unsupported PiD v1.5 latent projection with {latent_proj_in_channels} input channels")
            gate_weight = state_dict['{}lq_proj.gate_modules.0.content_proj.weight'.format(key_prefix)]
            dit_config.update(variant)
            dit_config.update({
                "lq_conv_padding_mode": "replicate",
                "lq_gate_per_token": gate_weight.shape[0] == 1,
                "pit_lq_inject": True,
                "rope_ref_h": 2048,
                "rope_ref_w": 2048,
            })
        else:
            dit_config.update({
                "lq_latent_channels": latent_proj_in_channels,
                "latent_spatial_down_factor": 16 if latent_proj_in_channels >= 64 else 8,
            })
        return dit_config

    if '{}core.pixel_embedder.proj.weight'.format(key_prefix) in state_dict_keys:  # PixelDiT T2I
        return {"image_model": "pixeldit_t2i"}

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Update ComfyUI to the latest version that may have added the variant.
  2. Re-download the checkpoint from the original release to rule out corruption.
  3. If it is a genuinely new variant, it needs code support (a new entry in pid_v1_5_variants) — report it upstream.
Defensive patterns

Strategy: try-catch

Validate before calling

SUPPORTED_PID_CHANNELS = {16, 32}
in_ch = state_dict[f"{key_prefix}lq_proj.in_weight"].shape[1] if f"{key_prefix}lq_proj.in_weight" in state_dict else None
if in_ch is not None and in_ch not in SUPPORTED_PID_CHANNELS:
    logging.warning("PiD checkpoint has unsupported latent proj channels %s; load may fail", in_ch)

Try / catch

try:
    model = comfy.sd.load_diffusion_model(ckpt_path)
except ValueError as e:
    if "PiD v1.5 latent projection" in str(e):
        raise RuntimeError("Unsupported PiD variant; update ComfyUI or use an official checkpoint") from e
    raise

Prevention

When it happens

Trigger: Loading a checkpoint whose lq_proj input channels are neither of the supported values — e.g. a newer PiD release, a re-quantized/re-chopped checkpoint, or a corrupted state dict read as a weird channel count.

Common situations: New PiD v1.5 checkpoint variant shipped after the ComfyUI version in use; a community re-export that changed the latent projection; mixing up which projection layer triggered detection.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/70f760a8664066ed. Report an issue: GitHub.