{"record":{"id":"7cf4254d30fbbda4","repo":"sgl-project/sglang","slug":"t2i-adapter-residuals-are-not-supported-by-hunyuan","errorCode":null,"errorMessage":"T2I adapter residuals are not supported by Hunyuan3D.","messagePattern":"T2I adapter residuals are not supported by Hunyuan3D\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/stable_diffusion.py","lineNumber":829,"sourceCode":"        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:\n            if class_labels is None:\n                raise ValueError(\"class_labels are required by this UNet.\")","sourceCodeStart":811,"sourceCodeEnd":847,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/stable_diffusion.py#L811-L847","documentation":"Raised by the Hunyuan3D SD2.1 UNet forward when down_intrablock_additional_residuals is not None. T2I-Adapter style intra-block residuals are not implemented in this native UNet.","triggerScenarios":"Passing down_intrablock_additional_residuals (a tuple of per-block residuals from a T2I adapter) to forward.","commonSituations":"Porting a diffusers pipeline that supports T2I-Adapter; feeding adapter outputs that should have gone to the ControlNet-style residual args.","solutions":["Remove down_intrablock_additional_residuals from the call","If using ControlNet, pass down_block_additional_residuals and mid_block_additional_residual instead"],"exampleFix":"# before\nunet(x, t, encoder_hidden_states=ctx, down_intrablock_additional_residuals=res)\n# after\nunet(x, t, encoder_hidden_states=ctx, down_block_additional_residuals=down_res, mid_block_additional_residual=mid_res)","handlingStrategy":"validation","validationCode":"if down_intrablock_additional_residuals is not None:\n    raise RuntimeError(\"T2I adapters unsupported; use ControlNet residuals instead\")","typeGuard":"def is_t2i_free(kwargs: dict) -> bool:\n    return kwargs.get(\"down_intrablock_additional_residuals\") is None","tryCatchPattern":null,"preventionTips":["Do not port T2I-Adapter pipeline branches into the Hunyuan3D runtime"],"tags":["t2i-adapter","unsupported-argument","hunyuan3d"],"backgroundTag":"unsupported-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}