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

Cannot save adversarial examples when using MultiAttack #44

Closed
tsunghan-wu opened this issue Oct 23, 2021 · 1 comment
Closed

Cannot save adversarial examples when using MultiAttack #44

tsunghan-wu opened this issue Oct 23, 2021 · 1 comment

Comments

@tsunghan-wu
Copy link

Hi,

I encountered errors when using MultiAttack.
Here is my code segment:

# cifar100_eval_loader = ... (initialize my dataloader)
eps = 8 / 255
alpha = 2 / 255
atk1 = TIFGSM(srcnet, eps=eps, alpha=alpha, steps=40)
atk2 = DIFGSM(srcnet, eps=eps, alpha=alpha, steps=40)
atk = MultiAttack([atk1, atk2])
atk.set_return_type('int')  # Save as integer.
atk.save(data_loader=cifar100_eval_loader, save_path=save_path, verbose=True)

However, the following error messages occurs:

- Save complete!
Traceback (most recent call last):
  File "/tmp2/attack/src/adv_attack.py", line 162, in <module>
    atk.save(data_loader=cifar100_eval_loader, save_path=save_path, verbose=True)
  File "/home/tsunghan/miniconda3/envs/SPML/lib/python3.9/site-packages/torchattacks/attacks/multiattack.py", line 105, in save
    rob_acc, l2, elapsed_time = super().save(data_loader, save_path, verbose, return_verbose)
TypeError: cannot unpack non-iterable NoneType object

I wonder that whether the MultiAttack.save() method contains bugs?
Thanks!

@Harry24k
Copy link
Owner

return_verbose=False raises the problem in version 3.2.0.
Bug fixed in version 3.2.2.
Thanks!

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