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
chenpangpang
ComfyUI
Commits
45be2e92
Commit
45be2e92
authored
Jun 17, 2023
by
comfyanonymous
Browse files
Fix DDIM v-prediction.
parent
e6192787
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
comfy/ldm/models/diffusion/ddim.py
comfy/ldm/models/diffusion/ddim.py
+2
-2
No files found.
comfy/ldm/models/diffusion/ddim.py
View file @
45be2e92
...
...
@@ -284,7 +284,7 @@ class DDIMSampler(object):
model_output
=
model_uncond
+
unconditional_guidance_scale
*
(
model_t
-
model_uncond
)
if
self
.
model
.
parameterization
==
"v"
:
e_t
=
self
.
model
.
predict_eps_from_z_and_v
(
x
,
t
,
model_output
)
e_t
=
extract_into_tensor
(
self
.
sqrt_alphas_cumprod
,
t
,
x
.
shape
)
*
model_output
+
extract_into_tensor
(
self
.
sqrt_one_minus_alphas_cumprod
,
t
,
x
.
shape
)
*
x
else
:
e_t
=
model_output
...
...
@@ -306,7 +306,7 @@ class DDIMSampler(object):
if
self
.
model
.
parameterization
!=
"v"
:
pred_x0
=
(
x
-
sqrt_one_minus_at
*
e_t
)
/
a_t
.
sqrt
()
else
:
pred_x0
=
self
.
model
.
predict_start_from_z_and_v
(
x
,
t
,
model_output
)
pred_x0
=
extract_into_tensor
(
self
.
sqrt_alphas_cumprod
,
t
,
x
.
shape
)
*
x
-
extract_into_tensor
(
self
.
sqrt_one_minus_alphas_cumprod
,
t
,
x
.
shape
)
*
model_output
if
quantize_denoised
:
pred_x0
,
_
,
*
_
=
self
.
model
.
first_stage_model
.
quantize
(
pred_x0
)
...
...
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