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
ffe0bb0a
Commit
ffe0bb0a
authored
Jul 10, 2024
by
comfyanonymous
Browse files
Remove useless code.
parent
391c1046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
30 deletions
+0
-30
comfy/sd.py
comfy/sd.py
+0
-30
No files found.
comfy/sd.py
View file @
ffe0bb0a
...
...
@@ -28,36 +28,6 @@ import comfy.t2i_adapter.adapter
import
comfy.supported_models_base
import
comfy.taesd.taesd
def
load_model_weights
(
model
,
sd
):
m
,
u
=
model
.
load_state_dict
(
sd
,
strict
=
False
)
m
=
set
(
m
)
unexpected_keys
=
set
(
u
)
k
=
list
(
sd
.
keys
())
for
x
in
k
:
if
x
not
in
unexpected_keys
:
w
=
sd
.
pop
(
x
)
del
w
if
len
(
m
)
>
0
:
logging
.
warning
(
"missing {}"
.
format
(
m
))
return
model
def
load_clip_weights
(
model
,
sd
):
k
=
list
(
sd
.
keys
())
for
x
in
k
:
if
x
.
startswith
(
"cond_stage_model.transformer."
)
and
not
x
.
startswith
(
"cond_stage_model.transformer.text_model."
):
y
=
x
.
replace
(
"cond_stage_model.transformer."
,
"cond_stage_model.transformer.text_model."
)
sd
[
y
]
=
sd
.
pop
(
x
)
if
'cond_stage_model.transformer.text_model.embeddings.position_ids'
in
sd
:
ids
=
sd
[
'cond_stage_model.transformer.text_model.embeddings.position_ids'
]
if
ids
.
dtype
==
torch
.
float32
:
sd
[
'cond_stage_model.transformer.text_model.embeddings.position_ids'
]
=
ids
.
round
()
sd
=
comfy
.
utils
.
clip_text_transformers_convert
(
sd
,
"cond_stage_model.model."
,
"cond_stage_model.transformer."
)
return
load_model_weights
(
model
,
sd
)
def
load_lora_for_models
(
model
,
clip
,
lora
,
strength_model
,
strength_clip
):
key_map
=
{}
if
model
is
not
None
:
...
...
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