Update utils.py

This commit is contained in:
smthemex
2024-11-11 20:38:30 +08:00
committed by GitHub
parent 37d2c3844e
commit 0fcd5fa26a
+3 -2
View File
@@ -150,7 +150,8 @@ def load_adapter_to_pipe(
raise ValueError(f"Missing keys in adapter_modules: {missing}")
if "image_proj" in state_dict.keys():
image_proj_model.load_state_dict(state_dict["image_proj"])
del state_dict #clear adapter dict
torch.cuda.empty_cache()
# convert IP-Adapter Image Projection layers to diffusers
image_projection_layers = []
image_projection_layers.append(image_proj_model)
@@ -245,4 +246,4 @@ def prepare_training_image_embeds(
)
image_embeds.append(single_image_embeds)
return image_embeds
return image_embeds