Fix error with ClipVision loader node.

This commit is contained in:
comfyanonymous 2023-06-23 01:08:05 -04:00
parent 3e0686ce94
commit 9e37f4c7d5
2 changed files with 4 additions and 3 deletions

View File

@ -52,7 +52,8 @@ def convert_to_transformers(sd, prefix):
sd = transformers_convert(sd, prefix, "vision_model.", 32)
return sd
def load_clipvision_from_sd(sd, prefix):
def load_clipvision_from_sd(sd, prefix="", convert_keys=False):
if convert_keys:
sd = convert_to_transformers(sd, prefix)
if "vision_model.encoder.layers.30.layer_norm1.weight" in sd:
json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_h.json")

View File

@ -1049,7 +1049,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
if model_config.clip_vision_prefix is not None:
if output_clipvision:
clipvision = clip_vision.load_clipvision_from_sd(sd, model_config.clip_vision_prefix)
clipvision = clip_vision.load_clipvision_from_sd(sd, model_config.clip_vision_prefix, True)
model = model_config.get_model(sd)
model.load_model_weights(sd, "model.diffusion_model.")