Spaces:
Runtime error
Runtime error
Update Time_TravelRephotography/projector.py
Browse files
Time_TravelRephotography/projector.py
CHANGED
@@ -67,9 +67,13 @@ def normalize(img: torch.Tensor, mean=0.5, std=0.5):
|
|
67 |
return (img - mean) / std
|
68 |
|
69 |
|
70 |
-
def create_generator(args: Namespace, device: torch.device):
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
73 |
generator.eval()
|
74 |
generator = generator.to(device)
|
75 |
return generator
|
|
|
67 |
return (img - mean) / std
|
68 |
|
69 |
|
70 |
+
def create_generator(file_name: str, path:str,args: Namespace, device: torch.device):
|
71 |
+
path = hf_hub_download(f'{path}',
|
72 |
+
f'{file_name}',
|
73 |
+
use_auth_token=TOKEN)
|
74 |
+
with open(path, 'rb') as f:
|
75 |
+
generator = Generator(args.generator_size, 512, 8)
|
76 |
+
generator.load_state_dict(torch.load(f)['g_ema'], strict=False)
|
77 |
generator.eval()
|
78 |
generator = generator.to(device)
|
79 |
return generator
|