From a1698eaadd3b0bfec6e43d0390bf5ea1cf22c9ad Mon Sep 17 00:00:00 2001 From: smthemex <138738845+smthemex@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:20:07 +0800 Subject: [PATCH] Update model.py fix bug --- msdiffusion/models/model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msdiffusion/models/model.py b/msdiffusion/models/model.py index e26e69c..d66769c 100644 --- a/msdiffusion/models/model.py +++ b/msdiffusion/models/model.py @@ -215,8 +215,9 @@ class MSAdapter(torch.nn.Module): image_encoder_type=image_encoder_type, weight_dtype=weight_dtype,use_repo=use_repo) #print(image_embeds.shape) #torch.Size([1, 257, 1664]) if not use_repo: - image_embeds=image_embeds.cuda().half() + image_embeds=image_embeds.clone().detach().to(self.device, weight_dtype) image_prompt_embeds = self.image_proj_model(image_embeds, grounding_kwargs=grounding_kwargs) + del image_embeds image_prompt_embeds = image_prompt_embeds.view(bsz, -1, image_prompt_embeds.shape[-2], image_prompt_embeds.shape[ -1]) # (bsz, rn, num_tokens, cross_attention_dim)