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
4798cf5a
"comfy/vscode:/vscode.git/clone" did not exist on "b4f434ee66b109df67be83265c1b158e3794b241"
Commit
4798cf5a
authored
Aug 28, 2023
by
comfyanonymous
Browse files
Implement loras with norm keys.
parent
0faee118
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
comfy/lora.py
comfy/lora.py
+13
-0
No files found.
comfy/lora.py
View file @
4798cf5a
...
...
@@ -118,6 +118,19 @@ def load_lora(lora, to_load):
if
(
lokr_w1
is
not
None
)
or
(
lokr_w2
is
not
None
)
or
(
lokr_w1_a
is
not
None
)
or
(
lokr_w2_a
is
not
None
):
patch_dict
[
to_load
[
x
]]
=
(
lokr_w1
,
lokr_w2
,
alpha
,
lokr_w1_a
,
lokr_w1_b
,
lokr_w2_a
,
lokr_w2_b
,
lokr_t2
)
w_norm_name
=
"{}.w_norm"
.
format
(
x
)
b_norm_name
=
"{}.b_norm"
.
format
(
x
)
w_norm
=
lora
.
get
(
w_norm_name
,
None
)
b_norm
=
lora
.
get
(
b_norm_name
,
None
)
if
w_norm
is
not
None
:
loaded_keys
.
add
(
w_norm_name
)
patch_dict
[
to_load
[
x
]]
=
(
w_norm
,)
if
b_norm
is
not
None
:
loaded_keys
.
add
(
b_norm_name
)
patch_dict
[
"{}.bias"
.
format
(
to_load
[
x
][:
-
len
(
".weight"
)])]
=
(
b_norm
,)
for
x
in
lora
.
keys
():
if
x
not
in
loaded_keys
:
print
(
"lora key not loaded"
,
x
)
...
...
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