sgl-project/sglang · error · ValueError

Hunyuan3D Paint does not use added conditioning.

Error message

Hunyuan3D Paint does not use added conditioning.

What it means

The Hunyuan3D Paint UNet does not support diffusers 'added conditioning' (added_cond_kwargs such as text embeddings/score conditioning used by SDXL). forward raises this ValueError if added_cond_kwargs is passed, since its conditioning comes from camera info and multiview machinery instead.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/dits/hunyuan3d_paint.py:327

        ref_latents: torch.Tensor,
        num_in_batch: int,
        condition_embed_dict: dict[str, torch.Tensor],
        normal_imgs: torch.Tensor | None = None,
        position_imgs: torch.Tensor | None = None,
        camera_info_gen: torch.Tensor,
        camera_info_ref: torch.Tensor,
        ref_scale: float | torch.Tensor = 1.0,
        mva_scale: float | torch.Tensor = 1.0,
        position_attn_mask: dict[int, torch.Tensor] | None = None,
        timestep_cond: torch.Tensor | None = None,
        cross_attention_kwargs: dict[str, Any] | None = None,
        added_cond_kwargs: dict[str, torch.Tensor] | None = None,
        return_dict: bool = True,
    ) -> StableDiffusionUNetOutput | tuple[torch.Tensor]:
        if timestep_cond is not None or cross_attention_kwargs is not None:
            raise ValueError("Hunyuan3D Paint does not use extra UNet conditioning.")
        if added_cond_kwargs is not None:
            raise ValueError("Hunyuan3D Paint does not use added conditioning.")
        batch_size, num_generated, _, height, width = sample.shape
        if height != width or num_generated != num_in_batch:
            raise ValueError(
                "Hunyuan3D Paint expects square latents and a matching view count."
            )

        camera_gen = rearrange(
            camera_info_gen + self.max_num_ref_images, "b n -> (b n)"
        )
        inputs = [sample]
        if normal_imgs is not None:
            inputs.append(normal_imgs)
        if position_imgs is not None:
            inputs.append(position_imgs)
        sample = rearrange(torch.cat(inputs, dim=2), "b n c h w -> (b n) c h w")
        encoder_gen = encoder_hidden_states.unsqueeze(1).repeat(1, num_generated, 1, 1)
        encoder_gen = rearrange(encoder_gen, "b n l c -> (b n) l c")

View on GitHub (pinned to 0132848349)

Solutions

  1. Omit added_cond_kwargs (or pass None) when calling this UNet
  2. Use the provided Hunyuan3D Paint pipeline instead of an SDXL one
  3. Guard your sampler: only forward added_cond_kwargs when the UNet supports it

Example fix

# before
noise_pred = unet(sample, t, added_cond_kwargs={"text_embeds": te, "time_ids": ti})

# after
noise_pred = unet(sample, t)
Defensive patterns

Strategy: validation

Validate before calling

assert added_cond_kwargs is None, 'paint UNet does not accept added_cond_kwargs'

Prevention

When it happens

Trigger: Calling the paint UNet forward with added_cond_kwargs (e.g. {'text_embeds': ..., 'time_ids': ...}), usually because a SDXL-style pipeline or copied sample code forwards it unconditionally.

Common situations: Reusing SDXL sampling code; a generic pipeline that always passes added_cond_kwargs even when None-checks are skipped.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/8c236dc7a3fe9adf. Report an issue: GitHub.