Skip to content

Commit beb8566

Browse files
authored
Fix num_images_per_prompt>1 with Skip Guidance Layers in StableDiffusion3Pipeline (#10086)
1 parent a9d3f6c commit beb8566

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,7 @@ def __call__(
907907
continue
908908

909909
# expand the latents if we are doing classifier free guidance
910-
latent_model_input = (
911-
torch.cat([latents] * 2)
912-
if self.do_classifier_free_guidance and skip_guidance_layers is None
913-
else latents
914-
)
910+
latent_model_input = torch.cat([latents] * 2) if self.do_classifier_free_guidance else latents
915911
# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
916912
timestep = t.expand(latent_model_input.shape[0])
917913

@@ -935,6 +931,8 @@ def __call__(
935931
else False
936932
)
937933
if skip_guidance_layers is not None and should_skip_layers:
934+
timestep = t.expand(latents.shape[0])
935+
latent_model_input = latents
938936
noise_pred_skip_layers = self.transformer(
939937
hidden_states=latent_model_input,
940938
timestep=timestep,

0 commit comments

Comments
 (0)