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
cf10c559
Commit
cf10c559
authored
Aug 09, 2023
by
comfyanonymous
Browse files
Disable calculating uncond when CFG is 1.0
parent
5ac96897
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
comfy/samplers.py
comfy/samplers.py
+9
-5
No files found.
comfy/samplers.py
View file @
cf10c559
...
@@ -189,12 +189,13 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, con
...
@@ -189,12 +189,13 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, con
continue
continue
to_run
+=
[(
p
,
COND
)]
to_run
+=
[(
p
,
COND
)]
for
x
in
uncond
:
if
uncond
is
not
None
:
p
=
get_area_and_mult
(
x
,
x_in
,
cond_concat_in
,
timestep
)
for
x
in
uncond
:
if
p
is
None
:
p
=
get_area_and_mult
(
x
,
x_in
,
cond_concat_in
,
timestep
)
continue
if
p
is
None
:
continue
to_run
+=
[(
p
,
UNCOND
)]
to_run
+=
[(
p
,
UNCOND
)]
while
len
(
to_run
)
>
0
:
while
len
(
to_run
)
>
0
:
first
=
to_run
[
0
]
first
=
to_run
[
0
]
...
@@ -282,6 +283,9 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, con
...
@@ -282,6 +283,9 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, con
max_total_area
=
model_management
.
maximum_batch_area
()
max_total_area
=
model_management
.
maximum_batch_area
()
if
math
.
isclose
(
cond_scale
,
1.0
):
uncond
=
None
cond
,
uncond
=
calc_cond_uncond_batch
(
model_function
,
cond
,
uncond
,
x
,
timestep
,
max_total_area
,
cond_concat
,
model_options
)
cond
,
uncond
=
calc_cond_uncond_batch
(
model_function
,
cond
,
uncond
,
x
,
timestep
,
max_total_area
,
cond_concat
,
model_options
)
if
"sampler_cfg_function"
in
model_options
:
if
"sampler_cfg_function"
in
model_options
:
args
=
{
"cond"
:
cond
,
"uncond"
:
uncond
,
"cond_scale"
:
cond_scale
,
"timestep"
:
timestep
}
args
=
{
"cond"
:
cond
,
"uncond"
:
uncond
,
"cond_scale"
:
cond_scale
,
"timestep"
:
timestep
}
...
...
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