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
b21a463a
Commit
b21a463a
authored
Nov 17, 2022
by
Patrick von Platen
Browse files
rg Merge branch 'main' of
https://github.com/huggingface/diffusers
parents
3b48620f
e05ca84f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py
...elines/stable_diffusion/pipeline_onnx_stable_diffusion.py
+4
-2
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
...table_diffusion/pipeline_onnx_stable_diffusion_img2img.py
+4
-2
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py
...table_diffusion/pipeline_onnx_stable_diffusion_inpaint.py
+4
-2
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py
View file @
b21a463a
...
@@ -261,8 +261,10 @@ class OnnxStableDiffusionPipeline(DiffusionPipeline):
...
@@ -261,8 +261,10 @@ class OnnxStableDiffusionPipeline(DiffusionPipeline):
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
# compute the previous noisy sample x_t -> x_t-1
# compute the previous noisy sample x_t -> x_t-1
latents
=
self
.
scheduler
.
step
(
noise_pred
,
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
).
prev_sample
scheduler_output
=
self
.
scheduler
.
step
(
latents
=
np
.
array
(
latents
)
torch
.
from_numpy
(
noise_pred
),
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
)
latents
=
scheduler_output
.
prev_sample
.
numpy
()
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
View file @
b21a463a
...
@@ -401,8 +401,10 @@ class OnnxStableDiffusionImg2ImgPipeline(DiffusionPipeline):
...
@@ -401,8 +401,10 @@ class OnnxStableDiffusionImg2ImgPipeline(DiffusionPipeline):
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
# compute the previous noisy sample x_t -> x_t-1
# compute the previous noisy sample x_t -> x_t-1
latents
=
self
.
scheduler
.
step
(
noise_pred
,
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
).
prev_sample
scheduler_output
=
self
.
scheduler
.
step
(
latents
=
latents
.
numpy
()
torch
.
from_numpy
(
noise_pred
),
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
)
latents
=
scheduler_output
.
prev_sample
.
numpy
()
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py
View file @
b21a463a
...
@@ -424,8 +424,10 @@ class OnnxStableDiffusionInpaintPipeline(DiffusionPipeline):
...
@@ -424,8 +424,10 @@ class OnnxStableDiffusionInpaintPipeline(DiffusionPipeline):
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
# compute the previous noisy sample x_t -> x_t-1
# compute the previous noisy sample x_t -> x_t-1
latents
=
self
.
scheduler
.
step
(
noise_pred
,
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
).
prev_sample
scheduler_output
=
self
.
scheduler
.
step
(
latents
=
latents
.
numpy
()
torch
.
from_numpy
(
noise_pred
),
t
,
torch
.
from_numpy
(
latents
),
**
extra_step_kwargs
)
latents
=
scheduler_output
.
prev_sample
.
numpy
()
# call the callback, if provided
# call the callback, if provided
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
if
callback
is
not
None
and
i
%
callback_steps
==
0
:
...
...
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