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