import torch
import runway
import numpy as np
+ @runway.setup(options={"checkpoint": runway.category(description="Pretrained checkpoints to use.",
+ choices=['celebAHQ-512', 'celebAHQ-256', 'celeba'],
+ default='celebAHQ-512')})
+ def setup(opts):
+ checkpoint = opts['checkpoint']
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=checkpoint,
pretrained=True, useGPU=use_gpu)
+ return model
# Generate one image
noise, _ = model.buildNoiseData(1)
with torch.no_grad():
generated_image = model.test(noise)
# Now generated_image contains our generated image! 🌞
Last active
July 31, 2019 13:23
-
-
Save cvalenzuela/8184aed018562d2d7036b2e3980e3229 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment