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
2455aaed
"git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "d6ee6bdb487b34d21c77f7d47522086c9ddfefaf"
Commit
2455aaed
authored
Nov 01, 2023
by
comfyanonymous
Browse files
Allow model or clip to be None in load_lora_for_models.
parent
45a3df1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
comfy/sd.py
comfy/sd.py
+19
-6
No files found.
comfy/sd.py
View file @
2455aaed
...
@@ -55,13 +55,26 @@ def load_clip_weights(model, sd):
...
@@ -55,13 +55,26 @@ def load_clip_weights(model, sd):
def
load_lora_for_models
(
model
,
clip
,
lora
,
strength_model
,
strength_clip
):
def
load_lora_for_models
(
model
,
clip
,
lora
,
strength_model
,
strength_clip
):
key_map
=
comfy
.
lora
.
model_lora_keys_unet
(
model
.
model
)
key_map
=
{}
key_map
=
comfy
.
lora
.
model_lora_keys_clip
(
clip
.
cond_stage_model
,
key_map
)
if
model
is
not
None
:
key_map
=
comfy
.
lora
.
model_lora_keys_unet
(
model
.
model
,
key_map
)
if
clip
is
not
None
:
key_map
=
comfy
.
lora
.
model_lora_keys_clip
(
clip
.
cond_stage_model
,
key_map
)
loaded
=
comfy
.
lora
.
load_lora
(
lora
,
key_map
)
loaded
=
comfy
.
lora
.
load_lora
(
lora
,
key_map
)
new_modelpatcher
=
model
.
clone
()
if
model
is
not
None
:
k
=
new_modelpatcher
.
add_patches
(
loaded
,
strength_model
)
new_modelpatcher
=
model
.
clone
()
new_clip
=
clip
.
clone
()
k
=
new_modelpatcher
.
add_patches
(
loaded
,
strength_model
)
k1
=
new_clip
.
add_patches
(
loaded
,
strength_clip
)
else
:
k
=
()
new_modelpatcher
=
None
if
clip
is
not
None
:
new_clip
=
clip
.
clone
()
k1
=
new_clip
.
add_patches
(
loaded
,
strength_clip
)
else
:
k1
=
()
new_clip
=
None
k
=
set
(
k
)
k
=
set
(
k
)
k1
=
set
(
k1
)
k1
=
set
(
k1
)
for
x
in
loaded
:
for
x
in
loaded
:
...
...
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