Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Allow model config to preprocess the vae state dict on load.

comfyanonymous6a491ebe2729
diff --git a/comfy/sd.py b/comfy/sd.py
index 0f83cc581..c006a0362 100644
--- a/comfy/sd.py
+++ b/comfy/sd.py
@@ -448,6 +448,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
if output_vae:
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)
if output_clip:
diff --git a/comfy/supported_models_base.py b/comfy/supported_models_base.py
index 6dfae0343..b073eb4fc 100644
--- a/comfy/supported_models_base.py
+++ b/comfy/supported_models_base.py
@@ -56,6 +56,9 @@ class BASE:
def process_unet_state_dict(self, 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):
replace_prefix = {"": "cond_stage_model."}
return utils.state_dict_prefix_replace(state_dict, replace_prefix)