From 8582131bd82817331fcd888af36bb5f8adb52852 Mon Sep 17 00:00:00 2001 From: SapphireLab <36986837+SapphireLab@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:42:42 +0800 Subject: [PATCH 01/12] fix reformat cmd (#917) Co-authored-by: starylan --- tools/uvr5/webui.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/uvr5/webui.py b/tools/uvr5/webui.py index bfe149ce..a690a686 100644 --- a/tools/uvr5/webui.py +++ b/tools/uvr5/webui.py @@ -73,8 +73,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format os.path.basename(inp_path), ) os.system( - "ffmpeg -i %s -vn -acodec pcm_s16le -ac 2 -ar 44100 %s -y" - % (inp_path, tmp_path) + f'ffmpeg -i "{inp_path}" -vn -acodec pcm_s16le -ac 2 -ar 44100 "{tmp_path}" -y' ) inp_path = tmp_path try: From 4e43f6097fe468cf747237f1088e46b5f4d7724d Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:57:23 +0800 Subject: [PATCH 02/12] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2e7cb2df..11225162 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ A Powerful Few-shot Voice Conversion and Text-to-Speech WebUI.

[![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/RVC-Boss/GPT-SoVITS/blob/main/colab_webui.ipynb) [![License](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/RVC-Boss/GPT-SoVITS/blob/main/LICENSE) [![Huggingface](https://img.shields.io/badge/🤗%20-Models%20Repo-yellow.svg?style=for-the-badge)](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) +[![Discord](https://img.shields.io/discord/1198701940511617164?color=%23738ADB&label=Discord&style=for-the-badge)](https://discord.gg/dnrgs5GHfG) + [**English**](./README.md) | [**中文简体**](./docs/cn/README.md) | [**日本語**](./docs/ja/README.md) | [**한국어**](./docs/ko/README.md) From a3c4e040c80136413aa9397a02fd5f2a45f10e73 Mon Sep 17 00:00:00 2001 From: KamioRinn <63162909+KamioRinn@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:18:34 +0800 Subject: [PATCH 03/12] Normalize chinese arithmetic operations (#947) --- GPT_SoVITS/text/zh_normalization/num.py | 33 +++++++++++++++++-- .../zh_normalization/text_normlization.py | 9 ++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/GPT_SoVITS/text/zh_normalization/num.py b/GPT_SoVITS/text/zh_normalization/num.py index 8ef7f48f..d38d5a64 100644 --- a/GPT_SoVITS/text/zh_normalization/num.py +++ b/GPT_SoVITS/text/zh_normalization/num.py @@ -106,6 +106,29 @@ def replace_default_num(match): return verbalize_digit(number, alt_one=True) +# 加减乘除 +RE_ASMD = re.compile( + r'((-?)((\d+)(\.\d+)?)|(\.(\d+)))([\+\-\×÷=])((-?)((\d+)(\.\d+)?)|(\.(\d+)))') +asmd_map = { + '+': '加', + '-': '减', + '×': '乘', + '÷': '除', + '=': '等于' +} + + +def replace_asmd(match) -> str: + """ + Args: + match (re.Match) + Returns: + str + """ + result = match.group(1) + asmd_map[match.group(8)] + match.group(9) + return result + + # 数字表达式 # 纯小数 RE_DECIMAL_NUM = re.compile(r'(-?)((\d+)(\.\d+))' r'|(\.(\d+))') @@ -155,7 +178,13 @@ def replace_number(match) -> str: # match.group(1) and match.group(8) are copy from RE_NUMBER RE_RANGE = re.compile( - r'((-?)((\d+)(\.\d+)?)|(\.(\d+)))[-~]((-?)((\d+)(\.\d+)?)|(\.(\d+)))') + r""" + (? str: @@ -165,7 +194,7 @@ def replace_range(match) -> str: Returns: str """ - first, second = match.group(1), match.group(8) + first, second = match.group(1), match.group(6) first = RE_NUMBER.sub(replace_number, first) second = RE_NUMBER.sub(replace_number, second) result = f"{first}到{second}" diff --git a/GPT_SoVITS/text/zh_normalization/text_normlization.py b/GPT_SoVITS/text/zh_normalization/text_normlization.py index b4c14949..e852fe9b 100644 --- a/GPT_SoVITS/text/zh_normalization/text_normlization.py +++ b/GPT_SoVITS/text/zh_normalization/text_normlization.py @@ -34,6 +34,7 @@ from .num import RE_PERCENTAGE from .num import RE_POSITIVE_QUANTIFIERS from .num import RE_RANGE from .num import RE_TO_RANGE +from .num import RE_ASMD from .num import replace_default_num from .num import replace_frac from .num import replace_negative_num @@ -42,6 +43,7 @@ from .num import replace_percentage from .num import replace_positive_quantifier from .num import replace_range from .num import replace_to_range +from .num import replace_asmd from .phonecode import RE_MOBILE_PHONE from .phonecode import RE_NATIONAL_UNIFORM_NUMBER from .phonecode import RE_TELEPHONE @@ -67,7 +69,7 @@ class TextNormalizer(): if lang == "zh": text = text.replace(" ", "") # 过滤掉特殊字符 - text = re.sub(r'[——《》【】<=>{}()()#&@“”^_|\\]', '', text) + text = re.sub(r'[——《》【】<>{}()()#&@“”^_|\\]', '', text) text = self.SENTENCE_SPLITOR.sub(r'\1\n', text) text = text.strip() sentences = [sentence.strip() for sentence in re.split(r'\n+', text)] @@ -142,6 +144,11 @@ class TextNormalizer(): sentence = RE_NATIONAL_UNIFORM_NUMBER.sub(replace_phone, sentence) sentence = RE_RANGE.sub(replace_range, sentence) + + # 处理加减乘除 + while RE_ASMD.search(sentence): + sentence = RE_ASMD.sub(replace_asmd, sentence) + sentence = RE_INTEGER.sub(replace_negative_num, sentence) sentence = RE_DECIMAL_NUM.sub(replace_number, sentence) sentence = RE_POSITIVE_QUANTIFIERS.sub(replace_positive_quantifier, From b162848e7a930dc0666f968a5803d3a93e98246d Mon Sep 17 00:00:00 2001 From: shadow01a <141255649+shadow01a@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:42:58 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E5=9C=A8colab=E4=B8=AD=E8=BF=90=E8=A1=8C?= =?UTF-8?q?colab=5Fwebui.ipynb=E5=8F=91=E7=94=9F=E7=9A=84uvr5=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=BC=BA=E5=A4=B1=E9=97=AE=E9=A2=98=20(#968)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在colab中使用git下载uvr5模型时报错: fatal: destination path 'uvr5_weights' already exists and is not an empty directory. 通过在下载前将原本从本仓库下载的uvr5_weights文件夹删除可以解决问题。 --- colab_webui.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/colab_webui.ipynb b/colab_webui.ipynb index 70fa7940..0d50fe13 100644 --- a/colab_webui.ipynb +++ b/colab_webui.ipynb @@ -67,6 +67,7 @@ "!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n", "# @title UVR5 pretrains 安装uvr5模型\n", "%cd /content/GPT-SoVITS/tools/uvr5\n", + "%rm -r uvr5_weights\n", "!git clone https://huggingface.co/Delik/uvr5_weights\n", "!git config core.sparseCheckout true\n", "!mv /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/" From e1ba8d76b7b99e86c0a4d43d19626dd245b1953f Mon Sep 17 00:00:00 2001 From: SapphireLab <36986837+SapphireLab@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:47:39 +0800 Subject: [PATCH 05/12] =?UTF-8?q?[ASR]=20=E4=BF=AE=E5=A4=8DFasterWhisper?= =?UTF-8?q?=E9=81=8D=E5=8E=86=E8=BE=93=E5=85=A5=E8=B7=AF=E5=BE=84=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=20(#956)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove glob * rename * reset mirror pos --- tools/asr/fasterwhisper_asr.py | 42 +++++++++++++++++++--------------- tools/asr/funasr_asr.py | 7 +++--- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/tools/asr/fasterwhisper_asr.py b/tools/asr/fasterwhisper_asr.py index f7b31aab..669ac3aa 100644 --- a/tools/asr/fasterwhisper_asr.py +++ b/tools/asr/fasterwhisper_asr.py @@ -1,18 +1,16 @@ import argparse import os -os.environ["HF_ENDPOINT"]="https://hf-mirror.com" import traceback -import requests -from glob import glob -import torch +os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" +os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" + +import torch from faster_whisper import WhisperModel from tqdm import tqdm from tools.asr.config import check_fw_local_models -os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" - language_code_list = [ "af", "am", "ar", "as", "az", "ba", "be", "bg", "bn", "bo", @@ -36,7 +34,7 @@ language_code_list = [ "vi", "yi", "yo", "zh", "yue", "auto"] -def execute_asr(input_folder, output_folder, model_size, language,precision): +def execute_asr(input_folder, output_folder, model_size, language, precision): if '-local' in model_size: model_size = model_size[:-6] model_path = f'tools/asr/models/faster-whisper-{model_size}' @@ -50,17 +48,18 @@ def execute_asr(input_folder, output_folder, model_size, language,precision): model = WhisperModel(model_path, device=device, compute_type=precision) except: return print(traceback.format_exc()) + + input_file_names = os.listdir(input_folder) + input_file_names.sort() + output = [] output_file_name = os.path.basename(input_folder) - output_file_path = os.path.abspath(f'{output_folder}/{output_file_name}.list') - - if not os.path.exists(output_folder): - os.makedirs(output_folder) - - for file in tqdm(glob(os.path.join(input_folder, '**/*.wav'), recursive=True)): + + for file_name in tqdm(input_file_names): try: + file_path = os.path.join(input_folder, file_name) segments, info = model.transcribe( - audio = file, + audio = file_path, beam_size = 5, vad_filter = True, vad_parameters = dict(min_silence_duration_ms=700), @@ -68,18 +67,23 @@ def execute_asr(input_folder, output_folder, model_size, language,precision): text = '' if info.language == "zh": - print("检测为中文文本,转funasr处理") + print("检测为中文文本, 转 FunASR 处理") if("only_asr"not in globals()): - from tools.asr.funasr_asr import only_asr##如果用英文就不需要导入下载模型 - text = only_asr(file) + from tools.asr.funasr_asr import \ + only_asr # #如果用英文就不需要导入下载模型 + text = only_asr(file_path) if text == '': for segment in segments: text += segment.text - output.append(f"{file}|{output_file_name}|{info.language.upper()}|{text}") + output.append(f"{file_path}|{output_file_name}|{info.language.upper()}|{text}") except: return print(traceback.format_exc()) - + + output_folder = output_folder or "output/asr_opt" + os.makedirs(output_folder, exist_ok=True) + output_file_path = os.path.abspath(f'{output_folder}/{output_file_name}.list') + with open(output_file_path, "w", encoding="utf-8") as f: f.write("\n".join(output)) print(f"ASR 任务完成->标注文件路径: {output_file_path}\n") diff --git a/tools/asr/funasr_asr.py b/tools/asr/funasr_asr.py index 6aa30381..831da6c1 100644 --- a/tools/asr/funasr_asr.py +++ b/tools/asr/funasr_asr.py @@ -38,10 +38,11 @@ def execute_asr(input_folder, output_folder, model_size, language): output = [] output_file_name = os.path.basename(input_folder) - for name in tqdm(input_file_names): + for file_name in tqdm(input_file_names): try: - text = model.generate(input="%s/%s"%(input_folder, name))[0]["text"] - output.append(f"{input_folder}/{name}|{output_file_name}|{language.upper()}|{text}") + file_path = os.path.join(input_folder, file_name) + text = model.generate(input=file_path)[0]["text"] + output.append(f"{file_path}|{output_file_name}|{language.upper()}|{text}") except: print(traceback.format_exc()) From 9c4ba08ccb6593e5f91b607dc778826b77d1075d Mon Sep 17 00:00:00 2001 From: SetoKaiba Date: Tue, 16 Apr 2024 17:02:44 +0800 Subject: [PATCH 06/12] Fix the colab comma which make the colab notebook broken (#983) --- colab_webui.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colab_webui.ipynb b/colab_webui.ipynb index 0d50fe13..838f8264 100644 --- a/colab_webui.ipynb +++ b/colab_webui.ipynb @@ -67,7 +67,7 @@ "!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n", "# @title UVR5 pretrains 安装uvr5模型\n", "%cd /content/GPT-SoVITS/tools/uvr5\n", - "%rm -r uvr5_weights\n", + "%rm -r uvr5_weights\n", "!git clone https://huggingface.co/Delik/uvr5_weights\n", "!git config core.sparseCheckout true\n", "!mv /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/" From 96b53be703eefa5920fd2dcc9f21e3788ca63ec8 Mon Sep 17 00:00:00 2001 From: Hayo <632244510@qq.com> Date: Wed, 17 Apr 2024 17:33:01 +0800 Subject: [PATCH 07/12] Update api.py (#979) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复SynthesizerTrn kwargs 传递异常。 --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index ea0e39d0..015299a4 100644 --- a/api.py +++ b/api.py @@ -174,11 +174,12 @@ def change_sovits_weights(sovits_path): hps = dict_s2["config"] hps = DictToAttrRecursive(hps) hps.model.semantic_frame_rate = "25hz" + model_params_dict = vars(hps.model) vq_model = SynthesizerTrn( hps.data.filter_length // 2 + 1, hps.train.segment_size // hps.data.hop_length, n_speakers=hps.data.n_speakers, - **hps.model + **model_params_dict ) if ("pretrained" not in sovits_path): del vq_model.enc_q From 20c49a37282e13818cf942c08d25db3f75476a45 Mon Sep 17 00:00:00 2001 From: FengQingYunDan Date: Tue, 23 Apr 2024 17:33:02 +0800 Subject: [PATCH 08/12] =?UTF-8?q?api=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=96=87=E6=9C=AC=E5=88=87=E5=88=86=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A=E4=B8=AD=EF=BC=8C=E4=B8=AD=E6=96=87=E5=88=86?= =?UTF-8?q?=E5=8F=B7=E9=94=99=E5=86=99=E4=B8=BA=E8=8B=B1=E6=96=87=E5=88=86?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E9=97=AE=E9=A2=98=20(#1001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api.py b/api.py index 015299a4..eb0533f0 100644 --- a/api.py +++ b/api.py @@ -382,7 +382,7 @@ def read_clean_buffer(audio_bytes): def cut_text(text, punc): - punc_list = [p for p in punc if p in {",", ".", ";", "?", "!", "、", ",", "。", "?", "!", ";", ":", "…"}] + punc_list = [p for p in punc if p in {",", ".", ";", "?", "!", "、", ",", "。", "?", "!", ";", ":", "…"}] if len(punc_list) > 0: punds = r"[" + "".join(punc_list) + r"]" text = text.strip("\n") @@ -580,7 +580,7 @@ parser.add_argument("-hp", "--half_precision", action="store_true", default=Fals # 此时 full_precision==True, half_precision==False parser.add_argument("-sm", "--stream_mode", type=str, default="close", help="流式返回模式, close / normal / keepalive") parser.add_argument("-mt", "--media_type", type=str, default="wav", help="音频编码格式, wav / ogg / aac") -parser.add_argument("-cp", "--cut_punc", type=str, default="", help="文本切分符号设定, 符号范围,.;?!、,。?!;:…") +parser.add_argument("-cp", "--cut_punc", type=str, default="", help="文本切分符号设定, 符号范围,.;?!、,。?!;:…") # 切割常用分句符为 `python ./api.py -cp ".?!。?!"` parser.add_argument("-hb", "--hubert_path", type=str, default=g_config.cnhubert_path, help="覆盖config.cnhubert_path") parser.add_argument("-b", "--bert_path", type=str, default=g_config.bert_path, help="覆盖config.bert_path") From 7c8f63e4c54a27823e93ab692dcb27198bca8f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20=C3=87ak=C4=B1rcal=C4=B1?= <31443145+enescakircali@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:22:30 +0300 Subject: [PATCH 09/12] Add files via upload (#978) --- docs/tr/README.md | 263 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 docs/tr/README.md diff --git a/docs/tr/README.md b/docs/tr/README.md new file mode 100644 index 00000000..0d54557a --- /dev/null +++ b/docs/tr/README.md @@ -0,0 +1,263 @@ +
+ +

GPT-SoVITS-WebUI

+Güçlü Birkaç Örnekli Ses Dönüştürme ve Metinden Konuşmaya Web Arayüzü.

+ +[![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange)](https://github.com/RVC-Boss/GPT-SoVITS) + +
+ +[![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/RVC-Boss/GPT-SoVITS/blob/main/colab_webui.ipynb) +[![License](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/RVC-Boss/GPT-SoVITS/blob/main/LICENSE) +[![Huggingface](https://img.shields.io/badge/🤗%20-Models%20Repo-yellow.svg?style=for-the-badge)](https://huggingface.co/lj1995/GPT-SoVITS/tree/main) +[![Discord](https://img.shields.io/discord/1198701940511617164?color=%23738ADB&label=Discord&style=for-the-badge)](https://discord.gg/dnrgs5GHfG) + + +[**İngilizce**](./README.md) | [**Çince (Basitleştirilmiş)**](./docs/cn/README.md) | [**Japonca**](./docs/ja/README.md) | [**Korece**](./docs/ko/README.md) + +
+ +--- + +## Özellikler: + +1. **Sıfır Örnekli Metinden Konuşmaya:** 5 saniyelik bir vokal örneği girin ve anında metinden konuşmaya dönüşümünü deneyimleyin. + +2. **Birkaç Örnekli Metinden Konuşmaya:** Daha iyi ses benzerliği ve gerçekçiliği için modeli yalnızca 1 dakikalık eğitim verisiyle ince ayarlayın. + +3. **Çapraz Dil Desteği:** Eğitim veri setinden farklı dillerde çıkarım, şu anda İngilizce, Japonca ve Çinceyi destekliyor. + +4. **Web Arayüzü Araçları:** Entegre araçlar arasında vokal eşliğinde ayırma, otomatik eğitim seti segmentasyonu, Çince ASR ve metin etiketleme bulunur ve yeni başlayanların eğitim veri setleri ve GPT/SoVITS modelleri oluşturmalarına yardımcı olur. + +**[Demo videomuzu](https://www.bilibili.com/video/BV12g4y1m7Uw) buradan izleyin!** + +Görünmeyen konuşmacılar birkaç örnekli ince ayar demosu: + +https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb + +**Kullanıcı kılavuzu: [Basitleştirilmiş Çince](https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e) | [İngilizce](https://rentry.co/GPT-SoVITS-guide#/)** + +## Kurulum + +Çin bölgesindeki kullanıcılar için, tam işlevselliği çevrimiçi olarak deneyimlemek üzere AutoDL Bulut Docker'ı kullanmak için [buraya tıklayabilirsiniz](https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official). + +### Test Edilmiş Ortamlar + +- Python 3.9, PyTorch 2.0.1, CUDA 11 +- Python 3.10.13, PyTorch 2.1.2, CUDA 12.3 +- Python 3.9, PyTorch 2.2.2, macOS 14.4.1 (Apple silikon) +- Python 3.9, PyTorch 2.2.2, CPU cihazları + +_Not: numba==0.56.4, py<3.11 gerektirir_ + +### Windows + +Bir Windows kullanıcısıysanız (win>=10 ile test edilmiştir), [önceden paketlenmiş dağıtımı](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true) indirebilir ve GPT-SoVITS-WebUI'yi başlatmak için _go-webui.bat_ dosyasını çift tıklayabilirsiniz. + +Çin bölgesindeki kullanıcılar, aşağıdaki bağlantılara tıklayıp "Bir kopya indir"i seçerek [0217 paketini](https://www.icloud.com.cn/iclouddrive/061bfkcVJcBfsMfLF5R2XKdTQ#GPT-SoVITS-beta0217) veya [0306fix2 paketini](https://www.icloud.com.cn/iclouddrive/09aaTLf96aa92dbLe0fPNM5CQ#GPT-SoVITS-beta0306fix2) indirebilirler. + +_Not: 0306fix2 sürümü çıkarım hızını iki katına çıkarır ve referans metni olmayan moddaki tüm sorunları giderir._ + +### Linux + +```bash +conda create -n GPTSoVits python=3.9 +conda activate GPTSoVits +bash install.sh +``` + +### macOS + +**Not: Mac'lerde GPU'larla eğitilen modeller, diğer cihazlarda eğitilenlere göre önemli ölçüde daha düşük kalitede sonuç verir, bu nedenle geçici olarak CPU'lar kullanıyoruz.** + +1. `xcode-select --install` komutunu çalıştırarak Xcode komut satırı araçlarını yükleyin +2. `brew install ffmpeg` veya `conda install ffmpeg` komutunu çalıştırarak FFmpeg'i yükleyin. +3. Aşağıdaki komutları çalıştırarak programı yükleyin: + +```bash +conda create -n GPTSoVits python=3.9 +conda activate GPTSoVits + +pip install -r requirements.txt +``` + +### El ile Yükleme + +#### Bağımlılıkları Yükleme + +```bash +pip install -r requirements.txt +``` + +#### FFmpeg'i Yükleme + +##### Conda Kullanıcıları + +```bash +conda install ffmpeg +``` + +##### Ubuntu/Debian Kullanıcıları + +```bash +sudo apt install ffmpeg +sudo apt install libsox-dev +conda install -c conda-forge 'ffmpeg<7' +``` + +##### Windows Kullanıcıları + +[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) ve [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) dosyalarını indirin ve GPT-SoVITS kök dizinine yerleştirin. + +### Docker Kullanarak + +#### docker-compose.yaml yapılandırması + +0. Görüntü etiketleri hakkında: Kod tabanındaki hızlı güncellemeler ve görüntüleri paketleme ve test etme işleminin yavaş olması nedeniyle, lütfen şu anda paketlenmiş en son görüntüleri kontrol etmek için [Docker Hub](https://hub.docker.com/r/breakstring/gpt-sovits) adresini kontrol edin ve durumunuza göre seçim yapın veya alternatif olarak, kendi ihtiyaçlarınıza göre bir Dockerfile kullanarak yerel olarak oluşturun. +1. Ortam Değişkenleri: + +- is_half: Yarım hassasiyet/çift hassasiyeti kontrol eder. Bu genellikle "SSL çıkarma" adımı sırasında 4-cnhubert/5-wav32k dizinleri altındaki içeriğin doğru şekilde oluşturulmamasının nedenidir. Gerçek durumunuza göre True veya False olarak ayarlayın. + +2. Birim Yapılandırması,Kapsayıcı içindeki uygulamanın kök dizini /workspace olarak ayarlanmıştır. Varsayılan docker-compose.yaml, içerik yükleme/indirme için bazı pratik örnekler listeler. +3. shm_size: Windows üzerinde Docker Desktop için varsayılan kullanılabilir bellek çok küçüktür, bu da anormal işlemlere neden olabilir. Kendi durumunuza göre ayarlayın. +4. Dağıtım bölümü altında, GPU ile ilgili ayarlar sisteminize ve gerçek koşullara göre dikkatlice ayarlanmalıdır. + +#### docker compose ile çalıştırma + +``` +docker compose -f "docker-compose.yaml" up -d +``` + +#### docker komutu ile çalıştırma + +Yukarıdaki gibi, ilgili parametreleri gerçek durumunuza göre değiştirin, ardından aşağıdaki komutu çalıştırın: + +``` +docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-DockerTest\output:/workspace/output --volume=G:\GPT-SoVITS-DockerTest\logs:/workspace/logs --volume=G:\GPT-SoVITS-DockerTest\SoVITS_weights:/workspace/SoVITS_weights --workdir=/workspace -p 9880:9880 -p 9871:9871 -p 9872:9872 -p 9873:9873 -p 9874:9874 --shm-size="16G" -d breakstring/gpt-sovits:xxxxx +``` + +## Önceden Eğitilmiş Modeller + +Önceden eğitilmiş modelleri [GPT-SoVITS Modelleri](https://huggingface.co/lj1995/GPT-SoVITS) adresinden indirin ve `GPT_SoVITS/pretrained_models` dizinine yerleştirin. + +UVR5 (Vokal/Eşlik Ayırma ve Yankı Giderme, ayrıca) için, modelleri [UVR5 Ağırlıkları](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights) adresinden indirin ve `tools/uvr5/uvr5_weights` dizinine yerleştirin. + +Çin bölgesindeki kullanıcılar, aşağıdaki bağlantıları girerek ve "Bir kopya indir"i tıklayarak bu iki modeli indirebilirler + +- [GPT-SoVITS Modelleri](https://www.icloud.com.cn/iclouddrive/056y_Xog_HXpALuVUjscIwTtg#GPT-SoVITS_Models) + +- [UVR5 Ağırlıkları](https://www.icloud.com.cn/iclouddrive/0bekRKDiJXboFhbfm3lM2fVbA#UVR5_Weights) + +Çince ASR (ayrıca) için, modelleri [Damo ASR Modeli](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/files), [Damo VAD Modeli](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/files), ve [Damo Punc Modeli](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/files) adreslerinden indirin ve `tools/asr/models` dizinine yerleştirin. + +İngilizce veya Japonca ASR (ayrıca) için, modelleri [Faster Whisper Large V3](https://huggingface.co/Systran/faster-whisper-large-v3) adresinden indirin ve `tools/asr/models` dizinine yerleştirin. Ayrıca, [diğer modeller](https://huggingface.co/Systran) daha küçük disk alanı kaplamasıyla benzer etkiye sahip olabilir. + +Çin bölgesindeki kullanıcılar, aşağıdaki bağlantıları girerek bu modeli indirebilirler + +- [Faster Whisper Large V3](https://www.icloud.com/iclouddrive/0c4pQxFs7oWyVU1iMTq2DbmLA#faster-whisper-large-v3) ("Bir kopya indir"i tıklayarak) + +- [Faster Whisper Large V3](https://hf-mirror.com/Systran/faster-whisper-large-v3) (HuggingFace ayna sitesi) + +## Veri Seti Formatı + +TTS açıklama .list dosya formatı: + +``` +vocal_path|speaker_name|language|text +``` + +Dil sözlüğü: + +- 'zh': Çince +- 'ja': Japonca +- 'en': İngilizce + +Örnek: + +``` +D:\GPT-SoVITS\xxx/xxx.wav|xxx|en|I like playing Genshin. +``` + +## Yapılacaklar Listesi + +- [ ] **Yüksek Öncelikli:** + + - [x] Japonca ve İngilizceye yerelleştirme. + - [x] Kullanıcı kılavuzu. + - [x] Japonca ve İngilizce veri seti ince ayar eğitimi. + +- [ ] **Özellikler:** + - [ ] Sıfır örnekli ses dönüştürme (5s) / birkaç örnekli ses dönüştürme (1dk). + - [ ] Metinden konuşmaya konuşma hızı kontrolü. + - [ ] Gelişmiş metinden konuşmaya duygu kontrolü. + - [ ] SoVITS token girdilerini kelime dağarcığı olasılık dağılımına değiştirme denemesi. + - [ ] İngilizce ve Japonca metin ön ucunu iyileştirme. + - [ ] Küçük ve büyük boyutlu metinden konuşmaya modelleri geliştirme. + - [x] Colab betikleri. + - [ ] Eğitim veri setini genişletmeyi dene (2k saat -> 10k saat). + - [ ] daha iyi sovits temel modeli (geliştirilmiş ses kalitesi) + - [ ] model karışımı + +## (İsteğe Bağlı) İhtiyacınız varsa, burada komut satırı işlem modu sağlanacaktır +UVR5 için Web Arayüzünü açmak için komut satırını kullanın +``` +python tools/uvr5/webui.py "" +``` +Bir tarayıcı açamıyorsanız, UVR işleme için aşağıdaki formatı izleyin,Bu ses işleme için mdxnet kullanıyor +``` +python mdxnet.py --model --input_root --output_vocal --output_ins --agg_level --format --device --is_half_precision +``` +Veri setinin ses segmentasyonu komut satırı kullanılarak bu şekilde yapılır +``` +python audio_slicer.py \ + --input_path "" \ + --output_root "" \ + --threshold \ + --min_length \ + --min_interval + --hop_size +``` +Veri seti ASR işleme komut satırı kullanılarak bu şekilde yapılır (Yalnızca Çince) +``` +python tools/asr/funasr_asr.py -i -o <çıktı> +``` +ASR işleme Faster_Whisper aracılığıyla gerçekleştirilir (Çince dışındaki ASR işaretleme) + +(İlerleme çubukları yok, GPU performansı zaman gecikmelerine neden olabilir) +``` +python ./tools/asr/fasterwhisper_asr.py -i -o <çıktı> -l +``` +Özel bir liste kaydetme yolu etkinleştirildi + +## Teşekkürler + +Aşağıdaki projeler ve katkıda bulunanlara özel teşekkürler: + +### Teorik +- [ar-vits](https://github.com/innnky/ar-vits) +- [SoundStorm](https://github.com/yangdongchao/SoundStorm/tree/master/soundstorm/s1/AR) +- [vits](https://github.com/jaywalnut310/vits) +- [TransferTTS](https://github.com/hcy71o/TransferTTS/blob/master/models.py#L556) +- [contentvec](https://github.com/auspicious3000/contentvec/) +- [hifi-gan](https://github.com/jik876/hifi-gan) +- [fish-speech](https://github.com/fishaudio/fish-speech/blob/main/tools/llama/generate.py#L41) +### Önceden Eğitilmiş Modeller +- [Çince Konuşma Ön Eğitimi](https://github.com/TencentGameMate/chinese_speech_pretrain) +- [Çince-Roberta-WWM-Ext-Large](https://huggingface.co/hfl/chinese-roberta-wwm-ext-large) +### Çıkarım için Metin Ön Ucu +- [paddlespeech zh_normalization](https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/paddlespeech/t2s/frontend/zh_normalization) +- [LangSegment](https://github.com/juntaosun/LangSegment) +### Web Arayüzü Araçları +- [ultimatevocalremovergui](https://github.com/Anjok07/ultimatevocalremovergui) +- [audio-slicer](https://github.com/openvpi/audio-slicer) +- [SubFix](https://github.com/cronrpc/SubFix) +- [FFmpeg](https://github.com/FFmpeg/FFmpeg) +- [gradio](https://github.com/gradio-app/gradio) +- [faster-whisper](https://github.com/SYSTRAN/faster-whisper) +- [FunASR](https://github.com/alibaba-damo-academy/FunASR) + +## Tüm katkıda bulunanlara çabaları için teşekkürler + + + + \ No newline at end of file From 0b806dba378340e0592cf7af489694b88cdc222d Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:12:45 +0100 Subject: [PATCH 10/12] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B0=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D=20(#1021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix import error. It may happen when calling api.py * Update README.md * Update gpt-sovits_kaggle.ipynb * Update gpt-sovits_kaggle.ipynb * fix path error delete useless line wraps --- .gitignore | 4 +--- api.py | 9 +++++---- docs/ja/README.md | 2 +- gpt-sovits_kaggle.ipynb | 4 ++-- tools/my_utils.py | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 96e754a9..c484cf22 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,4 @@ logs reference GPT_weights SoVITS_weights -TEMP - - +TEMP \ No newline at end of file diff --git a/api.py b/api.py index eb0533f0..041fa349 100644 --- a/api.py +++ b/api.py @@ -120,6 +120,11 @@ RESP: 无 import argparse import os,re import sys + +now_dir = os.getcwd() +sys.path.append(now_dir) +sys.path.append("%s/GPT_SoVITS" % (now_dir)) + import signal import LangSegment from time import time as ttime @@ -537,10 +542,6 @@ def handle(refer_wav_path, prompt_text, prompt_language, text, text_language, cu # -------------------------------- # 初始化部分 # -------------------------------- -now_dir = os.getcwd() -sys.path.append(now_dir) -sys.path.append("%s/GPT_SoVITS" % (now_dir)) - dict_language = { "中文": "all_zh", "英文": "en", diff --git a/docs/ja/README.md b/docs/ja/README.md index 02d1b836..a910f94d 100644 --- a/docs/ja/README.md +++ b/docs/ja/README.md @@ -159,7 +159,7 @@ D:\GPT-SoVITS\xxx/xxx.wav|xxx|en|I like playing Genshin. - [ ] **優先度 高:** - [x] 日本語と英語でのローカライズ。 - - [] ユーザーガイド。 + - [ ] ユーザーガイド。 - [x] 日本語データセットと英語データセットのファインチューニングトレーニング。 - [ ] **機能:** diff --git a/gpt-sovits_kaggle.ipynb b/gpt-sovits_kaggle.ipynb index 1980a77a..84ecd89c 100644 --- a/gpt-sovits_kaggle.ipynb +++ b/gpt-sovits_kaggle.ipynb @@ -54,11 +54,11 @@ "source": [ "# @title Download pretrained models 下载预训练模型\n", "!mkdir -p /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n", - "!mkdir -p /kaggle/working/GPT-SoVITS/tools/damo_asr/models\n", + "!mkdir -p /kaggle/working/GPT-SoVITS/tools/asr/models\n", "!mkdir -p /kaggle/working/GPT-SoVITS/tools/uvr5\n", "%cd /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n", "!git clone https://huggingface.co/lj1995/GPT-SoVITS\n", - "%cd /kaggle/working/GPT-SoVITS/tools/damo_asr/models\n", + "%cd /kaggle/working/GPT-SoVITS/tools/asr/models\n", "!git clone https://www.modelscope.cn/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git\n", "!git clone https://www.modelscope.cn/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch.git\n", "!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n", diff --git a/tools/my_utils.py b/tools/my_utils.py index a7755d6d..de79f3b5 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -28,4 +28,4 @@ def load_audio(file, sr): def clean_path(path_str): if platform.system() == 'Windows': path_str = path_str.replace('/', '\\') - return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ") + return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a") From a95e6c13b80736f500929b284d4d8f1aafec7c5a Mon Sep 17 00:00:00 2001 From: hcwu1993 <15855138469@163.com> Date: Thu, 2 May 2024 21:26:44 +0800 Subject: [PATCH 11/12] modify freeze_quantizer mode, avoid quantizer's codebook updating (#953) --- GPT_SoVITS/module/models.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/GPT_SoVITS/module/models.py b/GPT_SoVITS/module/models.py index 29676f43..00590331 100644 --- a/GPT_SoVITS/module/models.py +++ b/GPT_SoVITS/module/models.py @@ -15,6 +15,7 @@ from module.mrte_model import MRTE from module.quantize import ResidualVectorQuantizer from text import symbols from torch.cuda.amp import autocast +import contextlib class StochasticDurationPredictor(nn.Module): @@ -890,9 +891,10 @@ class SynthesizerTrn(nn.Module): self.ssl_proj = nn.Conv1d(ssl_dim, ssl_dim, 1, stride=1) self.quantizer = ResidualVectorQuantizer(dimension=ssl_dim, n_q=1, bins=1024) - if freeze_quantizer: - self.ssl_proj.requires_grad_(False) - self.quantizer.requires_grad_(False) + self.freeze_quantizer = freeze_quantizer + # if freeze_quantizer: + # self.ssl_proj.requires_grad_(False) + # self.quantizer.requires_grad_(False) #self.quantizer.eval() # self.enc_p.text_embedding.requires_grad_(False) # self.enc_p.encoder_text.requires_grad_(False) @@ -905,6 +907,11 @@ class SynthesizerTrn(nn.Module): ge = self.ref_enc(y * y_mask, y_mask) with autocast(enabled=False): + maybe_no_grad = torch.no_grad() if self.freeze_quantizer else contextlib.nullcontext + with maybe_no_grad: + if self.freeze_quantizer: + self.ssl_proj.eval() + self.quantizer.eval() ssl = self.ssl_proj(ssl) quantized, codes, commit_loss, quantized_list = self.quantizer( ssl, layers=[0] From 82a5672361baea2351e1c370f49cd0d7f58ccd8b Mon Sep 17 00:00:00 2001 From: Kenn Zhang Date: Sat, 11 May 2024 11:49:21 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=20COPY=20=E6=8C=87=E4=BB=A4=20(#1073)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74e282c4..80cd9f3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,9 +34,6 @@ RUN if [ "$IMAGE_TYPE" != "elite" ]; then \ fi -# Copy the rest of the application -COPY . /workspace - # Copy the rest of the application COPY . /workspace