Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
diffusers
Commits
16a3dad4
Unverified
Commit
16a3dad4
authored
Aug 21, 2024
by
Sangwon Lee
Committed by
GitHub
Aug 20, 2024
Browse files
Fix StableDiffusionXLPAGInpaintPipeline (#9128)
parent
21682bab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
src/diffusers/pipelines/auto_pipeline.py
src/diffusers/pipelines/auto_pipeline.py
+2
-1
src/diffusers/pipelines/pag/pipeline_pag_sd_xl_inpaint.py
src/diffusers/pipelines/pag/pipeline_pag_sd_xl_inpaint.py
+11
-3
No files found.
src/diffusers/pipelines/auto_pipeline.py
View file @
16a3dad4
...
...
@@ -955,7 +955,8 @@ class AutoPipelineForInpainting(ConfigMixin):
if
"enable_pag"
in
kwargs
:
enable_pag
=
kwargs
.
pop
(
"enable_pag"
)
if
enable_pag
:
orig_class_name
=
config
[
"_class_name"
].
replace
(
"Pipeline"
,
"PAGPipeline"
)
to_replace
=
"InpaintPipeline"
if
"Inpaint"
in
config
[
"_class_name"
]
else
"Pipeline"
orig_class_name
=
config
[
"_class_name"
].
replace
(
to_replace
,
"PAG"
+
to_replace
)
inpainting_cls
=
_get_task_class
(
AUTO_INPAINT_PIPELINES_MAPPING
,
orig_class_name
)
...
...
src/diffusers/pipelines/pag/pipeline_pag_sd_xl_inpaint.py
View file @
16a3dad4
...
...
@@ -1471,6 +1471,14 @@ class StableDiffusionXLPAGInpaintPipeline(
generator
,
self
.
do_classifier_free_guidance
,
)
if
self
.
do_perturbed_attention_guidance
:
if
self
.
do_classifier_free_guidance
:
mask
,
_
=
mask
.
chunk
(
2
)
masked_image_latents
,
_
=
masked_image_latents
.
chunk
(
2
)
mask
=
self
.
_prepare_perturbed_attention_guidance
(
mask
,
mask
,
self
.
do_classifier_free_guidance
)
masked_image_latents
=
self
.
_prepare_perturbed_attention_guidance
(
masked_image_latents
,
masked_image_latents
,
self
.
do_classifier_free_guidance
)
# 8. Check that sizes of mask, masked image and latents match
if
num_channels_unet
==
9
:
...
...
@@ -1659,10 +1667,10 @@ class StableDiffusionXLPAGInpaintPipeline(
if
num_channels_unet
==
4
:
init_latents_proper
=
image_latents
if
self
.
do_
classifier_free
_guidance
:
init_mask
,
_
=
mask
.
chunk
(
2
)
if
self
.
do_
perturbed_attention
_guidance
:
init_mask
,
*
_
=
mask
.
chunk
(
3
)
if
self
.
do_classifier_free_guidance
else
mask
.
chunk
(
2
)
else
:
init_mask
=
mask
init_mask
,
*
_
=
mask
.
chunk
(
2
)
if
self
.
do_classifier_free_guidance
else
mask
if
i
<
len
(
timesteps
)
-
1
:
noise_timestep
=
timesteps
[
i
+
1
]
...
...
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