Plachta commited on
Commit
4cde2bd
·
verified ·
1 Parent(s): 8a10c55

Change to fp16

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -283,13 +283,14 @@ def voice_conversion(source, target, diffusion_steps, length_adjust, inference_c
283
  chunk_cond = cond[:, processed_frames:processed_frames + max_source_window]
284
  is_last_chunk = processed_frames + max_source_window >= cond.size(1)
285
  cat_condition = torch.cat([prompt_condition, chunk_cond], dim=1)
286
- # Voice Conversion
287
- vc_target = inference_module.cfm.inference(cat_condition,
288
- torch.LongTensor([cat_condition.size(1)]).to(mel2.device),
289
- mel2, style2, None, diffusion_steps,
290
- inference_cfg_rate=inference_cfg_rate)
291
- vc_target = vc_target[:, :, mel2.size(-1):]
292
- vc_wave = bigvgan_fn(vc_target)[0]
 
293
  if processed_frames == 0:
294
  if is_last_chunk:
295
  output_wave = vc_wave[0].cpu().numpy()
 
283
  chunk_cond = cond[:, processed_frames:processed_frames + max_source_window]
284
  is_last_chunk = processed_frames + max_source_window >= cond.size(1)
285
  cat_condition = torch.cat([prompt_condition, chunk_cond], dim=1)
286
+ with torch.autocast(device_type='cuda', dtype=torch.float16):
287
+ # Voice Conversion
288
+ vc_target = inference_module.cfm.inference(cat_condition,
289
+ torch.LongTensor([cat_condition.size(1)]).to(mel2.device),
290
+ mel2, style2, None, diffusion_steps,
291
+ inference_cfg_rate=inference_cfg_rate)
292
+ vc_target = vc_target[:, :, mel2.size(-1):]
293
+ vc_wave = bigvgan_fn(vc_target)[0]
294
  if processed_frames == 0:
295
  if is_last_chunk:
296
  output_wave = vc_wave[0].cpu().numpy()