1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

Fix loading SD1.5 diffusers checkpoint.

This commit is contained in:
comfyanonymous
2023-04-07 01:28:15 -04:00
parent 8b9ac8fedb
commit 58ed0f2da4
2 changed files with 5 additions and 3 deletions

View File

@@ -272,7 +272,8 @@ def load_diffusers(model_path, fp16=True, output_vae=True, output_clip=True, emb
# magic
v2 = diffusers_unet_conf["sample_size"] == 96
v_pred = diffusers_scheduler_conf['prediction_type'] == 'v_prediction'
if 'prediction_type' in diffusers_scheduler_conf:
v_pred = diffusers_scheduler_conf['prediction_type'] == 'v_prediction'
if v2:
if v_pred:
@@ -290,6 +291,7 @@ def load_diffusers(model_path, fp16=True, output_vae=True, output_clip=True, emb
scale_factor = model_config_params['scale_factor']
vae_config = model_config_params['first_stage_config']
vae_config['scale_factor'] = scale_factor
model_config_params["unet_config"]["params"]["use_fp16"] = fp16
unet_path = osp.join(model_path, "unet", "diffusion_pytorch_model.safetensors")
vae_path = osp.join(model_path, "vae", "diffusion_pytorch_model.safetensors")