Created
May 5, 2019 13:59
-
-
Save KushajveerSingh/00a676b93cc31b0394db8548bcd7f2aa to your computer and use it in GitHub Desktop.
Load VGG model and pytorch essentials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if torch.cuda.is_available(): | |
device = torch.device('cuda') | |
else: | |
raise Exception('GPU is not available') | |
# Load VGG19 features. We do not need the last linear layers, | |
# only CNN layers are needed | |
vgg = vgg19(pretrained=True).features | |
vgg = vgg.to(device) | |
# We don't want to train VGG | |
for param in vgg.parameters(): | |
param.requires_grad_(False) | |
torch.backends.cudnn.benchmark = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment