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/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
diff --git a/GPT_SoVITS/module/models.py b/GPT_SoVITS/module/models.py
index 29676f43..58a21eee 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]
diff --git a/GPT_SoVITS/prepare_datasets/1-get-text.py b/GPT_SoVITS/prepare_datasets/1-get-text.py
index b2413826..e01a63b9 100644
--- a/GPT_SoVITS/prepare_datasets/1-get-text.py
+++ b/GPT_SoVITS/prepare_datasets/1-get-text.py
@@ -117,9 +117,12 @@ if os.path.exists(txt_path) == False:
try:
wav_name, spk_name, language, text = line.split("|")
# todo.append([name,text,"zh"])
- todo.append(
- [wav_name, text, language_v1_to_language_v2.get(language, language)]
- )
+ if language in language_v1_to_language_v2.keys():
+ todo.append(
+ [wav_name, text, language_v1_to_language_v2.get(language, language)]
+ )
+ else:
+ print(f"\033[33m[Waring] The {language = } of {wav_name} is not supported for training.\033[0m")
except:
print(line, traceback.format_exc())
diff --git a/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py b/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py
index 9a2f73c0..61c933a4 100644
--- a/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py
+++ b/GPT_SoVITS/prepare_datasets/2-get-hubert-wav32k.py
@@ -82,7 +82,7 @@ def name2go(wav_name,wav_path):
tensor_wav16 = tensor_wav16.to(device)
ssl=model.model(tensor_wav16.unsqueeze(0))["last_hidden_state"].transpose(1,2).cpu()#torch.Size([1, 768, 215])
if np.isnan(ssl.detach().numpy()).sum()!= 0:
- nan_fails.append(wav_name)
+ nan_fails.append((wav_name,wav_path))
print("nan filtered:%s"%wav_name)
return
wavfile.write(
@@ -90,7 +90,7 @@ def name2go(wav_name,wav_path):
32000,
tmp_audio32.astype("int16"),
)
- my_save(ssl,hubert_path )
+ my_save(ssl,hubert_path)
with open(inp_text,"r",encoding="utf8")as f:
lines=f.read().strip("\n").split("\n")
@@ -113,8 +113,8 @@ for line in lines[int(i_part)::int(all_parts)]:
if(len(nan_fails)>0 and is_half==True):
is_half=False
model=model.float()
- for wav_name in nan_fails:
+ for wav in nan_fails:
try:
- name2go(wav_name)
+ name2go(wav[0],wav[1])
except:
print(wav_name,traceback.format_exc())
diff --git a/GPT_SoVITS/text/english.py b/GPT_SoVITS/text/english.py
index 68ce7896..30fafb51 100644
--- a/GPT_SoVITS/text/english.py
+++ b/GPT_SoVITS/text/english.py
@@ -320,7 +320,7 @@ class en_G2p(G2p):
# 尝试分离所有格
if re.match(r"^([a-z]+)('s)$", word):
- phones = self.qryword(word[:-2])
+ phones = self.qryword(word[:-2])[:]
# P T K F TH HH 无声辅音结尾 's 发 ['S']
if phones[-1] in ['P', 'T', 'K', 'F', 'TH', 'HH']:
phones.extend(['S'])
@@ -359,4 +359,4 @@ def g2p(text):
if __name__ == "__main__":
print(g2p("hello"))
print(g2p(text_normalize("e.g. I used openai's AI tool to draw a picture.")))
- print(g2p(text_normalize("In this; paper, we propose 1 DSPGAN, a GAN-based universal vocoder.")))
\ No newline at end of file
+ print(g2p(text_normalize("In this; paper, we propose 1 DSPGAN, a GAN-based universal vocoder.")))
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,
diff --git a/api.py b/api.py
index ea0e39d0..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
@@ -174,11 +179,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
@@ -381,7 +387,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")
@@ -536,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",
@@ -579,7 +581,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")
diff --git a/colab_webui.ipynb b/colab_webui.ipynb
index 70fa7940..838f8264 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/"
diff --git a/docs/cn/Changelog_CN.md b/docs/cn/Changelog_CN.md
index 625e4782..36c1db45 100644
--- a/docs/cn/Changelog_CN.md
+++ b/docs/cn/Changelog_CN.md
@@ -147,10 +147,33 @@
5-修改is_half的判断使在Mac上能正常CPU推理 https://github.com/RVC-Boss/GPT-SoVITS/pull/573
+### 202403/202404/202405更新
+
+2个重点
+
+1-修复sovits训练未冻结vq的问题(可能造成效果下降)
+
+2-增加一个快速推理分支
+
+以下都是小修补
+
+1-修复无参考文本模式问题
+
+2-优化中英文文本前端
+
+3-api格式优化
+
+4-cmd格式问题修复
+
+5-训练数据处理阶段不支持的语言提示报错
+
+6-nan自动转fp32阶段的hubert提取bug修复
todolist:
1-中文多音字推理优化(有没有人来测试的,欢迎把测试结果写在pr评论区里) https://github.com/RVC-Boss/GPT-SoVITS/pull/488
-
+(v2底模训练已经合了,下个版本发布就要合了)
+
+2-正在尝试解决低音质参考音频导致音质较差的问题,v2再试试如果能解决就发了,节点暂定高考后吧
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/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ü.
+
+[](https://github.com/RVC-Boss/GPT-SoVITS)
+
+

+
+[](https://colab.research.google.com/github/RVC-Boss/GPT-SoVITS/blob/main/colab_webui.ipynb)
+[](https://github.com/RVC-Boss/GPT-SoVITS/blob/main/LICENSE)
+[](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)
+[](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
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/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())
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")
diff --git a/webui.py b/webui.py
index e1c36e1e..c71c1ca4 100644
--- a/webui.py
+++ b/webui.py
@@ -418,7 +418,10 @@ def open1a(inp_text,inp_wav_dir,exp_name,gpu_numbers,bert_pretrained_dir):
with open(path_text, "w", encoding="utf8") as f:
f.write("\n".join(opt) + "\n")
ps1a=[]
- yield "文本进程结束",{"__type__":"update","visible":True},{"__type__":"update","visible":False}
+ if len("".join(opt)) > 0:
+ yield "文本进程成功", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False}
+ else:
+ yield "文本进程失败", {"__type__": "update", "visible": True}, {"__type__": "update", "visible": False}
else:
yield "已有正在进行的文本任务,需先终止才能开启下一次任务", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}
@@ -583,7 +586,7 @@ def open1abc(inp_text,inp_wav_dir,exp_name,gpu_numbers1a,gpu_numbers1Ba,gpu_numb
os.remove(txt_path)
with open(path_text, "w",encoding="utf8") as f:
f.write("\n".join(opt) + "\n")
-
+ assert len("".join(opt)) > 0, "1Aa-文本获取进程失败"
yield "进度:1a-done", {"__type__": "update", "visible": False}, {"__type__": "update", "visible": True}
ps1abc=[]
#############################1b