From 0fcd5fa26abe6771a744d83e642faa249d8871c3 Mon Sep 17 00:00:00 2001 From: smthemex <138738845+smthemex@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:38:30 +0800 Subject: [PATCH] Update utils.py --- module/ip_adapter/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/ip_adapter/utils.py b/module/ip_adapter/utils.py index 64c45cd..ca7bd5c 100644 --- a/module/ip_adapter/utils.py +++ b/module/ip_adapter/utils.py @@ -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 \ No newline at end of file + return image_embeds