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
1e6b6710
Commit
1e6b6710
authored
Sep 08, 2023
by
comfyanonymous
Browse files
Support diffusers format t2i adapters.
parent
ff962098
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
comfy/controlnet.py
comfy/controlnet.py
+11
-3
No files found.
comfy/controlnet.py
View file @
1e6b6710
...
...
@@ -449,10 +449,18 @@ class T2IAdapter(ControlBase):
return
c
def
load_t2i_adapter
(
t2i_data
):
keys
=
t2i_data
.
keys
()
if
'adapter'
in
keys
:
if
'adapter'
in
t2i_data
:
t2i_data
=
t2i_data
[
'adapter'
]
keys
=
t2i_data
.
keys
()
if
'adapter.body.0.resnets.0.block1.weight'
in
t2i_data
:
#diffusers format
prefix_replace
=
{}
for
i
in
range
(
4
):
for
j
in
range
(
2
):
prefix_replace
[
"adapter.body.{}.resnets.{}."
.
format
(
i
,
j
)]
=
"body.{}."
.
format
(
i
*
2
+
j
)
prefix_replace
[
"adapter.body.{}."
.
format
(
i
,
j
)]
=
"body.{}."
.
format
(
i
*
2
)
prefix_replace
[
"adapter."
]
=
""
t2i_data
=
comfy
.
utils
.
state_dict_prefix_replace
(
t2i_data
,
prefix_replace
)
keys
=
t2i_data
.
keys
()
if
"body.0.in_conv.weight"
in
keys
:
cin
=
t2i_data
[
'body.0.in_conv.weight'
].
shape
[
1
]
model_ad
=
comfy
.
t2i_adapter
.
adapter
.
Adapter_light
(
cin
=
cin
,
channels
=
[
320
,
640
,
1280
,
1280
],
nums_rb
=
4
)
...
...
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