From 7d8b2c8308088e05a36a6f46e910b63cf6df6320 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 2 May 2023 02:24:05 -0700 Subject: [PATCH] lots more logging --- .../so_vits_svc_fork/inference/infer_tool.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/voice_conversion/so-vits-svc-paul/src/so_vits_svc_fork/inference/infer_tool.py b/voice_conversion/so-vits-svc-paul/src/so_vits_svc_fork/inference/infer_tool.py index dba6eef..eeb7d22 100644 --- a/voice_conversion/so-vits-svc-paul/src/so_vits_svc_fork/inference/infer_tool.py +++ b/voice_conversion/so-vits-svc-paul/src/so_vits_svc_fork/inference/infer_tool.py @@ -165,33 +165,72 @@ class Svc: "crepe", "crepe-tiny", "parselmouth", "dio", "harvest" ] = "dio", ): + LOG.warn("get_unit_f0(): f0_method = {}".format(f0_method)) + + LOG.warn("get_unit_f0(): compute_f0() ...") + f0 = utils.compute_f0( audio, sampling_rate=self.target_sample, hop_length=self.hop_size, method=f0_method, ) + + LOG.warn("get_unit_f0(): compute_f0() - END") + + LOG.warn("get_unit_f0(): interpolate_f0()... ") + f0, uv = utils.interpolate_f0(f0) + + LOG.warn("get_unit_f0(): interpolate_f0() - END") + f0 = torch.FloatTensor(f0) uv = torch.FloatTensor(uv) f0 = f0 * 2 ** (tran / 12) f0 = f0.unsqueeze(0).to(self.dev) uv = uv.unsqueeze(0).to(self.dev) + LOG.warn("get_unit_f0(): librosa.resample() ...") + wav16k = librosa.resample( audio, orig_sr=self.target_sample, target_sr=HUBERT_SAMPLING_RATE ) + + LOG.warn("get_unit_f0(): librosa.resample() - END") + + LOG.warn("get_unit_f0(): torch.from_numpy()... ") wav16k = torch.from_numpy(wav16k).to(self.dev) + + LOG.warn("get_unit_f0(): torch.from_numpy() - END ") + + LOG.warn("get_unit_f0(): utils.get_hubert_contet() ...") + c = utils.get_hubert_content(self.hubert_model, wav_16k_tensor=wav16k) + + LOG.warn("get_unit_f0(): utils.get_hubert_contet() - END") + + LOG.warn("get_unit_f0(): utils.repeat_expand_2d() ... ") + c = utils.repeat_expand_2d(c.squeeze(0), f0.shape[1]) + LOG.warn("get_unit_f0(): utils.repeat_expand_2d() - DONE") + if cluster_infer_ratio != 0: + LOG.warn("get_unit_f0(): cluster.get_cluster_center_result() ...") + cluster_c = cluster.get_cluster_center_result( self.cluster_model, c.cpu().numpy().T, speaker ).T + + LOG.warn("get_unit_f0(): cluster.get_cluster_center_result() - END") + cluster_c = torch.FloatTensor(cluster_c).to(self.dev) c = cluster_infer_ratio * cluster_c + (1 - cluster_infer_ratio) * c + LOG.warn("get_unit_f0(): cluster.get_cluster_center_result() - MATH DONE") + + LOG.warn("get_unit_f0(): c.unsqueze()") + c = c.unsqueeze(0) return c, f0, uv