Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
beb85668
Unverified
Commit
beb85668
authored
Dec 02, 2024
by
hlky
Committed by
GitHub
Dec 02, 2024
Browse files
Fix `num_images_per_prompt>1` with Skip Guidance Layers in `StableDiffusion3Pipeline` (#10086)
parent
a9d3f6c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py
...pelines/stable_diffusion_3/pipeline_stable_diffusion_3.py
+3
-5
No files found.
src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py
View file @
beb85668
...
@@ -907,11 +907,7 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
...
@@ -907,11 +907,7 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
continue
continue
# expand the latents if we are doing classifier free guidance
# expand the latents if we are doing classifier free guidance
latent_model_input
=
(
latent_model_input
=
torch
.
cat
([
latents
]
*
2
)
if
self
.
do_classifier_free_guidance
else
latents
torch
.
cat
([
latents
]
*
2
)
if
self
.
do_classifier_free_guidance
and
skip_guidance_layers
is
None
else
latents
)
# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
timestep
=
t
.
expand
(
latent_model_input
.
shape
[
0
])
timestep
=
t
.
expand
(
latent_model_input
.
shape
[
0
])
...
@@ -935,6 +931,8 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
...
@@ -935,6 +931,8 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
else
False
else
False
)
)
if
skip_guidance_layers
is
not
None
and
should_skip_layers
:
if
skip_guidance_layers
is
not
None
and
should_skip_layers
:
timestep
=
t
.
expand
(
latents
.
shape
[
0
])
latent_model_input
=
latents
noise_pred_skip_layers
=
self
.
transformer
(
noise_pred_skip_layers
=
self
.
transformer
(
hidden_states
=
latent_model_input
,
hidden_states
=
latent_model_input
,
timestep
=
timestep
,
timestep
=
timestep
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment