Merge branch 'master' into v.1.5.3

This commit is contained in:
w-okada 2023-07-08 05:09:41 +09:00
commit cb9043ffd4

View File

@ -189,6 +189,12 @@ class Pipeline(object):
pitch = pitch[:, :p_len] pitch = pitch[:, :p_len]
pitchf = pitchf[:, :p_len] pitchf = pitchf[:, :p_len]
feats_len = feats.shape[1]
if pitch is not None and pitchf is not None:
pitch = pitch[:, -feats_len:]
pitchf = pitchf[:, -feats_len:]
p_len = torch.tensor([feats_len], device=self.device).long()
# pitchの推定が上手くいかない(pitchf=0)場合、検索前の特徴を混ぜる # pitchの推定が上手くいかない(pitchf=0)場合、検索前の特徴を混ぜる
# pitchffの作り方の疑問はあるが、本家通りなので、このまま使うことにする。 # pitchffの作り方の疑問はあるが、本家通りなので、このまま使うことにする。
# https://github.com/w-okada/voice-changer/pull/276#issuecomment-1571336929 # https://github.com/w-okada/voice-changer/pull/276#issuecomment-1571336929
@ -201,11 +207,6 @@ class Pipeline(object):
feats = feats.to(feats0.dtype) feats = feats.to(feats0.dtype)
p_len = torch.tensor([p_len], device=self.device).long() p_len = torch.tensor([p_len], device=self.device).long()
feats_buffer = feats.squeeze(0).detach().cpu()
if pitchf is not None:
pitchf_buffer = pitchf.squeeze(0).detach().cpu()
else:
pitchf_buffer = None
# apply silent front for inference # apply silent front for inference
if type(self.inferencer) in [OnnxRVCInferencer, OnnxRVCInferencerNono]: if type(self.inferencer) in [OnnxRVCInferencer, OnnxRVCInferencerNono]:
npyOffset = math.floor(silence_front * 16000) // 360 npyOffset = math.floor(silence_front * 16000) // 360
@ -236,6 +237,12 @@ class Pipeline(object):
else: else:
raise e raise e
feats_buffer = feats.squeeze(0).detach().cpu()
if pitchf is not None:
pitchf_buffer = pitchf.squeeze(0).detach().cpu()
else:
pitchf_buffer = None
del p_len, padding_mask, pitch, pitchf, feats del p_len, padding_mask, pitch, pitchf, feats
torch.cuda.empty_cache() torch.cuda.empty_cache()