Harry24k / adversarial-attacks-pytorch

PyTorch implementation of adversarial attacks [torchattacks].
https://adversarial-attacks-pytorch.readthedocs.io/en/latest/index.html
MIT License
1.79k stars 337 forks source link

The model loading in the demo seems to have become inactive[BUG] #166

Open wan3333 opened 7 months ago

wan3333 commented 7 months ago

✨ Short description of the bug [tl;dr]

The model loading in the demo seems to have become inactive

💬 Detailed code and results

model = load_model('Standard', norm='Linf').to(device) It seems cant load the model.

rikonaka commented 7 months ago

Hi @wan3333 , if you are a user in mainland China, please add a proxy when running the demo code...because some of the pre-trained models need to be downloaded from the Google driver.

If not, could you please provide the complete code? 😉

wan3333 commented 7 months ago

Yes, I have proxy, the complete code is in this repository’s demo directory, you can check it.

------------------ Original ------------------ From: isinstance @.> Date: Mon,Nov 13,2023 1:35 AM To: Harry24k/adversarial-attacks-pytorch @.> Cc: WAN @.>, Mention @.> Subject: Re: [Harry24k/adversarial-attacks-pytorch] The model loading in thedemo seems to have become inactive[BUG] (Issue #166)

rikonaka commented 7 months ago

Yes, I have proxy, the complete code is in this repository’s demo directory, you can check it. ------------------ Original ------------------ From: isinstance @.> Date: Mon,Nov 13,2023 1:35 AM To: Harry24k/adversarial-attacks-pytorch @.> Cc: WAN @.>, Mention @.> Subject: Re: [Harry24k/adversarial-attacks-pytorch] The model loading in thedemo seems to have become inactive[BUG] (Issue #166)

I can't reproduce the problem you raised.

ret

qqt-code commented 5 months ago

I also have this bug

rikonaka commented 5 months ago

I also have this bug

Which specific file are you having trouble with?

qqt-code commented 5 months ago

image In the demo of White-box Attack on CIFAR10,I download this model,and the content of it is above,so I can't load it.For this problem,i have switched two python version,first one can't download,and second one is the above result. I want to know if it's my operational mistake.

rikonaka commented 5 months ago

image In the demo of White-box Attack on CIFAR10,I download this model,and the content of it is above,so I can't load it.For this problem,i have switched two python version,first one can't download,and second one is the above result. I want to know if it's my operational mistake.

May I ask what is the size of your Standard.pt file?

I seem to have figured out why, there was a bug in robustbench download function from google driver, and that seems to have just been fixed, but the files included in torchattacks were not updated to the latest version of robustbench.

Please delete the robustbench folder in torchattacks and reclone from this repository https://github.com/RobustBench/robustbench.git, or reinstall it via pip uninstall robustbench then pip install git+https://github.com/RobustBench/robustbench.git , then it should work 😘.

Gorgerbin commented 4 months ago

image In the demo of White-box Attack on CIFAR10,I download this model,and the content of it is above,so I can't load it.For this problem,i have switched two python version,first one can't download,and second one is the above result. I want to know if it's my operational mistake.

do you resolve this problem please?

rikonaka commented 4 months ago

Hi @Gorgerbin @qqt-code @wan3333 , it seems that the problem is caused by the robustbench library, so until the problem is fixed upstream, you can test it with this new demo code: https://colab.research.google.com/drive/1atyo82sYeaZsbudgjt7jo25Cuv6ArzKB?usp=sharing or here: new_demo.zip

This requires three files, one for the trained model (resnet18_eval.pth) and two for the image and label (images.pth and labels.pth). These three files you can download from here:

😘😘😘

pingguokiller commented 2 months ago

I have the same problem.

In 'robustbench/utils.py': 'response = session.get(url_base, params={'id': gdrive_id}, stream=True)', when downloading the .pt file, google would give the warning info to ask you to confirm. So it downloads a file with html instead of the real pt file.

1712756824936

pingguokiller commented 2 months ago

I have the same problem.

In 'robustbench/utils.py': 'response = session.get(url_base, params={'id': gdrive_id}, stream=True)', when downloading the .pt file, google would give the warning info to ask you to confirm. So it downloads a file with html instead of the real pt file.

1712756824936

You can manually download the .pt file with url "https://docs.google.com/uc?export=download&confirm=t&id={gdrive_id}".