mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 23:48:48 +08:00
Merge branch 'main' into main
This commit is contained in:
commit
21074e90c4
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,5 +10,3 @@ reference
|
|||||||
GPT_weights
|
GPT_weights
|
||||||
SoVITS_weights
|
SoVITS_weights
|
||||||
TEMP
|
TEMP
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,9 +34,6 @@ RUN if [ "$IMAGE_TYPE" != "elite" ]; then \
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy the rest of the application
|
|
||||||
COPY . /workspace
|
|
||||||
|
|
||||||
# Copy the rest of the application
|
# Copy the rest of the application
|
||||||
COPY . /workspace
|
COPY . /workspace
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ from module.mrte_model import MRTE
|
|||||||
from module.quantize import ResidualVectorQuantizer
|
from module.quantize import ResidualVectorQuantizer
|
||||||
from text import symbols
|
from text import symbols
|
||||||
from torch.cuda.amp import autocast
|
from torch.cuda.amp import autocast
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
|
||||||
class StochasticDurationPredictor(nn.Module):
|
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.ssl_proj = nn.Conv1d(ssl_dim, ssl_dim, 1, stride=1)
|
||||||
|
|
||||||
self.quantizer = ResidualVectorQuantizer(dimension=ssl_dim, n_q=1, bins=1024)
|
self.quantizer = ResidualVectorQuantizer(dimension=ssl_dim, n_q=1, bins=1024)
|
||||||
if freeze_quantizer:
|
self.freeze_quantizer = freeze_quantizer
|
||||||
self.ssl_proj.requires_grad_(False)
|
# if freeze_quantizer:
|
||||||
self.quantizer.requires_grad_(False)
|
# self.ssl_proj.requires_grad_(False)
|
||||||
|
# self.quantizer.requires_grad_(False)
|
||||||
#self.quantizer.eval()
|
#self.quantizer.eval()
|
||||||
# self.enc_p.text_embedding.requires_grad_(False)
|
# self.enc_p.text_embedding.requires_grad_(False)
|
||||||
# self.enc_p.encoder_text.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)
|
ge = self.ref_enc(y * y_mask, y_mask)
|
||||||
|
|
||||||
with autocast(enabled=False):
|
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)
|
ssl = self.ssl_proj(ssl)
|
||||||
quantized, codes, commit_loss, quantized_list = self.quantizer(
|
quantized, codes, commit_loss, quantized_list = self.quantizer(
|
||||||
ssl, layers=[0]
|
ssl, layers=[0]
|
||||||
|
@ -106,6 +106,29 @@ def replace_default_num(match):
|
|||||||
return verbalize_digit(number, alt_one=True)
|
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+))')
|
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
|
# match.group(1) and match.group(8) are copy from RE_NUMBER
|
||||||
|
|
||||||
RE_RANGE = re.compile(
|
RE_RANGE = re.compile(
|
||||||
r'((-?)((\d+)(\.\d+)?)|(\.(\d+)))[-~]((-?)((\d+)(\.\d+)?)|(\.(\d+)))')
|
r"""
|
||||||
|
(?<![\d\+\-\×÷=]) # 使用反向前瞻以确保数字范围之前没有其他数字和操作符
|
||||||
|
((-?)((\d+)(\.\d+)?)) # 匹配范围起始的负数或正数(整数或小数)
|
||||||
|
[-~] # 匹配范围分隔符
|
||||||
|
((-?)((\d+)(\.\d+)?)) # 匹配范围结束的负数或正数(整数或小数)
|
||||||
|
(?![\d\+\-\×÷=]) # 使用正向前瞻以确保数字范围之后没有其他数字和操作符
|
||||||
|
""", re.VERBOSE)
|
||||||
|
|
||||||
|
|
||||||
def replace_range(match) -> str:
|
def replace_range(match) -> str:
|
||||||
@ -165,7 +194,7 @@ def replace_range(match) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str
|
str
|
||||||
"""
|
"""
|
||||||
first, second = match.group(1), match.group(8)
|
first, second = match.group(1), match.group(6)
|
||||||
first = RE_NUMBER.sub(replace_number, first)
|
first = RE_NUMBER.sub(replace_number, first)
|
||||||
second = RE_NUMBER.sub(replace_number, second)
|
second = RE_NUMBER.sub(replace_number, second)
|
||||||
result = f"{first}到{second}"
|
result = f"{first}到{second}"
|
||||||
|
@ -34,6 +34,7 @@ from .num import RE_PERCENTAGE
|
|||||||
from .num import RE_POSITIVE_QUANTIFIERS
|
from .num import RE_POSITIVE_QUANTIFIERS
|
||||||
from .num import RE_RANGE
|
from .num import RE_RANGE
|
||||||
from .num import RE_TO_RANGE
|
from .num import RE_TO_RANGE
|
||||||
|
from .num import RE_ASMD
|
||||||
from .num import replace_default_num
|
from .num import replace_default_num
|
||||||
from .num import replace_frac
|
from .num import replace_frac
|
||||||
from .num import replace_negative_num
|
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_positive_quantifier
|
||||||
from .num import replace_range
|
from .num import replace_range
|
||||||
from .num import replace_to_range
|
from .num import replace_to_range
|
||||||
|
from .num import replace_asmd
|
||||||
from .phonecode import RE_MOBILE_PHONE
|
from .phonecode import RE_MOBILE_PHONE
|
||||||
from .phonecode import RE_NATIONAL_UNIFORM_NUMBER
|
from .phonecode import RE_NATIONAL_UNIFORM_NUMBER
|
||||||
from .phonecode import RE_TELEPHONE
|
from .phonecode import RE_TELEPHONE
|
||||||
@ -67,7 +69,7 @@ class TextNormalizer():
|
|||||||
if lang == "zh":
|
if lang == "zh":
|
||||||
text = text.replace(" ", "")
|
text = text.replace(" ", "")
|
||||||
# 过滤掉特殊字符
|
# 过滤掉特殊字符
|
||||||
text = re.sub(r'[——《》【】<=>{}()()#&@“”^_|\\]', '', text)
|
text = re.sub(r'[——《》【】<>{}()()#&@“”^_|\\]', '', text)
|
||||||
text = self.SENTENCE_SPLITOR.sub(r'\1\n', text)
|
text = self.SENTENCE_SPLITOR.sub(r'\1\n', text)
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
sentences = [sentence.strip() for sentence in re.split(r'\n+', text)]
|
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_NATIONAL_UNIFORM_NUMBER.sub(replace_phone, sentence)
|
||||||
|
|
||||||
sentence = RE_RANGE.sub(replace_range, 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_INTEGER.sub(replace_negative_num, sentence)
|
||||||
sentence = RE_DECIMAL_NUM.sub(replace_number, sentence)
|
sentence = RE_DECIMAL_NUM.sub(replace_number, sentence)
|
||||||
sentence = RE_POSITIVE_QUANTIFIERS.sub(replace_positive_quantifier,
|
sentence = RE_POSITIVE_QUANTIFIERS.sub(replace_positive_quantifier,
|
||||||
|
@ -10,6 +10,8 @@ A Powerful Few-shot Voice Conversion and Text-to-Speech WebUI.<br><br>
|
|||||||
[](https://colab.research.google.com/github/RVC-Boss/GPT-SoVITS/blob/main/colab_webui.ipynb)
|
[](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://github.com/RVC-Boss/GPT-SoVITS/blob/main/LICENSE)
|
||||||
[](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)
|
[](https://huggingface.co/lj1995/GPT-SoVITS/tree/main)
|
||||||
|
[](https://discord.gg/dnrgs5GHfG)
|
||||||
|
|
||||||
|
|
||||||
[**English**](./README.md) | [**中文简体**](./docs/cn/README.md) | [**日本語**](./docs/ja/README.md) | [**한국어**](./docs/ko/README.md)
|
[**English**](./README.md) | [**中文简体**](./docs/cn/README.md) | [**日本語**](./docs/ja/README.md) | [**한국어**](./docs/ko/README.md)
|
||||||
|
|
||||||
|
7
api.py
7
api.py
@ -179,11 +179,12 @@ def change_sovits_weights(sovits_path):
|
|||||||
hps = dict_s2["config"]
|
hps = dict_s2["config"]
|
||||||
hps = DictToAttrRecursive(hps)
|
hps = DictToAttrRecursive(hps)
|
||||||
hps.model.semantic_frame_rate = "25hz"
|
hps.model.semantic_frame_rate = "25hz"
|
||||||
|
model_params_dict = vars(hps.model)
|
||||||
vq_model = SynthesizerTrn(
|
vq_model = SynthesizerTrn(
|
||||||
hps.data.filter_length // 2 + 1,
|
hps.data.filter_length // 2 + 1,
|
||||||
hps.train.segment_size // hps.data.hop_length,
|
hps.train.segment_size // hps.data.hop_length,
|
||||||
n_speakers=hps.data.n_speakers,
|
n_speakers=hps.data.n_speakers,
|
||||||
**hps.model
|
**model_params_dict
|
||||||
)
|
)
|
||||||
if ("pretrained" not in sovits_path):
|
if ("pretrained" not in sovits_path):
|
||||||
del vq_model.enc_q
|
del vq_model.enc_q
|
||||||
@ -386,7 +387,7 @@ def read_clean_buffer(audio_bytes):
|
|||||||
|
|
||||||
|
|
||||||
def cut_text(text, punc):
|
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:
|
if len(punc_list) > 0:
|
||||||
punds = r"[" + "".join(punc_list) + r"]"
|
punds = r"[" + "".join(punc_list) + r"]"
|
||||||
text = text.strip("\n")
|
text = text.strip("\n")
|
||||||
@ -581,7 +582,7 @@ parser.add_argument("-hp", "--half_precision", action="store_true", default=Fals
|
|||||||
# 此时 full_precision==True, half_precision==False
|
# 此时 full_precision==True, half_precision==False
|
||||||
parser.add_argument("-sm", "--stream_mode", type=str, default="close", help="流式返回模式, close / normal / keepalive")
|
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("-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 ".?!。?!"`
|
# 切割常用分句符为 `python ./api.py -cp ".?!。?!"`
|
||||||
parser.add_argument("-hb", "--hubert_path", type=str, default=g_config.cnhubert_path, help="覆盖config.cnhubert_path")
|
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")
|
parser.add_argument("-b", "--bert_path", type=str, default=g_config.bert_path, help="覆盖config.bert_path")
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
"!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n",
|
"!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n",
|
||||||
"# @title UVR5 pretrains 安装uvr5模型\n",
|
"# @title UVR5 pretrains 安装uvr5模型\n",
|
||||||
"%cd /content/GPT-SoVITS/tools/uvr5\n",
|
"%cd /content/GPT-SoVITS/tools/uvr5\n",
|
||||||
|
"%rm -r uvr5_weights\n",
|
||||||
"!git clone https://huggingface.co/Delik/uvr5_weights\n",
|
"!git clone https://huggingface.co/Delik/uvr5_weights\n",
|
||||||
"!git config core.sparseCheckout true\n",
|
"!git config core.sparseCheckout true\n",
|
||||||
"!mv /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/"
|
"!mv /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /content/GPT-SoVITS/GPT_SoVITS/pretrained_models/"
|
||||||
|
263
docs/tr/README.md
Normal file
263
docs/tr/README.md
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<h1>GPT-SoVITS-WebUI</h1>
|
||||||
|
Güçlü Birkaç Örnekli Ses Dönüştürme ve Metinden Konuşmaya Web Arayüzü.<br><br>
|
||||||
|
|
||||||
|
[](https://github.com/RVC-Boss/GPT-SoVITS)
|
||||||
|
|
||||||
|
<img src="https://counter.seku.su/cmoe?name=gptsovits&theme=r34" /><br>
|
||||||
|
|
||||||
|
[](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)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ö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 "<infer_device>" <is_half> <webui_port_uvr5>
|
||||||
|
```
|
||||||
|
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 "<orijinal_ses_dosyası_veya_dizininin_yolu>" \
|
||||||
|
--output_root "<alt_bölümlere_ayrılmış_ses_kliplerinin_kaydedileceği_dizin>" \
|
||||||
|
--threshold <ses_eşiği> \
|
||||||
|
--min_length <her_bir_alt_klibin_minimum_süresi> \
|
||||||
|
--min_interval <bitişik_alt_klipler_arasındaki_en_kısa_zaman_aralığı>
|
||||||
|
--hop_size <ses_eğrisini_hesaplamak_için_adım_boyutu>
|
||||||
|
```
|
||||||
|
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 <girdi> -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 <girdi> -o <çıktı> -l <dil>
|
||||||
|
```
|
||||||
|
Ö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
|
||||||
|
|
||||||
|
<a href="https://github.com/RVC-Boss/GPT-SoVITS/graphs/contributors" target="_blank">
|
||||||
|
<img src="https://contrib.rocks/image?repo=RVC-Boss/GPT-SoVITS" />
|
||||||
|
</a>
|
@ -54,11 +54,11 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# @title Download pretrained models 下载预训练模型\n",
|
"# @title Download pretrained models 下载预训练模型\n",
|
||||||
"!mkdir -p /kaggle/working/GPT-SoVITS/GPT_SoVITS/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",
|
"!mkdir -p /kaggle/working/GPT-SoVITS/tools/uvr5\n",
|
||||||
"%cd /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
"%cd /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||||
"!git clone https://huggingface.co/lj1995/GPT-SoVITS\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_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/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",
|
"!git clone https://www.modelscope.cn/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git\n",
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
os.environ["HF_ENDPOINT"]="https://hf-mirror.com"
|
|
||||||
import traceback
|
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 faster_whisper import WhisperModel
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from tools.asr.config import check_fw_local_models
|
from tools.asr.config import check_fw_local_models
|
||||||
|
|
||||||
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
|
|
||||||
|
|
||||||
language_code_list = [
|
language_code_list = [
|
||||||
"af", "am", "ar", "as", "az",
|
"af", "am", "ar", "as", "az",
|
||||||
"ba", "be", "bg", "bn", "bo",
|
"ba", "be", "bg", "bn", "bo",
|
||||||
@ -50,17 +48,18 @@ def execute_asr(input_folder, output_folder, model_size, language,precision):
|
|||||||
model = WhisperModel(model_path, device=device, compute_type=precision)
|
model = WhisperModel(model_path, device=device, compute_type=precision)
|
||||||
except:
|
except:
|
||||||
return print(traceback.format_exc())
|
return print(traceback.format_exc())
|
||||||
|
|
||||||
|
input_file_names = os.listdir(input_folder)
|
||||||
|
input_file_names.sort()
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
output_file_name = os.path.basename(input_folder)
|
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):
|
for file_name in tqdm(input_file_names):
|
||||||
os.makedirs(output_folder)
|
|
||||||
|
|
||||||
for file in tqdm(glob(os.path.join(input_folder, '**/*.wav'), recursive=True)):
|
|
||||||
try:
|
try:
|
||||||
|
file_path = os.path.join(input_folder, file_name)
|
||||||
segments, info = model.transcribe(
|
segments, info = model.transcribe(
|
||||||
audio = file,
|
audio = file_path,
|
||||||
beam_size = 5,
|
beam_size = 5,
|
||||||
vad_filter = True,
|
vad_filter = True,
|
||||||
vad_parameters = dict(min_silence_duration_ms=700),
|
vad_parameters = dict(min_silence_duration_ms=700),
|
||||||
@ -68,18 +67,23 @@ def execute_asr(input_folder, output_folder, model_size, language,precision):
|
|||||||
text = ''
|
text = ''
|
||||||
|
|
||||||
if info.language == "zh":
|
if info.language == "zh":
|
||||||
print("检测为中文文本,转funasr处理")
|
print("检测为中文文本, 转 FunASR 处理")
|
||||||
if("only_asr"not in globals()):
|
if("only_asr"not in globals()):
|
||||||
from tools.asr.funasr_asr import only_asr##如果用英文就不需要导入下载模型
|
from tools.asr.funasr_asr import \
|
||||||
text = only_asr(file)
|
only_asr # #如果用英文就不需要导入下载模型
|
||||||
|
text = only_asr(file_path)
|
||||||
|
|
||||||
if text == '':
|
if text == '':
|
||||||
for segment in segments:
|
for segment in segments:
|
||||||
text += segment.text
|
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:
|
except:
|
||||||
return print(traceback.format_exc())
|
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:
|
with open(output_file_path, "w", encoding="utf-8") as f:
|
||||||
f.write("\n".join(output))
|
f.write("\n".join(output))
|
||||||
print(f"ASR 任务完成->标注文件路径: {output_file_path}\n")
|
print(f"ASR 任务完成->标注文件路径: {output_file_path}\n")
|
||||||
|
@ -38,10 +38,11 @@ def execute_asr(input_folder, output_folder, model_size, language):
|
|||||||
output = []
|
output = []
|
||||||
output_file_name = os.path.basename(input_folder)
|
output_file_name = os.path.basename(input_folder)
|
||||||
|
|
||||||
for name in tqdm(input_file_names):
|
for file_name in tqdm(input_file_names):
|
||||||
try:
|
try:
|
||||||
text = model.generate(input="%s/%s"%(input_folder, name))[0]["text"]
|
file_path = os.path.join(input_folder, file_name)
|
||||||
output.append(f"{input_folder}/{name}|{output_file_name}|{language.upper()}|{text}")
|
text = model.generate(input=file_path)[0]["text"]
|
||||||
|
output.append(f"{file_path}|{output_file_name}|{language.upper()}|{text}")
|
||||||
except:
|
except:
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
||||||
|
@ -28,4 +28,4 @@ def load_audio(file, sr):
|
|||||||
def clean_path(path_str):
|
def clean_path(path_str):
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
path_str = path_str.replace('/', '\\')
|
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")
|
||||||
|
@ -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.path.basename(inp_path),
|
||||||
)
|
)
|
||||||
os.system(
|
os.system(
|
||||||
"ffmpeg -i %s -vn -acodec pcm_s16le -ac 2 -ar 44100 %s -y"
|
f'ffmpeg -i "{inp_path}" -vn -acodec pcm_s16le -ac 2 -ar 44100 "{tmp_path}" -y'
|
||||||
% (inp_path, tmp_path)
|
|
||||||
)
|
)
|
||||||
inp_path = tmp_path
|
inp_path = tmp_path
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user