Skip to content

Commit

Permalink
fp16 for app_svc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Plachtaa committed Nov 29, 2024
1 parent bc3a72b commit a516247
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app_svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ def voice_conversion(source, target, diffusion_steps, length_adjust, inference_c
chunk_f0 = interpolated_shifted_f0_alt[:, processed_frames:processed_frames + max_source_window]
is_last_chunk = processed_frames + max_source_window >= cond.size(1)
cat_condition = torch.cat([prompt_condition, chunk_cond], dim=1)
# with torch.autocast(device_type=device.type, dtype=torch.float16 if fp16 else torch.float32):
# Voice Conversion
vc_target = inference_module.cfm.inference(cat_condition,
torch.LongTensor([cat_condition.size(1)]).to(mel2.device),
mel2, style2, None, diffusion_steps,
inference_cfg_rate=inference_cfg_rate)
vc_target = vc_target[:, :, mel2.size(-1):]
vc_wave = vocoder_fn(vc_target).squeeze().cpu()
with torch.autocast(device_type=device.type, dtype=torch.float16 if fp16 else torch.float32):
# Voice Conversion
vc_target = inference_module.cfm.inference(cat_condition,
torch.LongTensor([cat_condition.size(1)]).to(mel2.device),
mel2, style2, None, diffusion_steps,
inference_cfg_rate=inference_cfg_rate)
vc_target = vc_target[:, :, mel2.size(-1):]
vc_wave = vocoder_fn(vc_target).squeeze().cpu()
if vc_wave.ndim == 1:
vc_wave = vc_wave.unsqueeze(0)
if processed_frames == 0:
Expand Down

0 comments on commit a516247

Please sign in to comment.