hotfix: RVCquality=highの時のバグを修正

This commit is contained in:
nadare 2023-07-06 05:53:46 +09:00
parent 6e18b42c51
commit 81fe3cd6a0

View File

@ -103,7 +103,8 @@ class Pipeline(object):
# RVC QualityがOnのときにはsilence_frontをオフに。 # RVC QualityがOnのときにはsilence_frontをオフに。
silence_front = silence_front if repeat == 0 else 0 silence_front = silence_front if repeat == 0 else 0
pitchf = pitchf if repeat == 0 else torch.zeros([pitchf.shape[0], pitchf.shape[1] * 2]) pitchf = pitchf if repeat == 0 else np.zeros(p_len)
out_size = out_size if repeat == 0 else None
# ピッチ検出 # ピッチ検出
try: try:
@ -116,8 +117,8 @@ class Pipeline(object):
self.window, self.window,
silence_front=silence_front, silence_front=silence_front,
) )
pitch = pitch[:p_len] # pitch = pitch[:p_len]
pitchf = pitchf[:p_len] # pitchf = pitchf[:p_len]
pitch = torch.tensor(pitch, device=self.device).unsqueeze(0).long() pitch = torch.tensor(pitch, device=self.device).unsqueeze(0).long()
pitchf = torch.tensor(pitchf, device=self.device, dtype=torch.float).unsqueeze(0) pitchf = torch.tensor(pitchf, device=self.device, dtype=torch.float).unsqueeze(0)
else: else:
@ -209,11 +210,12 @@ class Pipeline(object):
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
feats = feats[:, npyOffset * 2 :, :] feats = feats[:, npyOffset * 2 :, :]
feats_len = feats.shape[1]
if pitch is not None and pitchf is not None: feats_len = feats.shape[1]
pitch = pitch[:, -feats_len:] if pitch is not None and pitchf is not None:
pitchf = pitchf[:, -feats_len:] pitch = pitch[:, -feats_len:]
p_len = torch.tensor([feats_len], device=self.device).long() pitchf = pitchf[:, -feats_len:]
p_len = torch.tensor([feats_len], device=self.device).long()
# 推論実行 # 推論実行