Spaces:
Running
on
Zero
Running
on
Zero
Change to fp16
Browse files
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 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
|
|
|
| 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()
|