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
25a4805e
Commit
25a4805e
authored
Feb 09, 2024
by
comfyanonymous
Browse files
Add a way to set different conditioning for the controlnet.
parent
fd73b5ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
comfy/controlnet.py
comfy/controlnet.py
+1
-1
comfy/model_base.py
comfy/model_base.py
+4
-0
No files found.
comfy/controlnet.py
View file @
25a4805e
...
...
@@ -166,7 +166,7 @@ class ControlNet(ControlBase):
if
x_noisy
.
shape
[
0
]
!=
self
.
cond_hint
.
shape
[
0
]:
self
.
cond_hint
=
broadcast_image_to
(
self
.
cond_hint
,
x_noisy
.
shape
[
0
],
batched_number
)
context
=
cond
[
'c_crossattn'
]
context
=
cond
.
get
(
'crossattn_controlnet'
,
cond
[
'c_crossattn'
]
)
y
=
cond
.
get
(
'y'
,
None
)
if
y
is
not
None
:
y
=
y
.
to
(
dtype
)
...
...
comfy/model_base.py
View file @
25a4805e
...
...
@@ -153,6 +153,10 @@ class BaseModel(torch.nn.Module):
if
cross_attn
is
not
None
:
out
[
'c_crossattn'
]
=
comfy
.
conds
.
CONDCrossAttn
(
cross_attn
)
cross_attn_cnet
=
kwargs
.
get
(
"cross_attn_controlnet"
,
None
)
if
cross_attn_cnet
is
not
None
:
out
[
'crossattn_controlnet'
]
=
comfy
.
conds
.
CONDCrossAttn
(
cross_attn_cnet
)
return
out
def
load_model_weights
(
self
,
sd
,
unet_prefix
=
""
):
...
...
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