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
b35bac4d
Unverified
Commit
b35bac4d
authored
Oct 03, 2022
by
Patrick von Platen
Committed by
GitHub
Oct 03, 2022
Browse files
[Support PyTorch 1.8] Remove inference mode (#707)
parent
688031c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/diffusers/pipelines/stable_diffusion/safety_checker.py
src/diffusers/pipelines/stable_diffusion/safety_checker.py
+1
-1
No files found.
src/diffusers/pipelines/stable_diffusion/safety_checker.py
View file @
b35bac4d
...
@@ -79,7 +79,7 @@ class StableDiffusionSafetyChecker(PreTrainedModel):
...
@@ -79,7 +79,7 @@ class StableDiffusionSafetyChecker(PreTrainedModel):
return
images
,
has_nsfw_concepts
return
images
,
has_nsfw_concepts
@
torch
.
inference_mode
()
@
torch
.
no_grad
()
def
forward_onnx
(
self
,
clip_input
:
torch
.
FloatTensor
,
images
:
torch
.
FloatTensor
):
def
forward_onnx
(
self
,
clip_input
:
torch
.
FloatTensor
,
images
:
torch
.
FloatTensor
):
pooled_output
=
self
.
vision_model
(
clip_input
)[
1
]
# pooled_output
pooled_output
=
self
.
vision_model
(
clip_input
)[
1
]
# pooled_output
image_embeds
=
self
.
visual_projection
(
pooled_output
)
image_embeds
=
self
.
visual_projection
(
pooled_output
)
...
...
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