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
OpenDAS
diffusers
Commits
ca1e4072
Unverified
Commit
ca1e4072
authored
Mar 21, 2023
by
Will Berman
Committed by
GitHub
Mar 21, 2023
Browse files
stable diffusion depth batching fix (#2757)
parent
b33bd91f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py
...s/stable_diffusion/pipeline_stable_diffusion_depth2img.py
+2
-1
tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py
...pelines/stable_diffusion_2/test_stable_diffusion_depth.py
+1
-1
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py
View file @
ca1e4072
...
...
@@ -474,7 +474,8 @@ class StableDiffusionDepth2ImgPipeline(DiffusionPipeline):
# duplicate mask and masked_image_latents for each generation per prompt, using mps friendly method
if
depth_map
.
shape
[
0
]
<
batch_size
:
depth_map
=
depth_map
.
repeat
(
batch_size
,
1
,
1
,
1
)
repeat_by
=
batch_size
//
depth_map
.
shape
[
0
]
depth_map
=
depth_map
.
repeat
(
repeat_by
,
1
,
1
,
1
)
depth_map
=
torch
.
cat
([
depth_map
]
*
2
)
if
do_classifier_free_guidance
else
depth_map
return
depth_map
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py
View file @
ca1e4072
...
...
@@ -64,7 +64,7 @@ class StableDiffusionDepth2ImgPipelineFastTests(PipelineTesterMixin, unittest.Te
test_save_load_optional_components
=
False
params
=
TEXT_GUIDED_IMAGE_VARIATION_PARAMS
-
{
"height"
,
"width"
}
required_optional_params
=
PipelineTesterMixin
.
required_optional_params
-
{
"latents"
}
batch_params
=
TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
-
{
"image"
}
batch_params
=
TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
def
get_dummy_components
(
self
):
torch
.
manual_seed
(
0
)
...
...
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