{"record":{"id":"44b085c424ae79ab","repo":"sgl-project/sglang","slug":"hunyuan3d-paint-does-not-use-extra-unet-conditioni","errorCode":null,"errorMessage":"Hunyuan3D Paint does not use extra UNet conditioning.","messagePattern":"Hunyuan3D Paint does not use extra UNet conditioning\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/hunyuan3d_paint.py","lineNumber":325,"sourceCode":"        encoder_hidden_states: torch.Tensor,\n        *,\n        ref_latents: torch.Tensor,\n        num_in_batch: int,\n        condition_embed_dict: dict[str, torch.Tensor],\n        normal_imgs: torch.Tensor | None = None,\n        position_imgs: torch.Tensor | None = None,\n        camera_info_gen: torch.Tensor,\n        camera_info_ref: torch.Tensor,\n        ref_scale: float | torch.Tensor = 1.0,\n        mva_scale: float | torch.Tensor = 1.0,\n        position_attn_mask: dict[int, torch.Tensor] | None = None,\n        timestep_cond: torch.Tensor | None = None,\n        cross_attention_kwargs: dict[str, Any] | None = None,\n        added_cond_kwargs: dict[str, torch.Tensor] | None = None,\n        return_dict: bool = True,\n    ) -> StableDiffusionUNetOutput | tuple[torch.Tensor]:\n        if timestep_cond is not None or cross_attention_kwargs is not None:\n            raise ValueError(\"Hunyuan3D Paint does not use extra UNet conditioning.\")\n        if added_cond_kwargs is not None:\n            raise ValueError(\"Hunyuan3D Paint does not use added conditioning.\")\n        batch_size, num_generated, _, height, width = sample.shape\n        if height != width or num_generated != num_in_batch:\n            raise ValueError(\n                \"Hunyuan3D Paint expects square latents and a matching view count.\"\n            )\n\n        camera_gen = rearrange(\n            camera_info_gen + self.max_num_ref_images, \"b n -> (b n)\"\n        )\n        inputs = [sample]\n        if normal_imgs is not None:\n            inputs.append(normal_imgs)\n        if position_imgs is not None:\n            inputs.append(position_imgs)\n        sample = rearrange(torch.cat(inputs, dim=2), \"b n c h w -> (b n) c h w\")\n        encoder_gen = encoder_hidden_states.unsqueeze(1).repeat(1, num_generated, 1, 1)","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/hunyuan3d_paint.py#L307-L343","documentation":"The Hunyuan3D Paint UNet forward explicitly rejects timestep_cond and cross_attention_kwargs because this pipeline variant handles conditioning internally (via camera info, reference embeddings, and the block-level caches). Passing either argument raises this ValueError immediately.","triggerScenarios":"Calling the paint UNet's forward with a non-None timestep_cond or cross_attention_kwargs — typical when reusing a generic diffusers sampling loop (DDIM/Euler) that always forwards these to the UNet.","commonSituations":"Plugging the paint UNet into a standard diffusers pipeline or custom sampler that passes cross_attention_kwargs by default; copying sample code from a vanilla SD pipeline.","solutions":["Call the paint UNet forward without timestep_cond and cross_attention_kwargs","Use the pipeline/sampling code shipped with Hunyuan3D Paint rather than a generic diffusers scheduler loop","If writing a custom sampler, strip those arguments before invoking this UNet"],"exampleFix":"# before\nnoise_pred = unet(sample, t, encoder_hidden_states=ctx, cross_attention_kwargs=kwargs)[\"sample\"]\n\n# after\nnoise_pred = unet(sample, t, encoder_hidden_states=ctx)[\"sample\"]","handlingStrategy":"validation","validationCode":"assert timestep_cond is None and cross_attention_kwargs is None, 'paint UNet takes no timestep_cond/cross_attention_kwargs'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the pipeline shipped with Hunyuan3D Paint for sampling","Strip generic-diffusers arguments when calling specialized UNets","Read the forward signature of customized UNets before wiring samplers"],"tags":["runtime","api-misuse","diffusion","unet"],"backgroundTag":"unsupported-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}