Skip to content

Commit

Permalink
[TorchFix] Update deprecated TorchVision pretrained parameters (#1193)
Browse files Browse the repository at this point in the history
Update deprecated TorchVision pretrained parameters
  • Loading branch information
kit1980 authored Oct 6, 2023
1 parent cead596 commit c67bbab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpp/transfer-learning/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torchvision import models

# Download and load the pre-trained model
model = models.resnet18(pretrained=True)
model = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)

# Set upgrading the gradients to False
for param in model.parameters():
Expand Down
2 changes: 1 addition & 1 deletion fast_neural_style/neural_style/vgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Vgg16(torch.nn.Module):
def __init__(self, requires_grad=False):
super(Vgg16, self).__init__()
vgg_pretrained_features = models.vgg16(pretrained=True).features
vgg_pretrained_features = models.vgg16(weights=models.VGG16_Weights.IMAGENET1K_V1).features
self.slice1 = torch.nn.Sequential()
self.slice2 = torch.nn.Sequential()
self.slice3 = torch.nn.Sequential()
Expand Down

0 comments on commit c67bbab

Please sign in to comment.