{"record":{"id":"6afe29ea6c320d4b","repo":"sgl-project/sglang","slug":"the-hunyuan3d-sd2-1-unet-has-no-added-conditioning","errorCode":null,"errorMessage":"The Hunyuan3D SD2.1 UNet has no added conditioning.","messagePattern":"The Hunyuan3D SD2\\.1 UNet has no added conditioning\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/stable_diffusion.py","lineNumber":827,"sourceCode":"\n    def forward(\n        self,\n        sample: torch.Tensor,\n        timestep: torch.Tensor | float | int,\n        encoder_hidden_states: torch.Tensor,\n        class_labels: torch.Tensor | None = None,\n        timestep_cond: torch.Tensor | None = None,\n        attention_mask: torch.Tensor | None = None,\n        cross_attention_kwargs: dict[str, Any] | None = None,\n        added_cond_kwargs: dict[str, torch.Tensor] | None = None,\n        down_block_additional_residuals: tuple[torch.Tensor, ...] | None = None,\n        mid_block_additional_residual: torch.Tensor | None = None,\n        down_intrablock_additional_residuals: tuple[torch.Tensor, ...] | None = None,\n        encoder_attention_mask: torch.Tensor | None = None,\n        return_dict: bool = True,\n    ) -> StableDiffusionUNetOutput | tuple[torch.Tensor]:\n        if timestep_cond is not None or added_cond_kwargs is not None:\n            raise ValueError(\"The Hunyuan3D SD2.1 UNet has no added conditioning.\")\n        if down_intrablock_additional_residuals is not None:\n            raise ValueError(\"T2I adapter residuals are not supported by Hunyuan3D.\")\n        if (down_block_additional_residuals is None) != (\n            mid_block_additional_residual is None\n        ):\n            raise ValueError(\n                \"ControlNet down and mid residuals must be provided together.\"\n            )\n\n        attention_mask = self._attention_bias(attention_mask, sample.dtype)\n        encoder_attention_mask = self._attention_bias(\n            encoder_attention_mask, sample.dtype\n        )\n        if self.config.center_input_sample:\n            sample = 2 * sample - 1.0\n\n        time_embedding = self._time_embedding(sample, timestep)\n        if self.class_embedding is not None:","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/stable_diffusion.py#L809-L845","documentation":"Raised by the Hunyuan3D SD2.1 UNet forward when timestep_cond or added_cond_kwargs is not None. This UNet architecture has no added-conditioning pathway (unlike SDXL/SD3 which take text embeddings as added cond), so passing them is a caller bug.","triggerScenarios":"Forwarding diffusers-style SDXL arguments (timestep_cond, added_cond_kwargs={'text_embeds':..., 'time_ids':...}) into this SD2.1 UNet.","commonSituations":"Reusing pipeline glue code written for SDXL or another UNet that supports added conditioning.","solutions":["Remove timestep_cond and added_cond_kwargs from the forward call","Pass conditioning through encoder_hidden_states / class_labels instead"],"exampleFix":"# before\nunet(latents, t, encoder_hidden_states=ctx, added_cond_kwargs=cond)\n# after\nunet(latents, t, encoder_hidden_states=ctx)","handlingStrategy":"validation","validationCode":"assert timestep_cond is None and added_cond_kwargs is None before calling this UNet","typeGuard":"def has_no_added_cond(timestep_cond, added_cond_kwargs) -> bool:\n    return timestep_cond is None and added_cond_kwargs is None","tryCatchPattern":null,"preventionTips":["Keep SDXL pipeline code separate from SD2.1 paths"],"tags":["unet","unsupported-argument","hunyuan3d","stable-diffusion"],"backgroundTag":"unsupported-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}