From 5f4418afbd04eac5615a7650491dfc4dd9cec44a Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Thu, 7 Dec 2023 10:03:37 +0530 Subject: [PATCH 1/2] do sigmas edits from the pipeline. --- .../stable_diffusion_xl/pipeline_stable_diffusion_xl.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py b/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py index c8c6247960af..0641b6d5f9ab 100644 --- a/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +++ b/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py @@ -1106,6 +1106,9 @@ def __call__( # 4. Prepare timesteps timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps) + # Helpful when using `torch.compile()` to get a nice graph. + if self.scheduler.sigmas.device.type == "cuda": + self.scheduler.sigmas = self.scheduler.sigmas.tolist() # 5. Prepare latent variables num_channels_latents = self.unet.config.in_channels From 06d7d5f81e67ade485af1bcf57351e6f096733eb Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Thu, 7 Dec 2023 12:31:32 +0530 Subject: [PATCH 2/2] fix --- .../stable_diffusion_xl/pipeline_stable_diffusion_xl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py b/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py index 0641b6d5f9ab..02b5f63e3940 100644 --- a/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +++ b/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py @@ -1107,7 +1107,7 @@ def __call__( # 4. Prepare timesteps timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps) # Helpful when using `torch.compile()` to get a nice graph. - if self.scheduler.sigmas.device.type == "cuda": + if hasattr(self.scheduler, "sigmas") and self.scheduler.sigmas.device.type == "cuda": self.scheduler.sigmas = self.scheduler.sigmas.tolist() # 5. Prepare latent variables