Update app.py
Browse files
app.py
CHANGED
|
@@ -72,9 +72,15 @@ def make_transform(translate: Tuple[float,float], angle: float):
|
|
| 72 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 73 |
|
| 74 |
config_file_url = hf_hub_url("autonomousvision/Projected_GAN_Pokemon", filename="pokemon.pkl")
|
|
|
|
| 75 |
with dnnlib.util.open_url(config_file_url) as f:
|
| 76 |
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
def generate_images(seeds):
|
| 80 |
label = torch.zeros([1, G.c_dim], device=device)
|
|
|
|
| 72 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 73 |
|
| 74 |
config_file_url = hf_hub_url("autonomousvision/Projected_GAN_Pokemon", filename="pokemon.pkl")
|
| 75 |
+
|
| 76 |
with dnnlib.util.open_url(config_file_url) as f:
|
| 77 |
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
|
| 78 |
|
| 79 |
+
for m in G.modules():
|
| 80 |
+
if isinstance(m, torch.nn.Upsample):
|
| 81 |
+
if not hasattr(m, 'recompute_scale_factor'):
|
| 82 |
+
m.recompute_scale_factor = None
|
| 83 |
+
|
| 84 |
|
| 85 |
def generate_images(seeds):
|
| 86 |
label = torch.zeros([1, G.c_dim], device=device)
|