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
20e3da6b
Commit
20e3da6b
authored
Feb 10, 2024
by
comfyanonymous
Browse files
Add a node to give the controlnet a prompt different from the unet.
parent
f44225fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
comfy_extras/nodes_cond.py
comfy_extras/nodes_cond.py
+25
-0
nodes.py
nodes.py
+1
-0
No files found.
comfy_extras/nodes_cond.py
0 → 100644
View file @
20e3da6b
class
CLIPTextEncodeControlnet
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"clip"
:
(
"CLIP"
,
),
"conditioning"
:
(
"CONDITIONING"
,
),
"text"
:
(
"STRING"
,
{
"multiline"
:
True
})}}
RETURN_TYPES
=
(
"CONDITIONING"
,)
FUNCTION
=
"encode"
CATEGORY
=
"_for_testing/conditioning"
def
encode
(
self
,
clip
,
conditioning
,
text
):
tokens
=
clip
.
tokenize
(
text
)
cond
,
pooled
=
clip
.
encode_from_tokens
(
tokens
,
return_pooled
=
True
)
c
=
[]
for
t
in
conditioning
:
n
=
[
t
[
0
],
t
[
1
].
copy
()]
n
[
1
][
'cross_attn_controlnet'
]
=
cond
n
[
1
][
'pooled_output_controlnet'
]
=
pooled
c
.
append
(
n
)
return
(
c
,
)
NODE_CLASS_MAPPINGS
=
{
"CLIPTextEncodeControlnet"
:
CLIPTextEncodeControlnet
}
nodes.py
View file @
20e3da6b
...
@@ -1965,6 +1965,7 @@ def init_custom_nodes():
...
@@ -1965,6 +1965,7 @@ def init_custom_nodes():
"nodes_stable3d.py"
,
"nodes_stable3d.py"
,
"nodes_sdupscale.py"
,
"nodes_sdupscale.py"
,
"nodes_photomaker.py"
,
"nodes_photomaker.py"
,
"nodes_cond.py"
,
]
]
for
node_file
in
extras_files
:
for
node_file
in
extras_files
:
...
...
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