RobustBench / robustbench

RobustBench: a standardized adversarial robustness benchmark [NeurIPS 2021 Benchmarks and Datasets Track]
https://robustbench.github.io
Other
669 stars 99 forks source link

install error,could you help me check this problem, I use pip install git+https://github.com/RobustBench/robustbench.git #159

Closed ppxx21 closed 1 year ago

ppxx21 commented 1 year ago

Python 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import robustbench Traceback (most recent call last): File "", line 1, in File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/init.py", line 1, in from .data import load_cifar10 File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/data.py", line 15, in from robustbench.model_zoo import model_dicts as all_models File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/model_zoo/init.py", line 1, in from .models import model_dicts File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/model_zoo/models.py", line 4, in from robustbench.model_zoo.cifar10 import cifar_10_models File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/model_zoo/cifar10.py", line 24, in from robustbench.model_zoo.architectures.robustarch_wide_resnet import get_model as get_robustarch_model File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/model_zoo/architectures/robustarch_wide_resnet.py", line 352, in class BottleneckTransform(nn.Sequential): File "/home/px/anaconda3/envs/pytorch/lib/python3.8/site-packages/robustbench/model_zoo/architectures/robustarch_wide_resnet.py", line 363, in BottleneckTransform norm_layer: list[Callable[..., nn.Module]], TypeError: 'type' object is not subscriptable

dedeswim commented 1 year ago

Hi,

Looks like you're using Python 3.8, while the list type hint (as used in the newly added models) requires Python 3.9+.

It should work if you install robustbench in an environment with Python 3.9 or newer.

ppxx21 commented 1 year ago

Thanks so much!