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
bf7b0bc2
Unverified
Commit
bf7b0bc2
authored
Oct 31, 2022
by
Pedro Cuenca
Committed by
GitHub
Oct 31, 2022
Browse files
Allow `safety_checker` to be `None` when using CPU offload (#1078)
Allow None safety_checker when using CPU offload.
parent
e4d264e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
...s/pipelines/stable_diffusion/pipeline_stable_diffusion.py
+2
-1
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
View file @
bf7b0bc2
...
@@ -133,7 +133,8 @@ class StableDiffusionPipeline(DiffusionPipeline):
...
@@ -133,7 +133,8 @@ class StableDiffusionPipeline(DiffusionPipeline):
device
=
torch
.
device
(
"cuda"
)
device
=
torch
.
device
(
"cuda"
)
for
cpu_offloaded_model
in
[
self
.
unet
,
self
.
text_encoder
,
self
.
vae
,
self
.
safety_checker
]:
for
cpu_offloaded_model
in
[
self
.
unet
,
self
.
text_encoder
,
self
.
vae
,
self
.
safety_checker
]:
cpu_offload
(
cpu_offloaded_model
,
device
)
if
cpu_offloaded_model
is
not
None
:
cpu_offload
(
cpu_offloaded_model
,
device
)
@
torch
.
no_grad
()
@
torch
.
no_grad
()
def
__call__
(
def
__call__
(
...
...
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