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
6a491ebe
Commit
6a491ebe
authored
Nov 21, 2023
by
comfyanonymous
Browse files
Allow model config to preprocess the vae state dict on load.
parent
d66b631d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
comfy/sd.py
comfy/sd.py
+1
-0
comfy/supported_models_base.py
comfy/supported_models_base.py
+3
-0
No files found.
comfy/sd.py
View file @
6a491ebe
...
@@ -448,6 +448,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
...
@@ -448,6 +448,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
if
output_vae
:
if
output_vae
:
vae_sd
=
comfy
.
utils
.
state_dict_prefix_replace
(
sd
,
{
"first_stage_model."
:
""
},
filter_keys
=
True
)
vae_sd
=
comfy
.
utils
.
state_dict_prefix_replace
(
sd
,
{
"first_stage_model."
:
""
},
filter_keys
=
True
)
vae_sd
=
model_config
.
process_vae_state_dict
(
vae_sd
)
vae
=
VAE
(
sd
=
vae_sd
)
vae
=
VAE
(
sd
=
vae_sd
)
if
output_clip
:
if
output_clip
:
...
...
comfy/supported_models_base.py
View file @
6a491ebe
...
@@ -56,6 +56,9 @@ class BASE:
...
@@ -56,6 +56,9 @@ class BASE:
def
process_unet_state_dict
(
self
,
state_dict
):
def
process_unet_state_dict
(
self
,
state_dict
):
return
state_dict
return
state_dict
def
process_vae_state_dict
(
self
,
state_dict
):
return
state_dict
def
process_clip_state_dict_for_saving
(
self
,
state_dict
):
def
process_clip_state_dict_for_saving
(
self
,
state_dict
):
replace_prefix
=
{
""
:
"cond_stage_model."
}
replace_prefix
=
{
""
:
"cond_stage_model."
}
return
utils
.
state_dict_prefix_replace
(
state_dict
,
replace_prefix
)
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