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
3a09fac8
Commit
3a09fac8
authored
Jul 03, 2023
by
comfyanonymous
Browse files
ConditioningAverage now also averages the pooled output.
parent
d94ddd85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
nodes.py
nodes.py
+9
-1
No files found.
nodes.py
View file @
3a09fac8
...
...
@@ -82,15 +82,23 @@ class ConditioningAverage :
print
(
"Warning: ConditioningAverage conditioning_from contains more than 1 cond, only the first one will actually be applied to conditioning_to."
)
cond_from
=
conditioning_from
[
0
][
0
]
pooled_output_from
=
conditioning_from
[
0
][
1
].
get
(
"pooled_output"
,
None
)
for
i
in
range
(
len
(
conditioning_to
)):
t1
=
conditioning_to
[
i
][
0
]
pooled_output_to
=
conditioning_to
[
i
][
1
].
get
(
"pooled_output"
,
pooled_output_from
)
t0
=
cond_from
[:,:
t1
.
shape
[
1
]]
if
t0
.
shape
[
1
]
<
t1
.
shape
[
1
]:
t0
=
torch
.
cat
([
t0
]
+
[
torch
.
zeros
((
1
,
(
t1
.
shape
[
1
]
-
t0
.
shape
[
1
]),
t1
.
shape
[
2
]))],
dim
=
1
)
tw
=
torch
.
mul
(
t1
,
conditioning_to_strength
)
+
torch
.
mul
(
t0
,
(
1.0
-
conditioning_to_strength
))
n
=
[
tw
,
conditioning_to
[
i
][
1
].
copy
()]
t_to
=
conditioning_to
[
i
][
1
].
copy
()
if
pooled_output_from
is
not
None
and
pooled_output_to
is
not
None
:
t_to
[
"pooled_output"
]
=
torch
.
mul
(
pooled_output_to
,
conditioning_to_strength
)
+
torch
.
mul
(
pooled_output_from
,
(
1.0
-
conditioning_to_strength
))
elif
pooled_output_from
is
not
None
:
t_to
[
"pooled_output"
]
=
pooled_output_from
n
=
[
tw
,
t_to
]
out
.
append
(
n
)
return
(
out
,
)
...
...
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