fahadshamshad / Clip2Protect

[CVPR 2023] Official repository of paper titled "CLIP2Protect: Protecting Facial Privacy using Text-Guided Makeup via Adversarial Latent Search".
https://fahadshamshad.github.io/Clip2Protect/
98 stars 12 forks source link

AttributeError: 'dict' object has no attribute 'eval' #6

Closed hwaseem04 closed 1 year ago

hwaseem04 commented 1 year ago

Configurations: I have Cuda 12.0 in local system, so I had to install latest PyTorch version to enable GPU for PyTorch. I was able to get latent code (latent.pt), obtain the FR model and placed everything in the appropriate directories

When I tried running

python main.py --data_dir input_images --latent_path latents.pt --protected_face_dir results

I got

AttributeError: 'dict' object has no attribute 'eval'

This is caused in line 209 in adversarial_optimization.py. i.e g_ema = torch.load(self.generators[ff]).eval() #loading fine-tuned generator

Generally, we use model.load(weight.pt) after creating the model instance model=Model(). Is the above error because of this or this is arising because of different Pytorch versions?

hwaseem04 commented 1 year ago

This is attributed to the different Cuda versions. The issue is solved when I used the versions specified in the repository. Hence closing it.