-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Description
| leave_1_probs_argmax = torch.argmax(leave_1_probs, dim=-1) |
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/OpenAttack/attack_eval/utils.py", line 10, in attack_process
adversarial_sample = attacker(victim, data)
File "/usr/local/lib/python3.10/site-packages/OpenAttack/attackers/classification.py", line 28, in __call__
adversarial_sample = self.attack(victim, input_["x"], goal)
File "/usr/local/lib/python3.10/site-packages/OpenAttack/attackers/bert_attack/__init__.py", line 119, in attack
important_scores = self.get_important_scores(words, victim, current_prob, goal.target, orig_probs)
File "/usr/local/lib/python3.10/site-packages/OpenAttack/attackers/bert_attack/__init__.py", line 241, in get_important_scores
(leave_1_probs_argmax != orig_label).float()
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
This bug can be fixed by moving orig_label to cpu
orig_label = orig_label.to(torch.device('cpu'))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels