Skip to content

Commit

Permalink
perf(inference_main): do dummy inference before running vc (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j committed Mar 20, 2023
1 parent 2252fb1 commit 4066c43
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/so_vits_svc_fork/inference_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ def realtime(
f"Input Device: {devices[input_device]['name']}, Output Device: {devices[output_device]['name']}"
)

# the model realtime coef is somewhat significantly low only in the first inference
# there could be no better way to warm up the model than to do a dummy inference
# (there are not differences in the behavior of the model between the first and the later inferences)
# so we do a dummy inference to warm up the model (1 second of audio)
LOG.info("Warming up the model...")
svc_model.infer(
speaker=speaker,
transpose=transpose,
auto_predict_f0=auto_predict_f0,
cluster_infer_ratio=cluster_infer_ratio,
noise_scale=noise_scale,
f0_method=f0_method,
audio=np.zeros(svc_model.target_sample, dtype=np.float32),
)

def callback(
indata: np.ndarray,
outdata: np.ndarray,
Expand Down

0 comments on commit 4066c43

Please sign in to comment.