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
95fa9545
Commit
95fa9545
authored
Jul 20, 2024
by
comfyanonymous
Browse files
Only append zero to noise schedule if last sigma isn't zero.
parent
11b74147
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
comfy/samplers.py
comfy/samplers.py
+16
-4
No files found.
comfy/samplers.py
View file @
95fa9545
...
@@ -313,13 +313,18 @@ def simple_scheduler(model_sampling, steps):
...
@@ -313,13 +313,18 @@ def simple_scheduler(model_sampling, steps):
def
ddim_scheduler
(
model_sampling
,
steps
):
def
ddim_scheduler
(
model_sampling
,
steps
):
s
=
model_sampling
s
=
model_sampling
sigs
=
[]
sigs
=
[]
ss
=
max
(
len
(
s
.
sigmas
)
//
steps
,
1
)
x
=
1
x
=
1
if
math
.
isclose
(
float
(
s
.
sigmas
[
x
]),
0
,
abs_tol
=
0.00001
):
steps
+=
1
sigs
=
[]
else
:
sigs
=
[
0.0
]
ss
=
max
(
len
(
s
.
sigmas
)
//
steps
,
1
)
while
x
<
len
(
s
.
sigmas
):
while
x
<
len
(
s
.
sigmas
):
sigs
+=
[
float
(
s
.
sigmas
[
x
])]
sigs
+=
[
float
(
s
.
sigmas
[
x
])]
x
+=
ss
x
+=
ss
sigs
=
sigs
[::
-
1
]
sigs
=
sigs
[::
-
1
]
sigs
+=
[
0.0
]
return
torch
.
FloatTensor
(
sigs
)
return
torch
.
FloatTensor
(
sigs
)
def
normal_scheduler
(
model_sampling
,
steps
,
sgm
=
False
,
floor
=
False
):
def
normal_scheduler
(
model_sampling
,
steps
,
sgm
=
False
,
floor
=
False
):
...
@@ -327,16 +332,23 @@ def normal_scheduler(model_sampling, steps, sgm=False, floor=False):
...
@@ -327,16 +332,23 @@ def normal_scheduler(model_sampling, steps, sgm=False, floor=False):
start
=
s
.
timestep
(
s
.
sigma_max
)
start
=
s
.
timestep
(
s
.
sigma_max
)
end
=
s
.
timestep
(
s
.
sigma_min
)
end
=
s
.
timestep
(
s
.
sigma_min
)
append_zero
=
True
if
sgm
:
if
sgm
:
timesteps
=
torch
.
linspace
(
start
,
end
,
steps
+
1
)[:
-
1
]
timesteps
=
torch
.
linspace
(
start
,
end
,
steps
+
1
)[:
-
1
]
else
:
else
:
if
math
.
isclose
(
float
(
s
.
sigma
(
end
)),
0
,
abs_tol
=
0.00001
):
steps
+=
1
append_zero
=
False
timesteps
=
torch
.
linspace
(
start
,
end
,
steps
)
timesteps
=
torch
.
linspace
(
start
,
end
,
steps
)
sigs
=
[]
sigs
=
[]
for
x
in
range
(
len
(
timesteps
)):
for
x
in
range
(
len
(
timesteps
)):
ts
=
timesteps
[
x
]
ts
=
timesteps
[
x
]
sigs
.
append
(
s
.
sigma
(
ts
))
sigs
.
append
(
float
(
s
.
sigma
(
ts
)))
if
append_zero
:
sigs
+=
[
0.0
]
sigs
+=
[
0.0
]
return
torch
.
FloatTensor
(
sigs
)
return
torch
.
FloatTensor
(
sigs
)
# Implemented based on: https://arxiv.org/abs/2407.12173
# Implemented based on: https://arxiv.org/abs/2407.12173
...
...
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