Gustavo Belfort commited on
Commit
6dde274
1 Parent(s): 3ac23fa

change interface

Browse files
Files changed (1) hide show
  1. interface.py +10 -14
interface.py CHANGED
@@ -19,25 +19,21 @@ with open(cached_download(hf_hub_url('ykilcher/apes', 'gamma500/network-snapshot
19
  G = pickle.load(f)["G_ema"] # torch.nn.Module
20
 
21
  device = torch.device("cpu")
22
- if false:
23
- device = torch.device("cuda")
24
- G = G.to(device)
25
- else:
26
- _old_forward = G.forward
27
 
28
- def _new_forward(self, *args, **kwargs):
29
- kwargs["force_fp32"] = True
30
- return _old_forward(*args, **kwargs)
31
 
32
- G.forward = types.MethodType(_new_forward, G)
33
 
34
- _old_synthesis_forward = G.synthesis.forward
35
 
36
- def _new_synthesis_forward(self, *args, **kwargs):
37
- kwargs["force_fp32"] = True
38
- return _old_synthesis_forward(*args, **kwargs)
39
 
40
- G.synthesis.forward = types.MethodType(_new_synthesis_forward, G.synthesis)
41
 
42
 
43
  def generate(
 
19
  G = pickle.load(f)["G_ema"] # torch.nn.Module
20
 
21
  device = torch.device("cpu")
22
+ _old_forward = G.forward
 
 
 
 
23
 
24
+ def _new_forward(self, *args, **kwargs):
25
+ kwargs["force_fp32"] = True
26
+ return _old_forward(*args, **kwargs)
27
 
28
+ G.forward = types.MethodType(_new_forward, G)
29
 
30
+ _old_synthesis_forward = G.synthesis.forward
31
 
32
+ def _new_synthesis_forward(self, *args, **kwargs):
33
+ kwargs["force_fp32"] = True
34
+ return _old_synthesis_forward(*args, **kwargs)
35
 
36
+ G.synthesis.forward = types.MethodType(_new_synthesis_forward, G.synthesis)
37
 
38
 
39
  def generate(