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
0d65cb17
Commit
0d65cb17
authored
Mar 28, 2023
by
comfyanonymous
Browse files
Fix ddim_uniform crashing with 37 steps.
parent
31dd6c05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
comfy/samplers.py
comfy/samplers.py
+5
-2
No files found.
comfy/samplers.py
View file @
0d65cb17
...
@@ -242,7 +242,10 @@ def ddim_scheduler(model, steps):
...
@@ -242,7 +242,10 @@ def ddim_scheduler(model, steps):
sigs
=
[]
sigs
=
[]
ddim_timesteps
=
make_ddim_timesteps
(
ddim_discr_method
=
"uniform"
,
num_ddim_timesteps
=
steps
,
num_ddpm_timesteps
=
model
.
inner_model
.
inner_model
.
num_timesteps
,
verbose
=
False
)
ddim_timesteps
=
make_ddim_timesteps
(
ddim_discr_method
=
"uniform"
,
num_ddim_timesteps
=
steps
,
num_ddpm_timesteps
=
model
.
inner_model
.
inner_model
.
num_timesteps
,
verbose
=
False
)
for
x
in
range
(
len
(
ddim_timesteps
)
-
1
,
-
1
,
-
1
):
for
x
in
range
(
len
(
ddim_timesteps
)
-
1
,
-
1
,
-
1
):
sigs
.
append
(
model
.
t_to_sigma
(
torch
.
tensor
(
ddim_timesteps
[
x
])))
ts
=
ddim_timesteps
[
x
]
if
ts
>
999
:
ts
=
999
sigs
.
append
(
model
.
t_to_sigma
(
torch
.
tensor
(
ts
)))
sigs
+=
[
0.0
]
sigs
+=
[
0.0
]
return
torch
.
FloatTensor
(
sigs
)
return
torch
.
FloatTensor
(
sigs
)
...
@@ -373,7 +376,7 @@ class KSampler:
...
@@ -373,7 +376,7 @@ class KSampler:
def
set_steps
(
self
,
steps
,
denoise
=
None
):
def
set_steps
(
self
,
steps
,
denoise
=
None
):
self
.
steps
=
steps
self
.
steps
=
steps
if
denoise
is
None
:
if
denoise
is
None
or
denoise
>
0.9999
:
self
.
sigmas
=
self
.
_calculate_sigmas
(
steps
)
self
.
sigmas
=
self
.
_calculate_sigmas
(
steps
)
else
:
else
:
new_steps
=
int
(
steps
/
denoise
)
new_steps
=
int
(
steps
/
denoise
)
...
...
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