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
4151fbfa
Unverified
Commit
4151fbfa
authored
Jul 22, 2024
by
Chenlei Hu
Committed by
GitHub
Jul 22, 2024
Browse files
Add error message on union controlnet (#4081)
parent
6045ed31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
11 deletions
+25
-11
comfy/cldm/cldm.py
comfy/cldm/cldm.py
+13
-0
comfy/cldm/control_types.py
comfy/cldm/control_types.py
+11
-0
comfy_extras/nodes_controlnet.py
comfy_extras/nodes_controlnet.py
+1
-11
No files found.
comfy/cldm/cldm.py
View file @
4151fbfa
...
@@ -13,6 +13,7 @@ from ..ldm.modules.diffusionmodules.util import (
...
@@ -13,6 +13,7 @@ from ..ldm.modules.diffusionmodules.util import (
from
..ldm.modules.attention
import
SpatialTransformer
from
..ldm.modules.attention
import
SpatialTransformer
from
..ldm.modules.diffusionmodules.openaimodel
import
UNetModel
,
TimestepEmbedSequential
,
ResBlock
,
Downsample
from
..ldm.modules.diffusionmodules.openaimodel
import
UNetModel
,
TimestepEmbedSequential
,
ResBlock
,
Downsample
from
..ldm.util
import
exists
from
..ldm.util
import
exists
from
.control_types
import
UNION_CONTROLNET_TYPES
from
collections
import
OrderedDict
from
collections
import
OrderedDict
import
comfy.ops
import
comfy.ops
from
comfy.ldm.modules.attention
import
optimized_attention
from
comfy.ldm.modules.attention
import
optimized_attention
...
@@ -390,6 +391,18 @@ class ControlNet(nn.Module):
...
@@ -390,6 +391,18 @@ class ControlNet(nn.Module):
if
self
.
control_add_embedding
is
not
None
:
#Union Controlnet
if
self
.
control_add_embedding
is
not
None
:
#Union Controlnet
control_type
=
kwargs
.
get
(
"control_type"
,
[])
control_type
=
kwargs
.
get
(
"control_type"
,
[])
if
any
([
c
>=
self
.
num_control_type
for
c
in
control_type
]):
max_type
=
max
(
control_type
)
max_type_name
=
{
v
:
k
for
k
,
v
in
UNION_CONTROLNET_TYPES
.
items
()
}[
max_type
]
raise
ValueError
(
f
"Control type
{
max_type_name
}
(
{
max_type
}
) is out of range for the number of control types"
+
f
"(
{
self
.
num_control_type
}
) supported.
\n
"
+
"Please consider using the ProMax ControlNet Union model.
\n
"
+
"https://huggingface.co/xinsir/controlnet-union-sdxl-1.0/tree/main"
)
emb
+=
self
.
control_add_embedding
(
control_type
,
emb
.
dtype
,
emb
.
device
)
emb
+=
self
.
control_add_embedding
(
control_type
,
emb
.
dtype
,
emb
.
device
)
if
len
(
control_type
)
>
0
:
if
len
(
control_type
)
>
0
:
if
len
(
hint
.
shape
)
<
5
:
if
len
(
hint
.
shape
)
<
5
:
...
...
comfy/cldm/control_types.py
0 → 100644
View file @
4151fbfa
UNION_CONTROLNET_TYPES
=
{
"auto"
:
-
1
,
"openpose"
:
0
,
"depth"
:
1
,
"hed/pidi/scribble/ted"
:
2
,
"canny/lineart/anime_lineart/mlsd"
:
3
,
"normal"
:
4
,
"segment"
:
5
,
"tile"
:
6
,
"repaint"
:
7
,
}
comfy_extras/nodes_controlnet.py
View file @
4151fbfa
from
comfy.cldm.control_types
import
UNION_CONTROLNET_TYPES
UNION_CONTROLNET_TYPES
=
{
"auto"
:
-
1
,
"openpose"
:
0
,
"depth"
:
1
,
"hed/pidi/scribble/ted"
:
2
,
"canny/lineart/anime_lineart/mlsd"
:
3
,
"normal"
:
4
,
"segment"
:
5
,
"tile"
:
6
,
"repaint"
:
7
,
}
class
SetUnionControlNetType
:
class
SetUnionControlNetType
:
@
classmethod
@
classmethod
...
...
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