From 3cc778ba6a384a470ee46cb885af232d4d1884c1 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:22:11 +0800 Subject: [PATCH 01/12] Add files via upload --- infer/lib/infer_pack/models.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/infer/lib/infer_pack/models.py b/infer/lib/infer_pack/models.py index 1d43061..4de36c4 100644 --- a/infer/lib/infer_pack/models.py +++ b/infer/lib/infer_pack/models.py @@ -16,7 +16,6 @@ from infer.lib.infer_pack.commons import get_padding, init_weights has_xpu = bool(hasattr(torch, "xpu") and torch.xpu.is_available()) - class TextEncoder256(nn.Module): def __init__( self, @@ -1096,7 +1095,6 @@ class SynthesizerTrnMs256NSFsid_nono(nn.Module): head = int(z_p.shape[2] * (1.0 - rate.item())) z_p = z_p[:, :, head:] x_mask = x_mask[:, :, head:] - nsff0 = nsff0[:, head:] z = self.flow(z_p, x_mask, g=g, reverse=True) o = self.dec(z * x_mask, g=g) return o, x_mask, (z, z_p, m_p, logs_p) @@ -1125,7 +1123,7 @@ class SynthesizerTrnMs768NSFsid_nono(nn.Module): sr=None, **kwargs ): - super(SynthesizerTrnMs768NSFsid_nono, self).__init__() + super(SynthesizerTrnMs768NSFsid_nono,self).__init__() self.spec_channels = spec_channels self.inter_channels = inter_channels self.hidden_channels = hidden_channels @@ -1242,7 +1240,6 @@ class SynthesizerTrnMs768NSFsid_nono(nn.Module): head = int(z_p.shape[2] * (1.0 - rate.item())) z_p = z_p[:, :, head:] x_mask = x_mask[:, :, head:] - nsff0 = nsff0[:, head:] z = self.flow(z_p, x_mask, g=g, reverse=True) o = self.dec(z * x_mask, g=g) return o, x_mask, (z, z_p, m_p, logs_p) From 11b1cdded837733cf3eb42af696f8eb27f448dcf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Oct 2023 02:22:28 +0000 Subject: [PATCH 02/12] chore(format): run black on dev --- infer/lib/infer_pack/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/infer/lib/infer_pack/models.py b/infer/lib/infer_pack/models.py index 4de36c4..f25e724 100644 --- a/infer/lib/infer_pack/models.py +++ b/infer/lib/infer_pack/models.py @@ -16,6 +16,7 @@ from infer.lib.infer_pack.commons import get_padding, init_weights has_xpu = bool(hasattr(torch, "xpu") and torch.xpu.is_available()) + class TextEncoder256(nn.Module): def __init__( self, @@ -1123,7 +1124,7 @@ class SynthesizerTrnMs768NSFsid_nono(nn.Module): sr=None, **kwargs ): - super(SynthesizerTrnMs768NSFsid_nono,self).__init__() + super(SynthesizerTrnMs768NSFsid_nono, self).__init__() self.spec_channels = spec_channels self.inter_channels = inter_channels self.hidden_channels = hidden_channels From 0472bc5283cd9e31448a8379a323f7629b947e9d Mon Sep 17 00:00:00 2001 From: Ftps <63702646+Tps-F@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:08:58 +0900 Subject: [PATCH 03/12] Update PULL_REQUEST_TEMPLATE.md (#1417) --- .github/PULL_REQUEST_TEMPLATE.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a6acd35..cfbaaae 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -18,13 +18,3 @@ # Screenshot - Please include a screenshot if applicable - -# Localhost url to test on - -- Please include a url on localhost to test. - -# Jira Link - -- Please include a link to the ticket if applicable. - -[Ticket]() From 3cc09646006dc5885343069f45b137ffc109ace2 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Mon, 16 Oct 2023 23:44:41 +0800 Subject: [PATCH 04/12] Update train.py --- infer/modules/train/train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infer/modules/train/train.py b/infer/modules/train/train.py index b81a0d2..ab6ba2d 100644 --- a/infer/modules/train/train.py +++ b/infer/modules/train/train.py @@ -99,7 +99,7 @@ def main(): n_gpus = 1 if n_gpus < 1: # patch to unblock people without gpus. there is probably a better way. - logger.warning("NO GPU DETECTED: falling back to CPU - this may take a while") + print("NO GPU DETECTED: falling back to CPU - this may take a while") n_gpus = 1 os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_PORT"] = str(randint(20000, 55555)) From ec1ccae300a49c8f0e56b8b70f107952b836808f Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:13:57 +0800 Subject: [PATCH 05/12] Add files via upload --- infer-web.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/infer-web.py b/infer-web.py index 3759d52..4cdfef3 100644 --- a/infer-web.py +++ b/infer-web.py @@ -1,8 +1,9 @@ import os import sys - +from dotenv import load_dotenv now_dir = os.getcwd() sys.path.append(now_dir) +load_dotenv() from infer.modules.vc.modules import VC from infer.modules.uvr5.modules import uvr from infer.lib.train.process_ckpt import ( @@ -14,7 +15,6 @@ from infer.lib.train.process_ckpt import ( from i18n.i18n import I18nAuto from configs.config import Config from sklearn.cluster import MiniBatchKMeans -from dotenv import load_dotenv import torch import numpy as np import gradio as gr @@ -32,6 +32,7 @@ import shutil import logging + logging.getLogger("numba").setLevel(logging.WARNING) logger = logging.getLogger(__name__) @@ -48,7 +49,6 @@ warnings.filterwarnings("ignore") torch.manual_seed(114514) -load_dotenv() config = Config() vc = VC(config) @@ -438,9 +438,8 @@ def change_version19(sr2, if_f0_3, version19): def change_f0(if_f0_3, sr2, version19): # f0method8,pretrained_G14,pretrained_D15 path_str = "" if version19 == "v1" else "_v2" return ( - {"visible": if_f0_3, "__type__": "update"}, - {"visible": if_f0_3, "__type__": "update"}, - *get_pretrained_models(path_str, "f0" if if_f0_3 == True else "", sr2), + {"visible": if_f0_3, "__type__": "update"},{"visible": if_f0_3, "__type__": "update"}, + *get_pretrained_models(path_str, "f0"if if_f0_3==True else "", sr2), ) @@ -781,7 +780,9 @@ with gr.Blocks(title="RVC WebUI") as app: with gr.Row(): sid0 = gr.Dropdown(label=i18n("推理音色"), choices=sorted(names)) with gr.Column(): - refresh_button = gr.Button(i18n("刷新音色列表和索引路径"), variant="primary") + refresh_button = gr.Button( + i18n("刷新音色列表和索引路径"), variant="primary" + ) clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary") spk_item = gr.Slider( minimum=0, @@ -871,8 +872,7 @@ with gr.Blocks(title="RVC WebUI") as app: interactive=True, ) f0_file = gr.File( - label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), - visible=False, + label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"),visible=False ) refresh_button.click( @@ -1282,7 +1282,7 @@ with gr.Blocks(title="RVC WebUI") as app: if_f0_3.change( change_f0, [if_f0_3, sr2, version19], - [f0method8, gpus_rmvpe, pretrained_G14, pretrained_D15], + [f0method8, gpus_rmvpe,pretrained_G14, pretrained_D15], ) gpus16 = gr.Textbox( label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"), From 9c2afdbbc85ebc6f76bab673c19627cc6149a20a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 23:01:18 +0900 Subject: [PATCH 06/12] chore(format): run black on dev (#1447) Co-authored-by: github-actions[bot] --- infer-web.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/infer-web.py b/infer-web.py index 4cdfef3..9c356c1 100644 --- a/infer-web.py +++ b/infer-web.py @@ -1,6 +1,7 @@ import os import sys from dotenv import load_dotenv + now_dir = os.getcwd() sys.path.append(now_dir) load_dotenv() @@ -32,7 +33,6 @@ import shutil import logging - logging.getLogger("numba").setLevel(logging.WARNING) logger = logging.getLogger(__name__) @@ -438,8 +438,9 @@ def change_version19(sr2, if_f0_3, version19): def change_f0(if_f0_3, sr2, version19): # f0method8,pretrained_G14,pretrained_D15 path_str = "" if version19 == "v1" else "_v2" return ( - {"visible": if_f0_3, "__type__": "update"},{"visible": if_f0_3, "__type__": "update"}, - *get_pretrained_models(path_str, "f0"if if_f0_3==True else "", sr2), + {"visible": if_f0_3, "__type__": "update"}, + {"visible": if_f0_3, "__type__": "update"}, + *get_pretrained_models(path_str, "f0" if if_f0_3 == True else "", sr2), ) @@ -780,9 +781,7 @@ with gr.Blocks(title="RVC WebUI") as app: with gr.Row(): sid0 = gr.Dropdown(label=i18n("推理音色"), choices=sorted(names)) with gr.Column(): - refresh_button = gr.Button( - i18n("刷新音色列表和索引路径"), variant="primary" - ) + refresh_button = gr.Button(i18n("刷新音色列表和索引路径"), variant="primary") clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary") spk_item = gr.Slider( minimum=0, @@ -872,7 +871,8 @@ with gr.Blocks(title="RVC WebUI") as app: interactive=True, ) f0_file = gr.File( - label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"),visible=False + label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), + visible=False, ) refresh_button.click( @@ -1282,7 +1282,7 @@ with gr.Blocks(title="RVC WebUI") as app: if_f0_3.change( change_f0, [if_f0_3, sr2, version19], - [f0method8, gpus_rmvpe,pretrained_G14, pretrained_D15], + [f0method8, gpus_rmvpe, pretrained_G14, pretrained_D15], ) gpus16 = gr.Textbox( label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"), From a51746555c7da6ca883dee623473913ea12a6aa3 Mon Sep 17 00:00:00 2001 From: THE-SINDOL <144182156+THE-SINDOL@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:05:08 +0200 Subject: [PATCH 07/12] Update fr_FR.json Changed chinese simplified language in french --- i18n/locale/fr_FR.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i18n/locale/fr_FR.json b/i18n/locale/fr_FR.json index 64bb37a..1c76ccd 100644 --- a/i18n/locale/fr_FR.json +++ b/i18n/locale/fr_FR.json @@ -88,7 +88,7 @@ "特征检索库文件路径,为空则使用下拉的选择结果": "Chemin d'accès au fichier d'index des caractéristiques. Laisser vide pour utiliser le résultat sélectionné dans la liste déroulante :", "男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "Il est recommandé d'utiliser la clé +12 pour la conversion homme-femme et la clé -12 pour la conversion femme-homme. Si la plage sonore est trop large et que la voix est déformée, vous pouvez également l'ajuster vous-même à la plage appropriée.", "目标采样率": "Taux d'échantillonnage cible :", - "算法延迟(ms):": "算法延迟(ms):", + "算法延迟(ms):": "Délais algorithmiques (ms):", "自动检测index路径,下拉式选择(dropdown)": "Détecter automatiquement le chemin d'accès à l'index et le sélectionner dans la liste déroulante :", "融合": "Fusion", "要改的模型信息": "Informations sur le modèle à modifier :", @@ -107,12 +107,12 @@ "输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "Entrez le chemin du dossier audio à traiter (copiez-le depuis la barre d'adresse du gestionnaire de fichiers) :", "输入待处理音频文件路径(默认是正确格式示例)": "Entrez le chemin d'accès du fichier audio à traiter (par défaut, l'exemple de format correct) :", "输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "Ajustez l'échelle de l'enveloppe de volume. Plus il est proche de 0, plus il imite le volume des voix originales. Cela peut aider à masquer les bruits et à rendre le volume plus naturel lorsqu'il est réglé relativement bas. Plus le volume est proche de 1, plus le volume sera fort et constant :", - "输入监听": "输入监听", + "输入监听": "Moniteur vocal d'entrée", "输入训练文件夹路径": "Indiquez le chemin d'accès au dossier d'entraînement :", "输入设备": "Dispositif d'entrée", "输入降噪": "Réduction du bruit d'entrée", "输出信息": "Informations sur la sortie", - "输出变声": "输出变声", + "输出变声": "Sortie voix convertie", "输出设备": "Dispositif de sortie", "输出降噪": "Réduction du bruit de sortie", "输出音频(右下角三个点,点了可以下载)": "Exporter l'audio (cliquer sur les trois points dans le coin inférieur droit pour télécharger)", From dabbe708f7bfa404e521f6c424023ca00854a641 Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Sun, 29 Oct 2023 12:36:00 +0800 Subject: [PATCH 08/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dfff03..1f680e1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![Discord](https://img.shields.io/badge/RVC%20Developers-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/HcsmBBGyVk) -[**更新日志**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/Changelog_CN.md) | [**常见问题解答**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94) | [**AutoDL·5毛钱训练AI歌手**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B) | [**对照实验记录**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%AF%B9%E7%85%A7%E5%AE%9E%E9%AA%8C%C2%B7%E5%AE%9E%E9%AA%8C%E8%AE%B0%E5%BD%95)) | [**在线演示**](https://huggingface.co/spaces/Ricecake123/RVC-demo) +[**更新日志**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/Changelog_CN.md) | [**常见问题解答**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94) | [**AutoDL·5毛钱训练AI歌手**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B) | [**对照实验记录**](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/Autodl%E8%AE%AD%E7%BB%83RVC%C2%B7AI%E6%AD%8C%E6%89%8B%E6%95%99%E7%A8%8B](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/wiki/%E5%AF%B9%E7%85%A7%E5%AE%9E%E9%AA%8C%C2%B7%E5%AE%9E%E9%AA%8C%E8%AE%B0%E5%BD%95)) | [**在线演示**](https://modelscope.cn/studios/FlowerCry/RVCv2demo) From 3f7644b56ad51c3e09753a1ae7364a2b238d21de Mon Sep 17 00:00:00 2001 From: CNajm Date: Sun, 5 Nov 2023 22:41:25 -0800 Subject: [PATCH 09/12] Fix error in index file path (#1502) --- infer/modules/vc/modules.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/infer/modules/vc/modules.py b/infer/modules/vc/modules.py index 3e7cdbb..33b40f5 100644 --- a/infer/modules/vc/modules.py +++ b/infer/modules/vc/modules.py @@ -169,18 +169,17 @@ class VC: if self.hubert_model is None: self.hubert_model = load_hubert(self.config) - file_index = ( - ( - file_index.strip(" ") - .strip('"') - .strip("\n") - .strip('"') - .strip(" ") - .replace("trained", "added") - ) - if file_index != "" - else file_index2 - ) # 防止小白写错,自动帮他替换掉 + if file_index: + file_index = file_index.strip(" ") \ + .strip('"') \ + .strip("\n") \ + .strip('"') \ + .strip(" ") \ + .replace("trained", "added") + elif file_index2: + file_index = file_index2 + else: + file_index = "" # 防止小白写错,自动帮他替换掉 audio_opt = self.pipeline.pipeline( self.hubert_model, From ee6c50bdbcd54c2493dfb3b65884c46d852f3149 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:42:26 +0900 Subject: [PATCH 10/12] chore(format): run black on dev (#1484) Co-authored-by: github-actions[bot] --- infer-web.py | 15 +++++++-------- infer/modules/vc/modules.py | 16 +++++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/infer-web.py b/infer-web.py index 440a39f..9c356c1 100644 --- a/infer-web.py +++ b/infer-web.py @@ -33,7 +33,6 @@ import shutil import logging - logging.getLogger("numba").setLevel(logging.WARNING) logger = logging.getLogger(__name__) @@ -439,8 +438,9 @@ def change_version19(sr2, if_f0_3, version19): def change_f0(if_f0_3, sr2, version19): # f0method8,pretrained_G14,pretrained_D15 path_str = "" if version19 == "v1" else "_v2" return ( - {"visible": if_f0_3, "__type__": "update"},{"visible": if_f0_3, "__type__": "update"}, - *get_pretrained_models(path_str, "f0"if if_f0_3==True else "", sr2), + {"visible": if_f0_3, "__type__": "update"}, + {"visible": if_f0_3, "__type__": "update"}, + *get_pretrained_models(path_str, "f0" if if_f0_3 == True else "", sr2), ) @@ -781,9 +781,7 @@ with gr.Blocks(title="RVC WebUI") as app: with gr.Row(): sid0 = gr.Dropdown(label=i18n("推理音色"), choices=sorted(names)) with gr.Column(): - refresh_button = gr.Button( - i18n("刷新音色列表和索引路径"), variant="primary" - ) + refresh_button = gr.Button(i18n("刷新音色列表和索引路径"), variant="primary") clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary") spk_item = gr.Slider( minimum=0, @@ -873,7 +871,8 @@ with gr.Blocks(title="RVC WebUI") as app: interactive=True, ) f0_file = gr.File( - label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"),visible=False + label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), + visible=False, ) refresh_button.click( @@ -1283,7 +1282,7 @@ with gr.Blocks(title="RVC WebUI") as app: if_f0_3.change( change_f0, [if_f0_3, sr2, version19], - [f0method8, gpus_rmvpe,pretrained_G14, pretrained_D15], + [f0method8, gpus_rmvpe, pretrained_G14, pretrained_D15], ) gpus16 = gr.Textbox( label=i18n("以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2"), diff --git a/infer/modules/vc/modules.py b/infer/modules/vc/modules.py index 33b40f5..1775012 100644 --- a/infer/modules/vc/modules.py +++ b/infer/modules/vc/modules.py @@ -170,16 +170,18 @@ class VC: self.hubert_model = load_hubert(self.config) if file_index: - file_index = file_index.strip(" ") \ - .strip('"') \ - .strip("\n") \ - .strip('"') \ - .strip(" ") \ - .replace("trained", "added") + file_index = ( + file_index.strip(" ") + .strip('"') + .strip("\n") + .strip('"') + .strip(" ") + .replace("trained", "added") + ) elif file_index2: file_index = file_index2 else: - file_index = "" # 防止小白写错,自动帮他替换掉 + file_index = "" # 防止小白写错,自动帮他替换掉 audio_opt = self.pipeline.pipeline( self.hubert_model, From 4303c5b18db3bf15794fac2ada15b1d844877f41 Mon Sep 17 00:00:00 2001 From: yxlllc Date: Sun, 12 Nov 2023 17:21:25 +0800 Subject: [PATCH 11/12] fix alignments of f0 and hubert --- tools/rvc_for_realtime.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/tools/rvc_for_realtime.py b/tools/rvc_for_realtime.py index e71c3f2..8f7fcb7 100644 --- a/tools/rvc_for_realtime.py +++ b/tools/rvc_for_realtime.py @@ -219,24 +219,20 @@ class RVC: return self.get_f0_rmvpe(x, f0_up_key) if method == "pm": p_len = x.shape[0] // 160 + 1 - f0 = ( - parselmouth.Sound(x, 16000) - .to_pitch_ac( + f0_min = 65 + l_pad = int(np.ceil(1.5 / f0_min * 16000)) + r_pad = l_pad + 1 + s = parselmouth.Sound(np.pad(x, (l_pad, r_pad)), 16000).to_pitch_ac( time_step=0.01, voicing_threshold=0.6, - pitch_floor=50, + pitch_floor=f0_min, pitch_ceiling=1100, - ) - .selected_array["frequency"] - ) - - pad_size = (p_len - len(f0) + 1) // 2 - if pad_size > 0 or p_len - len(f0) - pad_size > 0: - # printt(pad_size, p_len - len(f0) - pad_size) - f0 = np.pad( - f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant" - ) - + ) + assert np.abs(s.t1 - 1.5 / f0_min) < 0.001 + f0 = s.selected_array['frequency'] + if len(f0) < p_len: + f0 = np.pad(f0, (0, p_len - len(f0))) + f0 = f0[: p_len] f0 *= pow(2, f0_up_key / 12) return self.get_f0_post(f0) if n_cpu == 1: @@ -354,7 +350,7 @@ class RVC: feats = ( self.model.final_proj(logits[0]) if self.version == "v1" else logits[0] ) - feats = F.pad(feats, (0, 0, 1, 0)) + feats = torch.cat((feats, feats[:,-1:,:]), 1) t2 = ttime() try: if hasattr(self, "index") and self.index_rate != 0: From f1552e143bcfdc27f450fe3f8b0e5db9d940c8de Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Nov 2023 09:40:59 +0000 Subject: [PATCH 12/12] chore(format): run black on dev --- tools/rvc_for_realtime.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/rvc_for_realtime.py b/tools/rvc_for_realtime.py index 8f7fcb7..68358bb 100644 --- a/tools/rvc_for_realtime.py +++ b/tools/rvc_for_realtime.py @@ -223,16 +223,16 @@ class RVC: l_pad = int(np.ceil(1.5 / f0_min * 16000)) r_pad = l_pad + 1 s = parselmouth.Sound(np.pad(x, (l_pad, r_pad)), 16000).to_pitch_ac( - time_step=0.01, - voicing_threshold=0.6, - pitch_floor=f0_min, - pitch_ceiling=1100, - ) + time_step=0.01, + voicing_threshold=0.6, + pitch_floor=f0_min, + pitch_ceiling=1100, + ) assert np.abs(s.t1 - 1.5 / f0_min) < 0.001 - f0 = s.selected_array['frequency'] + f0 = s.selected_array["frequency"] if len(f0) < p_len: f0 = np.pad(f0, (0, p_len - len(f0))) - f0 = f0[: p_len] + f0 = f0[:p_len] f0 *= pow(2, f0_up_key / 12) return self.get_f0_post(f0) if n_cpu == 1: @@ -350,7 +350,7 @@ class RVC: feats = ( self.model.final_proj(logits[0]) if self.version == "v1" else logits[0] ) - feats = torch.cat((feats, feats[:,-1:,:]), 1) + feats = torch.cat((feats, feats[:, -1:, :]), 1) t2 = ttime() try: if hasattr(self, "index") and self.index_rate != 0: