WindVChen / DiffAttack

An unrestricted attack based on diffusion models that can achieve both good transferability and imperceptibility.
Apache License 2.0
158 stars 14 forks source link

running error: ModuleNotFoundError: No module named 'pretrainedmodels' #16

Open LinyeLyuNeo opened 9 months ago

LinyeLyuNeo commented 9 months ago

Hi Chen, great work for adversarial attack using diffusion models, I am trying to run your code but getting the following errors:

python main.py --model_name "inception" --save_dir output --images_root demo/images --label_path demo/labels.txt Traceback (most recent call last): File "main.py", line 4, in import diff_latent_attack File "/home/Neo2/projects/DiffAttack/diff_latent_attack.py", line 8, in import other_attacks File "/home/Neo2/projects/DiffAttack/other_attacks.py", line 16, in from Finegrained_model import model as otherModel File "/home/Neo2/projects/DiffAttack/Finegrained_model/model.py", line 3, in from . import LoadModel File "/home/Neo2/projects/DiffAttack/Finegrained_model/LoadModel.py", line 4, in import pretrainedmodels ModuleNotFoundError: No module named 'pretrainedmodels'

I check the code file in LoadModel.py and find the error location: from torch import nn import torch from torchvision import models import pretrainedmodels from .config import pretrained_model

can you give me a hint on how to resolve this error so that I can run the attack on the demo image examples? Thanks!

WindVChen commented 9 months ago

Hi @LinyeLyuNeo ,

You can run pip install pretrainedmodels to solve it.

LinyeLyuNeo commented 9 months ago

Thanks, it fixed this issue, you can close this now!