Errors when downloading models from model zoom
JAMES-YI opened this issue · 1 comments
✨ Short description of the bug [tl;dr]
When I tried to run the following: adversarial-attacks-pytorch/demo
/White-box Attack on CIFAR10.ipynb, the model file "Standard.pt" does not look right and it has has size of 3kb.
Here is the error reported
File "...\anaconda3\envs\PTC2-2-1\Lib\site-packages\robustbench\utils.py", line 135, in load_model
checkpoint = torch.load(model_path, map_location=torch.device('cpu'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\anaconda3\envs\PTC2-2-1\Lib\site-packages\torch\serialization.py", line 1040, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\anaconda3\envs\PTC2-2-1\Lib\site-packages\torch\serialization.py", line 1258, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, '<'.
💬 Detailed code and results
sys.path.insert(0, '..')
import robustbench
from robustbench.data import load_cifar10
from robustbench.utils import load_model, clean_accuracy
images, labels = load_cifar10(n_examples=5)
print('[Data loaded]')
device = "cuda"
model = load_model('Standard', norm='Linf').to(device)
acc = clean_accuracy(model, images.to(device), labels.to(device))
print('[Model loaded]')
print('Acc: %2.2f %%'%(acc*100))