Closed sdan2 closed 3 years ago
How do I exactly load a pre-trained model? I have the downloaded cifar_linf_8.pt file. Then I do the following:
from robustness.cifar_models.resnet import ResNet50 model=ResNet50() model.load_state_dict(torch.load("cifar_nat.pt"))
However, I am getting an error saying the keys do not match. Do you have any suggestions on what to do? Thanks!
Yes, see the robustness.model_utils.make_and_restore_model function, that should help!
robustness.model_utils.make_and_restore_model
Thanks, that worked!
How do I exactly load a pre-trained model? I have the downloaded cifar_linf_8.pt file. Then I do the following:
from robustness.cifar_models.resnet import ResNet50 model=ResNet50() model.load_state_dict(torch.load("cifar_nat.pt"))
However, I am getting an error saying the keys do not match. Do you have any suggestions on what to do? Thanks!