# download pre-trained weights
import os
path="weights_resnet18_cifar10.pth"
if not os.path.exists(path):
response = requests.get(
"https://unlearning-challenge.s3.eu-west-1.amazonaws.com/weights_resnet18_cifar10.pth"
)
open(path, "wb").write(response.content)
weights_pretrained = torch.load("weights_resnet18_cifar10.pth", map_location=DEVICE)
# load model with pre-trained weights
model = resnet18(weights=None, num_classes=10)
model.load_state_dict(weights_pretrained)
model.to(DEVICE)
model.eval();
Reasoning: Researchers will likely be running this code repeatedly, and the above just checks if the model is already downloaded before downloading it.
I suggest changing In [41] to
Reasoning: Researchers will likely be running this code repeatedly, and the above just checks if the model is already downloaded before downloading it.