ffhibnese / CPGC_VLP_Universal_Attacks

Universal Adversarial Attack, Multimodal Adversarial Attacks, VLP models, Contrastive Learning, Cross-modal Perturbation Generator, Generative Attacks.
7 stars 0 forks source link

bug #1

Open TheLiao233 opened 1 day ago

TheLiao233 commented 1 day ago

Hello, thank you for your outstanding work and publishing the relevant code. I had some problems when I tried to use the command python train.py --config configs/Retrieval_flickr_train.yaml --source_model ViT-B/16 --source_ckpt '/media/nlp/data/tl/model/vit'to reproduce.

The following error occurred when I set os.environ["CUDA_VISIBLE_DEVICES"] = '0,1' to run

image

So change clamp_norm = torch.clamp(norm, self.min_norm, self.max_norm) to clamp_norm = torch.clamp(norm, self.min_norm.to(norm.device), self.max_norm.to(norm.device))

But then the following problem occurred, so I removed the self.methodfrom the loss_infoNCE = self.loss_func(adv_txt_embeds, img_embeds, txt2img, target_img_embeds, self.temperature,self.method)

image

Finally, I encountered the following problems, and then I tried to directly change loss.backward()to loss.backward(retain_graph=True), and finally the GPU memory overflowed, but no solution was found at present, I hope you can help me solve it, thank you very much!

image

ffhibnese commented 1 day ago

We're sorry about the bugs due to a busy schedule and did not carefully check the uploaded code. We will soon update the repository to correct existing issues. Thanks again for your attention and the reminder about these problems.