Last active
July 22, 2019 19:10
-
-
Save cvalenzuela/69fab737f85065041b113e0ee3c34297 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
## Sample code to generate an image using the | |
## pre-trained PGAN celebAHQ-512 checkpoint from the Pytorch Hub | |
import torch | |
use_gpu = True if torch.cuda.is_available() else False | |
# Load the model from the Pytorch Hub | |
model = torch.hub.load('facebookresearch/pytorch_GAN_zoo:hub', | |
'PGAN', model_name='celebAHQ-512', | |
pretrained=True, useGPU=use_gpu) | |
# Generate one image | |
noise, _ = model.buildNoiseData(1) | |
with torch.no_grad(): | |
generated_image = model.test(noise) | |
# Now generated_image contains our generated image! 🌞 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment