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
b416be7d
"...git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "d95c3513119c3b383411e900e7769bb92e0ca3ac"
Commit
b416be7d
authored
Feb 27, 2024
by
comfyanonymous
Browse files
Make the text projection saved in the checkpoint the right format.
parent
03c47fc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
comfy/diffusers_convert.py
comfy/diffusers_convert.py
+4
-0
comfy/utils.py
comfy/utils.py
+1
-1
No files found.
comfy/diffusers_convert.py
View file @
b416be7d
...
...
@@ -237,6 +237,10 @@ def convert_text_enc_state_dict_v20(text_enc_dict, prefix=""):
capture_qkv_bias
[
k_pre
][
code2idx
[
k_code
]]
=
v
continue
text_proj
=
"transformer.text_projection.weight"
if
k
.
endswith
(
text_proj
):
new_state_dict
[
k
.
replace
(
text_proj
,
"text_projection"
)]
=
v
.
transpose
(
0
,
1
).
contiguous
()
relabelled_key
=
textenc_pattern
.
sub
(
lambda
m
:
protected
[
re
.
escape
(
m
.
group
(
0
))],
k
)
new_state_dict
[
relabelled_key
]
=
v
...
...
comfy/utils.py
View file @
b416be7d
...
...
@@ -110,7 +110,7 @@ def clip_text_transformers_convert(sd, prefix_from, prefix_to):
tp
=
"{}text_projection"
.
format
(
prefix_from
)
if
tp
in
sd
:
sd
[
"{}text_projection.weight"
.
format
(
prefix_to
)]
=
sd
.
pop
(
tp
).
transpose
(
0
,
1
)
sd
[
"{}text_projection.weight"
.
format
(
prefix_to
)]
=
sd
.
pop
(
tp
).
transpose
(
0
,
1
)
.
contiguous
()
return
sd
...
...
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