AAOBA commited on
Commit
b182a23
1 Parent(s): 2edbce5

Using FP16 for inference, trying to avoid weird, stupidly long inference time.

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -78,8 +78,8 @@ def infer(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, sid, langua
78
  x_tst = phones.to(device).unsqueeze(0)
79
  tones = tones.to(device).unsqueeze(0)
80
  lang_ids = lang_ids.to(device).unsqueeze(0)
81
- bert = bert.to(device).unsqueeze(0)
82
- ja_bert = ja_bert.to(device).unsqueeze(0)
83
  x_tst_lengths = torch.LongTensor([phones.size(0)]).to(device)
84
  del phones
85
  speakers = torch.LongTensor([hps.data.spk2id[sid]]).to(device)
@@ -172,7 +172,7 @@ if __name__ == "__main__":
172
  hps.train.segment_size // hps.data.hop_length,
173
  n_speakers=hps.data.n_speakers,
174
  **hps.model,
175
- ).to(device)
176
  _ = net_g.eval()
177
 
178
  _ = utils.load_checkpoint(args.model, net_g, None, skip_optimizer=True)
 
78
  x_tst = phones.to(device).unsqueeze(0)
79
  tones = tones.to(device).unsqueeze(0)
80
  lang_ids = lang_ids.to(device).unsqueeze(0)
81
+ bert = bert.half().to(device).unsqueeze(0)
82
+ ja_bert = ja_bert.half().to(device).unsqueeze(0)
83
  x_tst_lengths = torch.LongTensor([phones.size(0)]).to(device)
84
  del phones
85
  speakers = torch.LongTensor([hps.data.spk2id[sid]]).to(device)
 
172
  hps.train.segment_size // hps.data.hop_length,
173
  n_speakers=hps.data.n_speakers,
174
  **hps.model,
175
+ ).half().to(device)
176
  _ = net_g.eval()
177
 
178
  _ = utils.load_checkpoint(args.model, net_g, None, skip_optimizer=True)