Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollout for different ViT models #13

Open
Changgun-Choi opened this issue Apr 2, 2022 · 1 comment
Open

Rollout for different ViT models #13

Changgun-Choi opened this issue Apr 2, 2022 · 1 comment

Comments

@Changgun-Choi
Copy link

Changgun-Choi commented Apr 2, 2022

Hello,
I would like to use for different models and currently I used with

' elif args.model_name == 'dino_vit':
model = torch.hub.load('facebookresearch/dino:main', 'dino_vitb16').eval().to(device)'_

However, it gives error such as below. So the question is it is applicable to

  1. model = torch.hub.load('facebookresearch/dino:main', 'dino_resnet50').eval().to(device)

IndexError: list index out of range

  1. model = torch.hub.load('facebookresearch/dino:main', 'dino_xcit_medium_24_p16').eval().to(device) '

(myenv) python vit_explain_foolbox.py --model_name dino_xcit --attack_name LinfPGD --use_cuda --head_fusion "min" --discard_ratio 0.9
Using cache found in C:\Users.cache\torch\hub\facebookresearch_dino_main
Using cache found in C:\Users.cache\torch\hub\facebookresearch_xcit_main
epsilons
[0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3]
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
Doing Attention Rollout
Traceback (most recent call last):
File "vit_explain_foolbox.py", line 202, in
mask = attention_rollout(perturbed_data) ###############
File "\VisionTransformer\VisionTransformer\VisionTransformer\vit_rollout.py", line 68, in call
return rollout(self.attentions, self.discard_ratio, self.head_fusion)
File "\VisionTransformer\VisionTransformer\VisionTransformer\vit_rollout.py", line 33, in rollout
result = torch.matmul(a, result)

RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x64 and 197x197)

@qiaoyu1002
Copy link

IndexError: list index out of range

same error here, may I ask did you solve it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants