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
da2ce1a6
"router/vscode:/vscode.git/clone" did not exist on "19c41824cb11ba1a3b60a2a65274d8c074383de3"
Unverified
Commit
da2ce1a6
authored
Apr 26, 2023
by
Patrick von Platen
Committed by
GitHub
Apr 26, 2023
Browse files
Allow return pt x4 (#3236)
* Add all files * update
parent
e51f19ae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
...nes/stable_diffusion/pipeline_stable_diffusion_upscale.py
+10
-5
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
View file @
da2ce1a6
...
...
@@ -697,15 +697,11 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
# 10. Post-processing
# make sure the VAE is in float32 mode, as it overflows in float16
self
.
vae
.
to
(
dtype
=
torch
.
float32
)
image
=
self
.
decode_latents
(
latents
.
float
())
# Offload last model to CPU
if
hasattr
(
self
,
"final_offload_hook"
)
and
self
.
final_offload_hook
is
not
None
:
self
.
final_offload_hook
.
offload
()
# 11. Convert to PIL
# has_nsfw_concept = False
if
output_type
==
"pil"
:
image
=
self
.
decode_latents
(
latents
.
float
())
image
,
has_nsfw_concept
,
_
=
self
.
run_safety_checker
(
image
,
device
,
prompt_embeds
.
dtype
)
image
=
self
.
numpy_to_pil
(
image
)
...
...
@@ -713,9 +709,18 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
# 11. Apply watermark
if
self
.
watermarker
is
not
None
:
image
=
self
.
watermarker
.
apply_watermark
(
image
)
elif
output_type
==
"pt"
:
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
.
float
()
image
=
self
.
vae
.
decode
(
latents
).
sample
has_nsfw_concept
=
None
else
:
image
=
self
.
decode_latents
(
latents
.
float
())
has_nsfw_concept
=
None
# Offload last model to CPU
if
hasattr
(
self
,
"final_offload_hook"
)
and
self
.
final_offload_hook
is
not
None
:
self
.
final_offload_hook
.
offload
()
if
not
return_dict
:
return
(
image
,
has_nsfw_concept
)
...
...
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