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
ce67dcbc
Commit
ce67dcbc
authored
Nov 20, 2023
by
comfyanonymous
Browse files
Make it easy for models to process the unet state dict on load.
parent
2dd5b4dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
comfy/model_base.py
comfy/model_base.py
+1
-0
comfy/supported_models_base.py
comfy/supported_models_base.py
+3
-0
No files found.
comfy/model_base.py
View file @
ce67dcbc
...
...
@@ -121,6 +121,7 @@ class BaseModel(torch.nn.Module):
if
k
.
startswith
(
unet_prefix
):
to_load
[
k
[
len
(
unet_prefix
):]]
=
sd
.
pop
(
k
)
to_load
=
self
.
model_config
.
process_unet_state_dict
(
to_load
)
m
,
u
=
self
.
diffusion_model
.
load_state_dict
(
to_load
,
strict
=
False
)
if
len
(
m
)
>
0
:
print
(
"unet missing:"
,
m
)
...
...
comfy/supported_models_base.py
View file @
ce67dcbc
...
...
@@ -53,6 +53,9 @@ class BASE:
def
process_clip_state_dict
(
self
,
state_dict
):
return
state_dict
def
process_unet_state_dict
(
self
,
state_dict
):
return
state_dict
def
process_clip_state_dict_for_saving
(
self
,
state_dict
):
replace_prefix
=
{
""
:
"cond_stage_model."
}
return
utils
.
state_dict_prefix_replace
(
state_dict
,
replace_prefix
)
...
...
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