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
4c5718a0
Unverified
Commit
4c5718a0
authored
Sep 04, 2023
by
YiYi Xu
Committed by
GitHub
Sep 04, 2023
Browse files
fix a bug in StableDiffusionUpscalePipeline.run_safety_checker (#4886)
fix Co-authored-by:
yiyixuxu
<
yixu310@gmail,com
>
parent
2340ed62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
...nes/stable_diffusion/pipeline_stable_diffusion_upscale.py
+2
-2
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
View file @
4c5718a0
...
@@ -165,10 +165,10 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
...
@@ -165,10 +165,10 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
# We'll offload the last model manually.
# We'll offload the last model manually.
self
.
final_offload_hook
=
hook
self
.
final_offload_hook
=
hook
# Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline.run_safety_checker
def
run_safety_checker
(
self
,
image
,
device
,
dtype
):
def
run_safety_checker
(
self
,
image
,
device
,
dtype
):
if
self
.
safety_checker
is
not
None
:
if
self
.
safety_checker
is
not
None
:
safety_checker_input
=
self
.
feature_extractor
(
self
.
numpy_to_pil
(
image
),
return_tensors
=
"pt"
).
to
(
device
)
feature_extractor_input
=
self
.
image_processor
.
postprocess
(
image
,
output_type
=
"pil"
)
safety_checker_input
=
self
.
feature_extractor
(
feature_extractor_input
,
return_tensors
=
"pt"
).
to
(
device
)
image
,
nsfw_detected
,
watermark_detected
=
self
.
safety_checker
(
image
,
nsfw_detected
,
watermark_detected
=
self
.
safety_checker
(
images
=
image
,
images
=
image
,
clip_input
=
safety_checker_input
.
pixel_values
.
to
(
dtype
=
dtype
),
clip_input
=
safety_checker_input
.
pixel_values
.
to
(
dtype
=
dtype
),
...
...
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