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
c71a7e6b
Commit
c71a7e6b
authored
Jun 26, 2023
by
comfyanonymous
Browse files
Fix ddim + inpainting not working.
parent
4eab00e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
comfy/ldm/models/diffusion/ddim.py
comfy/ldm/models/diffusion/ddim.py
+7
-1
No files found.
comfy/ldm/models/diffusion/ddim.py
View file @
c71a7e6b
...
...
@@ -180,6 +180,12 @@ class DDIMSampler(object):
)
return
samples
,
intermediates
def
q_sample
(
self
,
x_start
,
t
,
noise
=
None
):
if
noise
is
None
:
noise
=
torch
.
randn_like
(
x_start
)
return
(
extract_into_tensor
(
self
.
sqrt_alphas_cumprod
,
t
,
x_start
.
shape
)
*
x_start
+
extract_into_tensor
(
self
.
sqrt_one_minus_alphas_cumprod
,
t
,
x_start
.
shape
)
*
noise
)
@
torch
.
no_grad
()
def
ddim_sampling
(
self
,
cond
,
shape
,
x_T
=
None
,
ddim_use_original_steps
=
False
,
...
...
@@ -214,7 +220,7 @@ class DDIMSampler(object):
if
mask
is
not
None
:
assert
x0
is
not
None
img_orig
=
self
.
model
.
q_sample
(
x0
,
ts
)
# TODO: deterministic forward pass?
img_orig
=
self
.
q_sample
(
x0
,
ts
)
# TODO: deterministic forward pass?
img
=
img_orig
*
mask
+
(
1.
-
mask
)
*
img
if
ucg_schedule
is
not
None
:
...
...
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