Skip to content

Commit

Permalink
fix: weights=None in vgg16 (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-thuy authored Sep 12, 2023
1 parent 9d33c5d commit f98fe7b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion experiments/ssl_experiments/pimodel_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def add_model_specific_args(parent_parser):
print("Active set length: {}".format(len(active_set)))
print("Pool set length: {}".format(len(active_set.pool)))

net = vgg11(pretrained=False, num_classes=10)
net = vgg11(weights=None, num_classes=10)

weights = load_state_dict_from_url("https://download.pytorch.org/models/vgg11-bbd30ac9.pth")
weights = {k: v for k, v in weights.items() if "classifier.6" not in k}
Expand Down
2 changes: 1 addition & 1 deletion experiments/ssl_experiments/pimodel_mcdropout_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def add_model_specific_args(parent_parser):
print("Pool set length: {}".format(len(active_set.pool)))

heuristic = get_heuristic(params.heuristic)
model = vgg16(pretrained=False, num_classes=10)
model = vgg16(weights=None, num_classes=10)
weights = load_state_dict_from_url("https://download.pytorch.org/models/vgg16-397923af.pth")
weights = {k: v for k, v in weights.items() if "classifier.6" not in k}
model.load_state_dict(weights, strict=False)
Expand Down
2 changes: 1 addition & 1 deletion experiments/vgg_mcdropout_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def main():

heuristic = get_heuristic(hyperparams["heuristic"], hyperparams["shuffle_prop"])
criterion = CrossEntropyLoss()
model = vgg16(pretrained=False, num_classes=10)
model = vgg16(weights=None, num_classes=10)
weights = load_state_dict_from_url("https://download.pytorch.org/models/vgg16-397923af.pth")
weights = {k: v for k, v in weights.items() if "classifier.6" not in k}
model.load_state_dict(weights, strict=False)
Expand Down

0 comments on commit f98fe7b

Please sign in to comment.