Skip to content

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

Open

Description

@LinyeLyuNeo

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!

Activity

  1. WindVChen commented on Feb 20, 2024

    @WindVChen
    Owner

    Hi @LinyeLyuNeo ,

    You can run pip install pretrainedmodels to solve it.

  2. LinyeLyuNeo commented on Feb 23, 2024

    @LinyeLyuNeo
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions