From 3bdad89dce3c1839ab1cf9d8cba0e1beb9a12122 Mon Sep 17 00:00:00 2001 From: laradipupo Date: Mon, 13 Jul 2026 08:49:01 +0100 Subject: [PATCH] [DtoH sync] set scheduler begin index in SD3 T2I Reference: https://github.com/huggingface/diffusers/pull/11696 --- .../stable_diffusion_3/pipeline_stable_diffusion_3.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py b/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py index 5c05b469660f..c3cd014f9b6c 100644 --- a/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py +++ b/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py @@ -1058,6 +1058,12 @@ def __call__( self._joint_attention_kwargs.update(ip_adapter_image_embeds=ip_adapter_image_embeds) # 7. Denoising loop + + # We set the index here to remove DtoH sync, helpful especially during compilation. + # Check out more details here: https://github.com/huggingface/diffusers/pull/11696 + if hasattr(self.scheduler, "set_begin_index"): + self.scheduler.set_begin_index(0) + with self.progress_bar(total=num_inference_steps) as progress_bar: for i, t in enumerate(timesteps): if self.interrupt: