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
1e5f0f66
"git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "6346cd320a83a85203c50ea9c212458cff7359a0"
Commit
1e5f0f66
authored
Feb 23, 2024
by
comfyanonymous
Browse files
Support lora keys with lora_prior_unet_ and lora_prior_te_
parent
e1cb93c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
comfy/lora.py
comfy/lora.py
+3
-0
No files found.
comfy/lora.py
View file @
1e5f0f66
...
@@ -197,6 +197,8 @@ def model_lora_keys_clip(model, key_map={}):
...
@@ -197,6 +197,8 @@ def model_lora_keys_clip(model, key_map={}):
key_map
[
lora_key
]
=
k
key_map
[
lora_key
]
=
k
lora_key
=
"text_encoder.text_model.encoder.layers.{}.{}"
.
format
(
b
,
c
)
#diffusers lora
lora_key
=
"text_encoder.text_model.encoder.layers.{}.{}"
.
format
(
b
,
c
)
#diffusers lora
key_map
[
lora_key
]
=
k
key_map
[
lora_key
]
=
k
lora_key
=
"lora_prior_te_text_model_encoder_layers_{}_{}"
.
format
(
b
,
LORA_CLIP_MAP
[
c
])
#cascade lora: TODO put lora key prefix in the model config
key_map
[
lora_key
]
=
k
return
key_map
return
key_map
...
@@ -207,6 +209,7 @@ def model_lora_keys_unet(model, key_map={}):
...
@@ -207,6 +209,7 @@ def model_lora_keys_unet(model, key_map={}):
if
k
.
startswith
(
"diffusion_model."
)
and
k
.
endswith
(
".weight"
):
if
k
.
startswith
(
"diffusion_model."
)
and
k
.
endswith
(
".weight"
):
key_lora
=
k
[
len
(
"diffusion_model."
):
-
len
(
".weight"
)].
replace
(
"."
,
"_"
)
key_lora
=
k
[
len
(
"diffusion_model."
):
-
len
(
".weight"
)].
replace
(
"."
,
"_"
)
key_map
[
"lora_unet_{}"
.
format
(
key_lora
)]
=
k
key_map
[
"lora_unet_{}"
.
format
(
key_lora
)]
=
k
key_map
[
"lora_prior_unet_{}"
.
format
(
key_lora
)]
=
k
#cascade lora: TODO put lora key prefix in the model config
diffusers_keys
=
comfy
.
utils
.
unet_to_diffusers
(
model
.
model_config
.
unet_config
)
diffusers_keys
=
comfy
.
utils
.
unet_to_diffusers
(
model
.
model_config
.
unet_config
)
for
k
in
diffusers_keys
:
for
k
in
diffusers_keys
:
...
...
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