mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 23:48:48 +08:00
Merge branch 'main' into add-g2pw
This commit is contained in:
commit
a2e7d10448
@ -3,4 +3,6 @@ logs
|
||||
output
|
||||
reference
|
||||
SoVITS_weights
|
||||
GPT_weights
|
||||
TEMP
|
||||
.git
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -7,5 +7,8 @@ runtime
|
||||
output
|
||||
logs
|
||||
reference
|
||||
SoVITS_weights
|
||||
GPT_weights
|
||||
SoVITS_weights
|
||||
TEMP
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/bucketsampler.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/data/bucket_sampler.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import itertools
|
||||
import math
|
||||
import random
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/data_module.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/data/data_module.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
from pytorch_lightning import LightningDataModule
|
||||
from AR.data.bucket_sampler import DistributedBucketSampler
|
||||
from AR.data.dataset import Text2SemanticDataset
|
||||
@ -41,7 +42,8 @@ class Text2SemanticDataModule(LightningDataModule):
|
||||
# pad_val=self.config['data']['pad_val'])
|
||||
|
||||
def train_dataloader(self):
|
||||
batch_size = max(min(self.config["train"]["batch_size"],len(self._train_dataset)//4),1)#防止不保存
|
||||
batch_size=self.config["train"]["batch_size"]//2 if self.config["train"].get("if_dpo",False)==True else self.config["train"]["batch_size"]
|
||||
batch_size = max(min(batch_size,len(self._train_dataset)//4),1)#防止不保存
|
||||
sampler = DistributedBucketSampler(self._train_dataset, batch_size=batch_size)
|
||||
return DataLoader(
|
||||
self._train_dataset,
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/t2s_dataset.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/data/dataset.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import pdb
|
||||
import sys
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/t2s_lightning_module.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/models/t2s_lightning_module.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import os, sys
|
||||
|
||||
now_dir = os.getcwd()
|
||||
@ -11,7 +12,6 @@ from AR.models.t2s_model import Text2SemanticDecoder
|
||||
from AR.modules.lr_schedulers import WarmupCosineLRSchedule
|
||||
from AR.modules.optim import ScaledAdam
|
||||
|
||||
|
||||
class Text2SemanticLightningModule(LightningModule):
|
||||
def __init__(self, config, output_dir, is_train=True):
|
||||
super().__init__()
|
||||
@ -35,7 +35,8 @@ class Text2SemanticLightningModule(LightningModule):
|
||||
def training_step(self, batch: Dict, batch_idx: int):
|
||||
opt = self.optimizers()
|
||||
scheduler = self.lr_schedulers()
|
||||
loss, acc = self.model.forward(
|
||||
forward=self.model.forward if self.config["train"].get("if_dpo",False)==True else self.model.forward_old
|
||||
loss, acc = forward(
|
||||
batch["phoneme_ids"],
|
||||
batch["phoneme_ids_len"],
|
||||
batch["semantic_ids"],
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/t2s_lightning_module.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/models/t2s_lightning_module.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import os, sys
|
||||
|
||||
now_dir = os.getcwd()
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/t2s_model.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/models/t2s_model.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import torch
|
||||
from tqdm import tqdm
|
||||
|
||||
@ -337,7 +338,7 @@ class Text2SemanticDecoder(nn.Module):
|
||||
|
||||
# AR Decoder
|
||||
y = prompts
|
||||
prefix_len = y.shape[1]
|
||||
|
||||
x_len = x.shape[1]
|
||||
x_attn_mask = torch.zeros((x_len, x_len), dtype=torch.bool)
|
||||
stop = False
|
||||
@ -353,47 +354,41 @@ class Text2SemanticDecoder(nn.Module):
|
||||
"first_infer": 1,
|
||||
"stage": 0,
|
||||
}
|
||||
for idx in tqdm(range(1500)):
|
||||
if cache["first_infer"] == 1:
|
||||
y_emb = self.ar_audio_embedding(y)
|
||||
else:
|
||||
y_emb = torch.cat(
|
||||
[cache["y_emb"], self.ar_audio_embedding(y[:, -1:])], 1
|
||||
)
|
||||
cache["y_emb"] = y_emb
|
||||
################### first step ##########################
|
||||
if y is not None:
|
||||
y_emb = self.ar_audio_embedding(y)
|
||||
y_len = y_emb.shape[1]
|
||||
prefix_len = y.shape[1]
|
||||
y_pos = self.ar_audio_position(y_emb)
|
||||
# x 和逐渐增长的 y 一起输入给模型
|
||||
if cache["first_infer"] == 1:
|
||||
xy_pos = torch.concat([x, y_pos], dim=1)
|
||||
else:
|
||||
xy_pos = y_pos[:, -1:]
|
||||
y_len = y_pos.shape[1]
|
||||
###以下3个不做缓存
|
||||
if cache["first_infer"] == 1:
|
||||
x_attn_mask_pad = F.pad(
|
||||
xy_pos = torch.concat([x, y_pos], dim=1)
|
||||
cache["y_emb"] = y_emb
|
||||
ref_free = False
|
||||
else:
|
||||
y_emb = None
|
||||
y_len = 0
|
||||
prefix_len = 0
|
||||
y_pos = None
|
||||
xy_pos = x
|
||||
y = torch.zeros(x.shape[0], 0, dtype=torch.int, device=x.device)
|
||||
ref_free = True
|
||||
|
||||
x_attn_mask_pad = F.pad(
|
||||
x_attn_mask,
|
||||
(0, y_len), ###xx的纯0扩展到xx纯0+xy纯1,(x,x+y)
|
||||
value=True,
|
||||
)
|
||||
y_attn_mask = F.pad( ###yy的右上1扩展到左边xy的0,(y,x+y)
|
||||
torch.triu(torch.ones(y_len, y_len, dtype=torch.bool), diagonal=1),
|
||||
(x_len, 0),
|
||||
value=False,
|
||||
)
|
||||
xy_attn_mask = torch.concat([x_attn_mask_pad, y_attn_mask], dim=0).to(
|
||||
y.device
|
||||
)
|
||||
else:
|
||||
###最右边一列(是错的)
|
||||
# xy_attn_mask=torch.ones((1, x_len+y_len), dtype=torch.bool,device=xy_pos.device)
|
||||
# xy_attn_mask[:,-1]=False
|
||||
###最下面一行(是对的)
|
||||
xy_attn_mask = torch.zeros(
|
||||
(1, x_len + y_len), dtype=torch.bool, device=xy_pos.device
|
||||
)
|
||||
# pdb.set_trace()
|
||||
###缓存重头戏
|
||||
# print(1111,xy_pos.shape,xy_attn_mask.shape,x_len,y_len)
|
||||
y_attn_mask = F.pad( ###yy的右上1扩展到左边xy的0,(y,x+y)
|
||||
torch.triu(torch.ones(y_len, y_len, dtype=torch.bool), diagonal=1),
|
||||
(x_len, 0),
|
||||
value=False,
|
||||
)
|
||||
xy_attn_mask = torch.concat([x_attn_mask_pad, y_attn_mask], dim=0).to(
|
||||
x.device
|
||||
)
|
||||
|
||||
|
||||
for idx in tqdm(range(1500)):
|
||||
|
||||
xy_dec, _ = self.h((xy_pos, None), mask=xy_attn_mask, cache=cache)
|
||||
logits = self.ar_predict_layer(
|
||||
xy_dec[:, -1]
|
||||
@ -404,6 +399,10 @@ class Text2SemanticDecoder(nn.Module):
|
||||
samples = sample(
|
||||
logits[0], y, top_k=top_k, top_p=top_p, repetition_penalty=1.35, temperature=temperature
|
||||
)[0].unsqueeze(0)
|
||||
# 本次生成的 semantic_ids 和之前的 y 构成新的 y
|
||||
# print(samples.shape)#[1,1]#第一个1是bs
|
||||
y = torch.concat([y, samples], dim=1)
|
||||
|
||||
if early_stop_num != -1 and (y.shape[1] - prefix_len) > early_stop_num:
|
||||
print("use early stop num:", early_stop_num)
|
||||
stop = True
|
||||
@ -412,13 +411,38 @@ class Text2SemanticDecoder(nn.Module):
|
||||
# print(torch.argmax(logits, dim=-1)[0] == self.EOS, samples[0, 0] == self.EOS)
|
||||
stop = True
|
||||
if stop:
|
||||
if prompts.shape[1] == y.shape[1]:
|
||||
# if prompts.shape[1] == y.shape[1]:
|
||||
# y = torch.concat([y, torch.zeros_like(samples)], dim=1)
|
||||
# print("bad zero prediction")
|
||||
if y.shape[1]==0:
|
||||
y = torch.concat([y, torch.zeros_like(samples)], dim=1)
|
||||
print("bad zero prediction")
|
||||
print(f"T2S Decoding EOS [{prefix_len} -> {y.shape[1]}]")
|
||||
break
|
||||
# 本次生成的 semantic_ids 和之前的 y 构成新的 y
|
||||
# print(samples.shape)#[1,1]#第一个1是bs
|
||||
y = torch.concat([y, samples], dim=1)
|
||||
|
||||
####################### update next step ###################################
|
||||
cache["first_infer"] = 0
|
||||
return y, idx
|
||||
if cache["y_emb"] is not None:
|
||||
y_emb = torch.cat(
|
||||
[cache["y_emb"], self.ar_audio_embedding(y[:, -1:])], dim = 1
|
||||
)
|
||||
cache["y_emb"] = y_emb
|
||||
y_pos = self.ar_audio_position(y_emb)
|
||||
xy_pos = y_pos[:, -1:]
|
||||
else:
|
||||
y_emb = self.ar_audio_embedding(y[:, -1:])
|
||||
cache["y_emb"] = y_emb
|
||||
y_pos = self.ar_audio_position(y_emb)
|
||||
xy_pos = y_pos
|
||||
y_len = y_pos.shape[1]
|
||||
|
||||
###最右边一列(是错的)
|
||||
# xy_attn_mask=torch.ones((1, x_len+y_len), dtype=torch.bool,device=xy_pos.device)
|
||||
# xy_attn_mask[:,-1]=False
|
||||
###最下面一行(是对的)
|
||||
xy_attn_mask = torch.zeros(
|
||||
(1, x_len + y_len), dtype=torch.bool, device=xy_pos.device
|
||||
)
|
||||
if ref_free:
|
||||
return y[:, :-1], 0
|
||||
return y[:, :-1], idx-1
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/t2s_model.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/models/t2s_model.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import torch
|
||||
from tqdm import tqdm
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/utils.py\
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/models/utils.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from typing import Tuple
|
||||
@ -114,7 +115,8 @@ def logits_to_probs(
|
||||
top_p: Optional[int] = None,
|
||||
repetition_penalty: float = 1.0,
|
||||
):
|
||||
previous_tokens = previous_tokens.squeeze()
|
||||
if previous_tokens is not None:
|
||||
previous_tokens = previous_tokens.squeeze()
|
||||
# print(logits.shape,previous_tokens.shape)
|
||||
# pdb.set_trace()
|
||||
if previous_tokens is not None and repetition_penalty != 1.0:
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/model/lr_schedulers.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/modules/lr_schedulers.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import math
|
||||
|
||||
import torch
|
||||
|
@ -5,8 +5,8 @@ from torch.nn.functional import (
|
||||
_none_or_dtype,
|
||||
_in_projection_packed,
|
||||
)
|
||||
|
||||
# import torch
|
||||
from torch.nn import functional as F
|
||||
import torch
|
||||
# Tensor = torch.Tensor
|
||||
# from typing import Callable, List, Optional, Tuple, Union
|
||||
|
||||
@ -448,9 +448,11 @@ def multi_head_attention_forward_patched(
|
||||
k = k.view(bsz, num_heads, src_len, head_dim)
|
||||
v = v.view(bsz, num_heads, src_len, head_dim)
|
||||
|
||||
# with torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=True, enable_mem_efficient=True):
|
||||
attn_output = scaled_dot_product_attention(
|
||||
q, k, v, attn_mask, dropout_p, is_causal
|
||||
)
|
||||
|
||||
attn_output = (
|
||||
attn_output.permute(2, 0, 1, 3).contiguous().view(bsz * tgt_len, embed_dim)
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/text_processing/phonemizer.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/text_processing/phonemizer.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
import itertools
|
||||
import re
|
||||
from typing import Dict
|
||||
|
@ -1,4 +1,5 @@
|
||||
# modified from https://github.com/feng-yufei/shared_debugging_code/blob/main/text_processing/symbols.py
|
||||
# modified from https://github.com/yangdongchao/SoundStorm/blob/master/soundstorm/s1/AR/text_processing/symbols.py
|
||||
# reference: https://github.com/lifeiteng/vall-e
|
||||
PAD = "_"
|
||||
PUNCTUATION = ';:,.!?¡¿—…"«»“” '
|
||||
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
|
@ -16,6 +16,7 @@ logging.getLogger("asyncio").setLevel(logging.ERROR)
|
||||
logging.getLogger("charset_normalizer").setLevel(logging.ERROR)
|
||||
logging.getLogger("torchaudio._extension").setLevel(logging.ERROR)
|
||||
import pdb
|
||||
import torch
|
||||
|
||||
if os.path.exists("./gweight.txt"):
|
||||
with open("./gweight.txt", 'r', encoding="utf-8") as file:
|
||||
@ -48,11 +49,11 @@ is_share = os.environ.get("is_share", "False")
|
||||
is_share = eval(is_share)
|
||||
if "_CUDA_VISIBLE_DEVICES" in os.environ:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = os.environ["_CUDA_VISIBLE_DEVICES"]
|
||||
is_half = eval(os.environ.get("is_half", "True"))
|
||||
is_half = eval(os.environ.get("is_half", "True")) and not torch.backends.mps.is_available()
|
||||
import gradio as gr
|
||||
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
||||
import numpy as np
|
||||
import librosa, torch
|
||||
import librosa
|
||||
from feature_extractor import cnhubert
|
||||
|
||||
cnhubert.cnhubert_base_path = cnhubert_base_path
|
||||
@ -72,8 +73,6 @@ os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1' # 确保直接启动推理UI时
|
||||
|
||||
if torch.cuda.is_available():
|
||||
device = "cuda"
|
||||
elif torch.backends.mps.is_available():
|
||||
device = "mps"
|
||||
else:
|
||||
device = "cpu"
|
||||
|
||||
@ -209,50 +208,8 @@ dict_language = {
|
||||
}
|
||||
|
||||
|
||||
def splite_en_inf(sentence, language):
|
||||
pattern = re.compile(r'[a-zA-Z ]+')
|
||||
textlist = []
|
||||
langlist = []
|
||||
pos = 0
|
||||
for match in pattern.finditer(sentence):
|
||||
start, end = match.span()
|
||||
if start > pos:
|
||||
textlist.append(sentence[pos:start])
|
||||
langlist.append(language)
|
||||
textlist.append(sentence[start:end])
|
||||
langlist.append("en")
|
||||
pos = end
|
||||
if pos < len(sentence):
|
||||
textlist.append(sentence[pos:])
|
||||
langlist.append(language)
|
||||
# Merge punctuation into previous word
|
||||
for i in range(len(textlist)-1, 0, -1):
|
||||
if re.match(r'^[\W_]+$', textlist[i]):
|
||||
textlist[i-1] += textlist[i]
|
||||
del textlist[i]
|
||||
del langlist[i]
|
||||
# Merge consecutive words with the same language tag
|
||||
i = 0
|
||||
while i < len(langlist) - 1:
|
||||
if langlist[i] == langlist[i+1]:
|
||||
textlist[i] += textlist[i+1]
|
||||
del textlist[i+1]
|
||||
del langlist[i+1]
|
||||
else:
|
||||
i += 1
|
||||
|
||||
return textlist, langlist
|
||||
|
||||
|
||||
def clean_text_inf(text, language):
|
||||
formattext = ""
|
||||
language = language.replace("all_","")
|
||||
for tmp in LangSegment.getTexts(text):
|
||||
if tmp["lang"] == language:
|
||||
formattext += tmp["text"] + " "
|
||||
while " " in formattext:
|
||||
formattext = formattext.replace(" ", " ")
|
||||
phones, word2ph, norm_text = clean_text(formattext, language)
|
||||
phones, word2ph, norm_text = clean_text(text, language)
|
||||
phones = cleaned_text_to_sequence(phones)
|
||||
return phones, word2ph, norm_text
|
||||
|
||||
@ -270,57 +227,6 @@ def get_bert_inf(phones, word2ph, norm_text, language):
|
||||
return bert
|
||||
|
||||
|
||||
def nonen_clean_text_inf(text, language):
|
||||
if(language!="auto"):
|
||||
textlist, langlist = splite_en_inf(text, language)
|
||||
else:
|
||||
textlist=[]
|
||||
langlist=[]
|
||||
for tmp in LangSegment.getTexts(text):
|
||||
langlist.append(tmp["lang"])
|
||||
textlist.append(tmp["text"])
|
||||
print(textlist)
|
||||
print(langlist)
|
||||
phones_list = []
|
||||
word2ph_list = []
|
||||
norm_text_list = []
|
||||
for i in range(len(textlist)):
|
||||
lang = langlist[i]
|
||||
phones, word2ph, norm_text = clean_text_inf(textlist[i], lang)
|
||||
phones_list.append(phones)
|
||||
if lang == "zh":
|
||||
word2ph_list.append(word2ph)
|
||||
norm_text_list.append(norm_text)
|
||||
print(word2ph_list)
|
||||
phones = sum(phones_list, [])
|
||||
word2ph = sum(word2ph_list, [])
|
||||
norm_text = ' '.join(norm_text_list)
|
||||
|
||||
return phones, word2ph, norm_text
|
||||
|
||||
|
||||
def nonen_get_bert_inf(text, language):
|
||||
if(language!="auto"):
|
||||
textlist, langlist = splite_en_inf(text, language)
|
||||
else:
|
||||
textlist=[]
|
||||
langlist=[]
|
||||
for tmp in LangSegment.getTexts(text):
|
||||
langlist.append(tmp["lang"])
|
||||
textlist.append(tmp["text"])
|
||||
print(textlist)
|
||||
print(langlist)
|
||||
bert_list = []
|
||||
for i in range(len(textlist)):
|
||||
lang = langlist[i]
|
||||
phones, word2ph, norm_text = clean_text_inf(textlist[i], lang)
|
||||
bert = get_bert_inf(phones, word2ph, norm_text, lang)
|
||||
bert_list.append(bert)
|
||||
bert = torch.cat(bert_list, dim=1)
|
||||
|
||||
return bert
|
||||
|
||||
|
||||
splits = {",", "。", "?", "!", ",", ".", "?", "!", "~", ":", ":", "—", "…", }
|
||||
|
||||
|
||||
@ -330,23 +236,63 @@ def get_first(text):
|
||||
return text
|
||||
|
||||
|
||||
def get_cleaned_text_final(text,language):
|
||||
def get_phones_and_bert(text,language):
|
||||
if language in {"en","all_zh","all_ja"}:
|
||||
phones, word2ph, norm_text = clean_text_inf(text, language)
|
||||
language = language.replace("all_","")
|
||||
if language == "en":
|
||||
LangSegment.setfilters(["en"])
|
||||
formattext = " ".join(tmp["text"] for tmp in LangSegment.getTexts(text))
|
||||
else:
|
||||
# 因无法区别中日文汉字,以用户输入为准
|
||||
formattext = text
|
||||
while " " in formattext:
|
||||
formattext = formattext.replace(" ", " ")
|
||||
phones, word2ph, norm_text = clean_text_inf(formattext, language)
|
||||
if language == "zh":
|
||||
bert = get_bert_feature(norm_text, word2ph).to(device)
|
||||
else:
|
||||
bert = torch.zeros(
|
||||
(1024, len(phones)),
|
||||
dtype=torch.float16 if is_half == True else torch.float32,
|
||||
).to(device)
|
||||
elif language in {"zh", "ja","auto"}:
|
||||
phones, word2ph, norm_text = nonen_clean_text_inf(text, language)
|
||||
return phones, word2ph, norm_text
|
||||
textlist=[]
|
||||
langlist=[]
|
||||
LangSegment.setfilters(["zh","ja","en","ko"])
|
||||
if language == "auto":
|
||||
for tmp in LangSegment.getTexts(text):
|
||||
if tmp["lang"] == "ko":
|
||||
langlist.append("zh")
|
||||
textlist.append(tmp["text"])
|
||||
else:
|
||||
langlist.append(tmp["lang"])
|
||||
textlist.append(tmp["text"])
|
||||
else:
|
||||
for tmp in LangSegment.getTexts(text):
|
||||
if tmp["lang"] == "en":
|
||||
langlist.append(tmp["lang"])
|
||||
else:
|
||||
# 因无法区别中日文汉字,以用户输入为准
|
||||
langlist.append(language)
|
||||
textlist.append(tmp["text"])
|
||||
print(textlist)
|
||||
print(langlist)
|
||||
phones_list = []
|
||||
bert_list = []
|
||||
norm_text_list = []
|
||||
for i in range(len(textlist)):
|
||||
lang = langlist[i]
|
||||
phones, word2ph, norm_text = clean_text_inf(textlist[i], lang)
|
||||
bert = get_bert_inf(phones, word2ph, norm_text, lang)
|
||||
phones_list.append(phones)
|
||||
norm_text_list.append(norm_text)
|
||||
bert_list.append(bert)
|
||||
bert = torch.cat(bert_list, dim=1)
|
||||
phones = sum(phones_list, [])
|
||||
norm_text = ''.join(norm_text_list)
|
||||
|
||||
return phones,bert.to(dtype),norm_text
|
||||
|
||||
def get_bert_final(phones, word2ph, text,language,device):
|
||||
if language == "en":
|
||||
bert = get_bert_inf(phones, word2ph, text, language)
|
||||
elif language in {"zh", "ja","auto"}:
|
||||
bert = nonen_get_bert_inf(text, language)
|
||||
elif language == "all_zh":
|
||||
bert = get_bert_feature(text, word2ph).to(device)
|
||||
else:
|
||||
bert = torch.zeros((1024, len(phones))).to(device)
|
||||
return bert
|
||||
|
||||
def merge_short_text_in_array(texts, threshold):
|
||||
if (len(texts)) < 2:
|
||||
@ -365,15 +311,19 @@ def merge_short_text_in_array(texts, threshold):
|
||||
result[len(result) - 1] += text
|
||||
return result
|
||||
|
||||
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切"), top_k=20, top_p=0.6, temperature=0.6):
|
||||
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切"), top_k=20, top_p=0.6, temperature=0.6, ref_free = False):
|
||||
if prompt_text is None or len(prompt_text) == 0:
|
||||
ref_free = True
|
||||
t0 = ttime()
|
||||
prompt_language = dict_language[prompt_language]
|
||||
text_language = dict_language[text_language]
|
||||
prompt_text = prompt_text.strip("\n")
|
||||
if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."
|
||||
if not ref_free:
|
||||
prompt_text = prompt_text.strip("\n")
|
||||
if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."
|
||||
print(i18n("实际输入的参考文本:"), prompt_text)
|
||||
text = text.strip("\n")
|
||||
if (text[0] not in splits and len(get_first(text)) < 4): text = "。" + text if text_language != "en" else "." + text
|
||||
print(i18n("实际输入的参考文本:"), prompt_text)
|
||||
|
||||
print(i18n("实际输入的目标文本:"), text)
|
||||
zero_wav = np.zeros(
|
||||
int(hps.data.sampling_rate * 0.3),
|
||||
@ -398,11 +348,10 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
||||
1, 2
|
||||
) # .float()
|
||||
codes = vq_model.extract_latent(ssl_content)
|
||||
|
||||
prompt_semantic = codes[0, 0]
|
||||
t1 = ttime()
|
||||
|
||||
phones1, word2ph1, norm_text1=get_cleaned_text_final(prompt_text, prompt_language)
|
||||
|
||||
if (how_to_cut == i18n("凑四句一切")):
|
||||
text = cut1(text)
|
||||
elif (how_to_cut == i18n("凑50字一切")):
|
||||
@ -419,7 +368,8 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
||||
texts = text.split("\n")
|
||||
texts = merge_short_text_in_array(texts, 5)
|
||||
audio_opt = []
|
||||
bert1=get_bert_final(phones1, word2ph1, norm_text1,prompt_language,device).to(dtype)
|
||||
if not ref_free:
|
||||
phones1,bert1,norm_text1=get_phones_and_bert(prompt_text, prompt_language)
|
||||
|
||||
for text in texts:
|
||||
# 解决输入目标文本的空行导致报错的问题
|
||||
@ -427,11 +377,15 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
||||
continue
|
||||
if (text[-1] not in splits): text += "。" if text_language != "en" else "."
|
||||
print(i18n("实际输入的目标文本(每句):"), text)
|
||||
phones2, word2ph2, norm_text2 = get_cleaned_text_final(text, text_language)
|
||||
bert2 = get_bert_final(phones2, word2ph2, norm_text2, text_language, device).to(dtype)
|
||||
bert = torch.cat([bert1, bert2], 1)
|
||||
phones2,bert2,norm_text2=get_phones_and_bert(text, text_language)
|
||||
print(i18n("前端处理后的文本(每句):"), norm_text2)
|
||||
if not ref_free:
|
||||
bert = torch.cat([bert1, bert2], 1)
|
||||
all_phoneme_ids = torch.LongTensor(phones1+phones2).to(device).unsqueeze(0)
|
||||
else:
|
||||
bert = bert2
|
||||
all_phoneme_ids = torch.LongTensor(phones2).to(device).unsqueeze(0)
|
||||
|
||||
all_phoneme_ids = torch.LongTensor(phones1 + phones2).to(device).unsqueeze(0)
|
||||
bert = bert.to(device).unsqueeze(0)
|
||||
all_phoneme_len = torch.tensor([all_phoneme_ids.shape[-1]]).to(device)
|
||||
prompt = prompt_semantic.unsqueeze(0).to(device)
|
||||
@ -441,7 +395,7 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
||||
pred_semantic, idx = t2s_model.model.infer_panel(
|
||||
all_phoneme_ids,
|
||||
all_phoneme_len,
|
||||
prompt,
|
||||
None if ref_free else prompt,
|
||||
bert,
|
||||
# prompt_phone_len=ph_offset,
|
||||
top_k=top_k,
|
||||
@ -551,10 +505,13 @@ def cut5(inp):
|
||||
# if not re.search(r'[^\w\s]', inp[-1]):
|
||||
# inp += '。'
|
||||
inp = inp.strip("\n")
|
||||
punds = r'[,.;?!、,。?!;:]'
|
||||
punds = r'[,.;?!、,。?!;:…]'
|
||||
items = re.split(f'({punds})', inp)
|
||||
items = ["".join(group) for group in zip(items[::2], items[1::2])]
|
||||
opt = "\n".join(items)
|
||||
mergeitems = ["".join(group) for group in zip(items[::2], items[1::2])]
|
||||
# 在句子不存在符号或句尾无符号的时候保证文本完整
|
||||
if len(items)%2 == 1:
|
||||
mergeitems.append(items[-1])
|
||||
opt = "\n".join(mergeitems)
|
||||
return opt
|
||||
|
||||
|
||||
@ -607,11 +564,14 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
gr.Markdown(value=i18n("*请上传并填写参考信息"))
|
||||
with gr.Row():
|
||||
inp_ref = gr.Audio(label=i18n("请上传3~10秒内参考音频,超过会报错!"), type="filepath")
|
||||
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
||||
with gr.Column():
|
||||
ref_text_free = gr.Checkbox(label=i18n("开启无参考文本模式。不填参考文本亦相当于开启。"), value=False, interactive=True, show_label=True)
|
||||
gr.Markdown(i18n("使用无参考文本模式时建议使用微调的GPT,听不清参考音频说的啥(不晓得写啥)可以开,开启后无视填写的参考文本。"))
|
||||
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
||||
prompt_language = gr.Dropdown(
|
||||
label=i18n("参考音频的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
||||
)
|
||||
gr.Markdown(value=i18n("*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。"))
|
||||
gr.Markdown(value=i18n("*请填写需要合成的目标文本和语种模式"))
|
||||
with gr.Row():
|
||||
text = gr.Textbox(label=i18n("需要合成的文本"), value="")
|
||||
text_language = gr.Dropdown(
|
||||
@ -624,6 +584,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
interactive=True,
|
||||
)
|
||||
with gr.Row():
|
||||
gr.Markdown(value=i18n("gpt采样参数(无参考文本时不要太低):"))
|
||||
top_k = gr.Slider(minimum=1,maximum=100,step=1,label=i18n("top_k"),value=5,interactive=True)
|
||||
top_p = gr.Slider(minimum=0,maximum=1,step=0.05,label=i18n("top_p"),value=1,interactive=True)
|
||||
temperature = gr.Slider(minimum=0,maximum=1,step=0.05,label=i18n("temperature"),value=1,interactive=True)
|
||||
@ -632,7 +593,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
|
||||
inference_button.click(
|
||||
get_tts_wav,
|
||||
[inp_ref, prompt_text, prompt_language, text, text_language, how_to_cut,top_k,top_p,temperature],
|
||||
[inp_ref, prompt_text, prompt_language, text, text_language, how_to_cut, top_k, top_p, temperature, ref_text_free],
|
||||
[output],
|
||||
)
|
||||
|
||||
@ -650,7 +611,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
button3.click(cut3, [text_inp], [text_opt])
|
||||
button4.click(cut4, [text_inp], [text_opt])
|
||||
button5.click(cut5, [text_inp], [text_opt])
|
||||
gr.Markdown(value=i18n("后续将支持混合语种编码文本输入。"))
|
||||
gr.Markdown(value=i18n("后续将支持转音素、手工修改音素、语音合成分步执行。"))
|
||||
|
||||
app.queue(concurrency_count=511, max_size=1022).launch(
|
||||
server_name="0.0.0.0",
|
||||
|
@ -228,6 +228,7 @@ class TextEncoder(nn.Module):
|
||||
)
|
||||
|
||||
y = self.ssl_proj(y * y_mask) * y_mask
|
||||
|
||||
y = self.encoder_ssl(y * y_mask, y_mask)
|
||||
|
||||
text_mask = torch.unsqueeze(
|
||||
@ -958,11 +959,13 @@ class SynthesizerTrn(nn.Module):
|
||||
|
||||
@torch.no_grad()
|
||||
def decode(self, codes, text, refer, noise_scale=0.5):
|
||||
refer_lengths = torch.LongTensor([refer.size(2)]).to(refer.device)
|
||||
refer_mask = torch.unsqueeze(
|
||||
commons.sequence_mask(refer_lengths, refer.size(2)), 1
|
||||
).to(refer.dtype)
|
||||
ge = self.ref_enc(refer * refer_mask, refer_mask)
|
||||
ge = None
|
||||
if refer is not None:
|
||||
refer_lengths = torch.LongTensor([refer.size(2)]).to(refer.device)
|
||||
refer_mask = torch.unsqueeze(
|
||||
commons.sequence_mask(refer_lengths, refer.size(2)), 1
|
||||
).to(refer.dtype)
|
||||
ge = self.ref_enc(refer * refer_mask, refer_mask)
|
||||
|
||||
y_lengths = torch.LongTensor([codes.size(2) * 2]).to(codes.device)
|
||||
text_lengths = torch.LongTensor([text.size(-1)]).to(text.device)
|
||||
|
@ -33,13 +33,13 @@ from time import time as ttime
|
||||
import shutil
|
||||
|
||||
|
||||
def my_save(fea, path): #####fix issue: torch.save doesn't support chinese path
|
||||
dir = os.path.dirname(path)
|
||||
name = os.path.basename(path)
|
||||
tmp_path = "%s/%s%s.pth" % (dir, ttime(), i_part)
|
||||
torch.save(fea, tmp_path)
|
||||
shutil.move(tmp_path, "%s/%s" % (dir, name))
|
||||
|
||||
def my_save(fea,path):#####fix issue: torch.save doesn't support chinese path
|
||||
dir=os.path.dirname(path)
|
||||
name=os.path.basename(path)
|
||||
# tmp_path="%s/%s%s.pth"%(dir,ttime(),i_part)
|
||||
tmp_path="%s%s.pth"%(ttime(),i_part)
|
||||
torch.save(fea,tmp_path)
|
||||
shutil.move(tmp_path,"%s/%s"%(dir,name))
|
||||
|
||||
|
||||
txt_path = "%s/2-name2text-%s.txt" % (opt_dir, i_part)
|
||||
|
@ -35,7 +35,8 @@ import shutil
|
||||
def my_save(fea,path):#####fix issue: torch.save doesn't support chinese path
|
||||
dir=os.path.dirname(path)
|
||||
name=os.path.basename(path)
|
||||
tmp_path="%s/%s%s.pth"%(dir,ttime(),i_part)
|
||||
# tmp_path="%s/%s%s.pth"%(dir,ttime(),i_part)
|
||||
tmp_path="%s%s.pth"%(ttime(),i_part)
|
||||
torch.save(fea,tmp_path)
|
||||
shutil.move(tmp_path,"%s/%s"%(dir,name))
|
||||
|
||||
@ -98,7 +99,7 @@ for line in lines[int(i_part)::int(all_parts)]:
|
||||
try:
|
||||
# wav_name,text=line.split("\t")
|
||||
wav_name, spk_name, language, text = line.split("|")
|
||||
if (inp_wav_dir !=None):
|
||||
if (inp_wav_dir != "" and inp_wav_dir != None):
|
||||
wav_name = os.path.basename(wav_name)
|
||||
wav_path = "%s/%s"%(inp_wav_dir, wav_name)
|
||||
|
||||
|
@ -1,11 +1,18 @@
|
||||
import traceback
|
||||
from collections import OrderedDict
|
||||
|
||||
from time import time as ttime
|
||||
import shutil,os
|
||||
import torch
|
||||
from tools.i18n.i18n import I18nAuto
|
||||
|
||||
i18n = I18nAuto()
|
||||
|
||||
def my_save(fea,path):#####fix issue: torch.save doesn't support chinese path
|
||||
dir=os.path.dirname(path)
|
||||
name=os.path.basename(path)
|
||||
tmp_path="%s.pth"%(ttime())
|
||||
torch.save(fea,tmp_path)
|
||||
shutil.move(tmp_path,"%s/%s"%(dir,name))
|
||||
|
||||
def savee(ckpt, name, epoch, steps, hps):
|
||||
try:
|
||||
@ -17,7 +24,8 @@ def savee(ckpt, name, epoch, steps, hps):
|
||||
opt["weight"][key] = ckpt[key].half()
|
||||
opt["config"] = hps
|
||||
opt["info"] = "%sepoch_%siteration" % (epoch, steps)
|
||||
torch.save(opt, "%s/%s.pth" % (hps.save_weight_dir, name))
|
||||
# torch.save(opt, "%s/%s.pth" % (hps.save_weight_dir, name))
|
||||
my_save(opt, "%s/%s.pth" % (hps.save_weight_dir, name))
|
||||
return "Success."
|
||||
except:
|
||||
return traceback.format_exc()
|
||||
|
@ -24,6 +24,14 @@ torch.set_float32_matmul_precision("high")
|
||||
from AR.utils import get_newest_ckpt
|
||||
|
||||
from collections import OrderedDict
|
||||
from time import time as ttime
|
||||
import shutil
|
||||
def my_save(fea,path):#####fix issue: torch.save doesn't support chinese path
|
||||
dir=os.path.dirname(path)
|
||||
name=os.path.basename(path)
|
||||
tmp_path="%s.pth"%(ttime())
|
||||
torch.save(fea,tmp_path)
|
||||
shutil.move(tmp_path,"%s/%s"%(dir,name))
|
||||
|
||||
|
||||
class my_model_ckpt(ModelCheckpoint):
|
||||
@ -70,7 +78,8 @@ class my_model_ckpt(ModelCheckpoint):
|
||||
to_save_od["weight"][key] = dictt[key].half()
|
||||
to_save_od["config"] = self.config
|
||||
to_save_od["info"] = "GPT-e%s" % (trainer.current_epoch + 1)
|
||||
torch.save(
|
||||
# torch.save(
|
||||
my_save(
|
||||
to_save_od,
|
||||
"%s/%s-e%s.ckpt"
|
||||
% (
|
||||
|
@ -44,6 +44,8 @@ rep_map = {
|
||||
"$": ".",
|
||||
"/": ",",
|
||||
"—": "-",
|
||||
"~": "…",
|
||||
"~":"…",
|
||||
}
|
||||
|
||||
tone_modifier = ToneSandhi()
|
||||
|
@ -169,9 +169,9 @@ def read_dict_new():
|
||||
line = line.strip()
|
||||
word_split = line.split(" ")
|
||||
word = word_split[0]
|
||||
if word not in g2p_dict:
|
||||
g2p_dict[word] = []
|
||||
g2p_dict[word].append(word_split[1:])
|
||||
#if word not in g2p_dict:
|
||||
g2p_dict[word] = []
|
||||
g2p_dict[word].append(word_split[1:])
|
||||
|
||||
line_index = line_index + 1
|
||||
line = f.readline()
|
||||
|
@ -672,6 +672,7 @@ class ToneSandhi:
|
||||
and i + 1 < len(seg)
|
||||
and seg[i - 1][0] == seg[i + 1][0]
|
||||
and seg[i - 1][1] == "v"
|
||||
and seg[i + 1][1] == "v"
|
||||
):
|
||||
new_seg[i - 1][0] = new_seg[i - 1][0] + "一" + new_seg[i - 1][0]
|
||||
else:
|
||||
|
@ -172,6 +172,21 @@ def replace_range(match) -> str:
|
||||
return result
|
||||
|
||||
|
||||
# ~至表达式
|
||||
RE_TO_RANGE = re.compile(
|
||||
r'((-?)((\d+)(\.\d+)?)|(\.(\d+)))(%|°C|℃|度|摄氏度|cm2|cm²|cm3|cm³|cm|db|ds|kg|km|m2|m²|m³|m3|ml|m|mm|s)[~]((-?)((\d+)(\.\d+)?)|(\.(\d+)))(%|°C|℃|度|摄氏度|cm2|cm²|cm3|cm³|cm|db|ds|kg|km|m2|m²|m³|m3|ml|m|mm|s)')
|
||||
|
||||
def replace_to_range(match) -> str:
|
||||
"""
|
||||
Args:
|
||||
match (re.Match)
|
||||
Returns:
|
||||
str
|
||||
"""
|
||||
result = match.group(0).replace('~', '至')
|
||||
return result
|
||||
|
||||
|
||||
def _get_value(value_string: str, use_zero: bool=True) -> List[str]:
|
||||
stripped = value_string.lstrip('0')
|
||||
if len(stripped) == 0:
|
||||
|
@ -33,6 +33,7 @@ from .num import RE_NUMBER
|
||||
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 replace_default_num
|
||||
from .num import replace_frac
|
||||
from .num import replace_negative_num
|
||||
@ -40,6 +41,7 @@ from .num import replace_number
|
||||
from .num import replace_percentage
|
||||
from .num import replace_positive_quantifier
|
||||
from .num import replace_range
|
||||
from .num import replace_to_range
|
||||
from .phonecode import RE_MOBILE_PHONE
|
||||
from .phonecode import RE_NATIONAL_UNIFORM_NUMBER
|
||||
from .phonecode import RE_TELEPHONE
|
||||
@ -65,7 +67,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)]
|
||||
@ -73,8 +75,8 @@ class TextNormalizer():
|
||||
|
||||
def _post_replace(self, sentence: str) -> str:
|
||||
sentence = sentence.replace('/', '每')
|
||||
sentence = sentence.replace('~', '至')
|
||||
sentence = sentence.replace('~', '至')
|
||||
# sentence = sentence.replace('~', '至')
|
||||
# sentence = sentence.replace('~', '至')
|
||||
sentence = sentence.replace('①', '一')
|
||||
sentence = sentence.replace('②', '二')
|
||||
sentence = sentence.replace('③', '三')
|
||||
@ -128,6 +130,8 @@ class TextNormalizer():
|
||||
sentence = RE_TIME_RANGE.sub(replace_time, sentence)
|
||||
sentence = RE_TIME.sub(replace_time, sentence)
|
||||
|
||||
# 处理~波浪号作为至的替换
|
||||
sentence = RE_TO_RANGE.sub(replace_to_range, sentence)
|
||||
sentence = RE_TEMPERATURE.sub(replace_temperature, sentence)
|
||||
sentence = replace_measure(sentence)
|
||||
sentence = RE_FRAC.sub(replace_frac, sentence)
|
||||
|
@ -64,6 +64,14 @@ def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False
|
||||
)
|
||||
return model, optimizer, learning_rate, iteration
|
||||
|
||||
from time import time as ttime
|
||||
import shutil
|
||||
def my_save(fea,path):#####fix issue: torch.save doesn't support chinese path
|
||||
dir=os.path.dirname(path)
|
||||
name=os.path.basename(path)
|
||||
tmp_path="%s.pth"%(ttime())
|
||||
torch.save(fea,tmp_path)
|
||||
shutil.move(tmp_path,"%s/%s"%(dir,name))
|
||||
|
||||
def save_checkpoint(model, optimizer, learning_rate, iteration, checkpoint_path):
|
||||
logger.info(
|
||||
@ -75,7 +83,8 @@ def save_checkpoint(model, optimizer, learning_rate, iteration, checkpoint_path)
|
||||
state_dict = model.module.state_dict()
|
||||
else:
|
||||
state_dict = model.state_dict()
|
||||
torch.save(
|
||||
# torch.save(
|
||||
my_save(
|
||||
{
|
||||
"model": state_dict,
|
||||
"iteration": iteration,
|
||||
|
152
GPT_SoVITS_Inference.ipynb
Normal file
152
GPT_SoVITS_Inference.ipynb
Normal file
@ -0,0 +1,152 @@
|
||||
{
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0,
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"provenance": []
|
||||
},
|
||||
"kernelspec": {
|
||||
"name": "python3",
|
||||
"display_name": "Python 3"
|
||||
},
|
||||
"accelerator": "GPU"
|
||||
},
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"# Credits for bubarino giving me the huggingface import code (感谢 bubarino 给了我 huggingface 导入代码)"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "himHYZmra7ix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"metadata": {
|
||||
"id": "e9b7iFV3dm1f"
|
||||
},
|
||||
"source": [
|
||||
"!git clone https://github.com/RVC-Boss/GPT-SoVITS.git\n",
|
||||
"%cd GPT-SoVITS\n",
|
||||
"!apt-get update && apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && git lfs install\n",
|
||||
"!pip install -r requirements.txt"
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# @title Download pretrained models 下载预训练模型\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/tools/damo_asr/models\n",
|
||||
"!mkdir -p /content/GPT-SoVITS/tools/uvr5\n",
|
||||
"%cd /content/GPT-SoVITS/GPT_SoVITS/pretrained_models\n",
|
||||
"!git clone https://huggingface.co/lj1995/GPT-SoVITS\n",
|
||||
"%cd /content/GPT-SoVITS/tools/damo_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",
|
||||
"# @title UVR5 pretrains 安装uvr5模型\n",
|
||||
"%cd /content/GPT-SoVITS/tools/uvr5\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/"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "0NgxXg5sjv7z",
|
||||
"cellView": "form"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"#@title Create folder models 创建文件夹模型\n",
|
||||
"import os\n",
|
||||
"base_directory = \"/content/GPT-SoVITS\"\n",
|
||||
"folder_names = [\"SoVITS_weights\", \"GPT_weights\"]\n",
|
||||
"\n",
|
||||
"for folder_name in folder_names:\n",
|
||||
" if os.path.exists(os.path.join(base_directory, folder_name)):\n",
|
||||
" print(f\"The folder '{folder_name}' already exists. (文件夹'{folder_name}'已经存在。)\")\n",
|
||||
" else:\n",
|
||||
" os.makedirs(os.path.join(base_directory, folder_name))\n",
|
||||
" print(f\"The folder '{folder_name}' was created successfully! (文件夹'{folder_name}'已成功创建!)\")\n",
|
||||
"\n",
|
||||
"print(\"All folders have been created. (所有文件夹均已创建。)\")"
|
||||
],
|
||||
"metadata": {
|
||||
"cellView": "form",
|
||||
"id": "cPDEH-9czOJF"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import zipfile\n",
|
||||
"import shutil\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"#@title Import model 导入模型 (HuggingFace)\n",
|
||||
"hf_link = 'https://huggingface.co/modelloosrvcc/Nagisa_Shingetsu_GPT-SoVITS/resolve/main/Nagisa.zip' #@param {type: \"string\"}\n",
|
||||
"\n",
|
||||
"output_path = '/content/'\n",
|
||||
"\n",
|
||||
"response = requests.get(hf_link)\n",
|
||||
"with open(output_path + 'file.zip', 'wb') as file:\n",
|
||||
" file.write(response.content)\n",
|
||||
"\n",
|
||||
"with zipfile.ZipFile(output_path + 'file.zip', 'r') as zip_ref:\n",
|
||||
" zip_ref.extractall(output_path)\n",
|
||||
"\n",
|
||||
"os.remove(output_path + \"file.zip\")\n",
|
||||
"\n",
|
||||
"source_directory = output_path\n",
|
||||
"SoVITS_destination_directory = '/content/GPT-SoVITS/SoVITS_weights'\n",
|
||||
"GPT_destination_directory = '/content/GPT-SoVITS/GPT_weights'\n",
|
||||
"\n",
|
||||
"for filename in os.listdir(source_directory):\n",
|
||||
" if filename.endswith(\".pth\"):\n",
|
||||
" source_path = os.path.join(source_directory, filename)\n",
|
||||
" destination_path = os.path.join(SoVITS_destination_directory, filename)\n",
|
||||
" shutil.move(source_path, destination_path)\n",
|
||||
"\n",
|
||||
"for filename in os.listdir(source_directory):\n",
|
||||
" if filename.endswith(\".ckpt\"):\n",
|
||||
" source_path = os.path.join(source_directory, filename)\n",
|
||||
" destination_path = os.path.join(GPT_destination_directory, filename)\n",
|
||||
" shutil.move(source_path, destination_path)\n",
|
||||
"\n",
|
||||
"print(f'Model downloaded. (模型已下载。)')"
|
||||
],
|
||||
"metadata": {
|
||||
"cellView": "form",
|
||||
"id": "vbZY-LnM0tzq"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# @title launch WebUI 启动WebUI\n",
|
||||
"!/usr/local/bin/pip install ipykernel\n",
|
||||
"!sed -i '10s/False/True/' /content/GPT-SoVITS/config.py\n",
|
||||
"%cd /content/GPT-SoVITS/\n",
|
||||
"!/usr/local/bin/python webui.py"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "4oRGUzkrk8C7",
|
||||
"cellView": "form"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
}
|
||||
]
|
||||
}
|
134
README.md
134
README.md
@ -17,14 +17,6 @@ A Powerful Few-shot Voice Conversion and Text-to-Speech WebUI.<br><br>
|
||||
|
||||
---
|
||||
|
||||
> Check out our [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw) here!
|
||||
|
||||
Unseen speakers few-shot fine-tuning demo:
|
||||
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
For users in China region, you can use AutoDL Cloud Docker to experience the full functionality online: https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official
|
||||
|
||||
## Features:
|
||||
|
||||
1. **Zero-shot TTS:** Input a 5-second vocal sample and experience instant text-to-speech conversion.
|
||||
@ -35,19 +27,31 @@ For users in China region, you can use AutoDL Cloud Docker to experience the ful
|
||||
|
||||
4. **WebUI Tools:** Integrated tools include voice accompaniment separation, automatic training set segmentation, Chinese ASR, and text labeling, assisting beginners in creating training datasets and GPT/SoVITS models.
|
||||
|
||||
## Environment Preparation
|
||||
**Check out our [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw) here!**
|
||||
|
||||
If you are a Windows user (tested with win>=10) you can install directly via the prezip. Just download the [prezip](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true), unzip it and double-click go-webui.bat to start GPT-SoVITS-WebUI.
|
||||
Unseen speakers few-shot fine-tuning demo:
|
||||
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
[教程中文版](https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e) [User guide (EN)](https://rentry.co/GPT-SoVITS-guide#/)
|
||||
|
||||
## Installation
|
||||
|
||||
For users in China region, you can [click here](https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official) to use AutoDL Cloud Docker to experience the full functionality online.
|
||||
|
||||
### Tested Environments
|
||||
|
||||
- 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.3.0.dev20240122, macOS 14.3 (Apple silicon, GPU)
|
||||
- Python 3.9, PyTorch 2.3.0.dev20240122, macOS 14.3 (Apple silicon)
|
||||
|
||||
_Note: numba==0.56.4 require py<3.11_
|
||||
_Note: numba==0.56.4 requires py<3.11_
|
||||
|
||||
### Quick Install with Conda
|
||||
### Windows
|
||||
|
||||
If you are a Windows user (tested with win>=10), you can directly download the [pre-packaged distribution](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true) and double-click on _go-webui.bat_ to start GPT-SoVITS-WebUI.
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
@ -55,15 +59,37 @@ conda activate GPTSoVits
|
||||
bash install.sh
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
Only Macs that meet the following conditions can train models:
|
||||
|
||||
- Mac computers with Apple silicon
|
||||
- macOS 12.3 or later
|
||||
- Xcode command-line tools installed by running `xcode-select --install`
|
||||
|
||||
**All Macs can do inference with CPU, which has been demonstrated to outperform GPU inference.**
|
||||
|
||||
First make sure you have installed FFmpeg by running `brew install ffmpeg` or `conda install ffmpeg`, then install by using the following commands:
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
_Note: Training models will only work if you've installed PyTorch Nightly._
|
||||
|
||||
### Install Manually
|
||||
|
||||
#### Pip Packages
|
||||
#### Install Dependences
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
#### FFmpeg
|
||||
#### Install FFmpeg
|
||||
|
||||
##### Conda Users
|
||||
|
||||
@ -79,57 +105,10 @@ sudo apt install libsox-dev
|
||||
conda install -c conda-forge 'ffmpeg<7'
|
||||
```
|
||||
|
||||
##### MacOS Users
|
||||
|
||||
```bash
|
||||
brew install ffmpeg
|
||||
```
|
||||
|
||||
##### Windows Users
|
||||
|
||||
Download and place [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) and [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) in the GPT-SoVITS root.
|
||||
|
||||
### Pretrained Models
|
||||
|
||||
Download pretrained models from [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) and place them in `GPT_SoVITS/pretrained_models`.
|
||||
|
||||
For UVR5 (Vocals/Accompaniment Separation & Reverberation Removal, additionally), download models from [UVR5 Weights](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights) and place them in `tools/uvr5/uvr5_weights`.
|
||||
|
||||
Users in China region can download these two models by entering the links below and clicking "Download a copy"
|
||||
|
||||
- [GPT-SoVITS Models](https://www.icloud.com.cn/iclouddrive/056y_Xog_HXpALuVUjscIwTtg#GPT-SoVITS_Models)
|
||||
|
||||
- [UVR5 Weights](https://www.icloud.com.cn/iclouddrive/0bekRKDiJXboFhbfm3lM2fVbA#UVR5_Weights)
|
||||
|
||||
For Chinese ASR (additionally), download models from [Damo ASR Model](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/files), [Damo VAD Model](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/files), and [Damo Punc Model](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/files) and place them in `tools/damo_asr/models`.
|
||||
|
||||
### For Mac Users
|
||||
|
||||
If you are a Mac user, make sure you meet the following conditions for training and inferencing with GPU:
|
||||
|
||||
- Mac computers with Apple silicon or AMD GPUs
|
||||
- macOS 12.3 or later
|
||||
- Xcode command-line tools installed by running `xcode-select --install`
|
||||
|
||||
_Other Macs can do inference with CPU only._
|
||||
|
||||
Then install by using the following commands:
|
||||
|
||||
#### Create Environment
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
```
|
||||
|
||||
#### Install Requirements
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip uninstall torch torchaudio
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
```
|
||||
|
||||
### Using Docker
|
||||
|
||||
#### docker-compose.yaml configuration
|
||||
@ -157,6 +136,20 @@ As above, modify the corresponding parameters based on your actual situation, th
|
||||
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
|
||||
```
|
||||
|
||||
## Pretrained Models
|
||||
|
||||
Download pretrained models from [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) and place them in `GPT_SoVITS/pretrained_models`.
|
||||
|
||||
For UVR5 (Vocals/Accompaniment Separation & Reverberation Removal, additionally), download models from [UVR5 Weights](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights) and place them in `tools/uvr5/uvr5_weights`.
|
||||
|
||||
Users in China region can download these two models by entering the links below and clicking "Download a copy"
|
||||
|
||||
- [GPT-SoVITS Models](https://www.icloud.com.cn/iclouddrive/056y_Xog_HXpALuVUjscIwTtg#GPT-SoVITS_Models)
|
||||
|
||||
- [UVR5 Weights](https://www.icloud.com.cn/iclouddrive/0bekRKDiJXboFhbfm3lM2fVbA#UVR5_Weights)
|
||||
|
||||
For Chinese ASR (additionally), download models from [Damo ASR Model](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/files), [Damo VAD Model](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/files), and [Damo Punc Model](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/files) and place them in `tools/damo_asr/models`.
|
||||
|
||||
## Dataset Format
|
||||
|
||||
The TTS annotation .list file format:
|
||||
@ -182,7 +175,7 @@ D:\GPT-SoVITS\xxx/xxx.wav|xxx|en|I like playing Genshin.
|
||||
- [ ] **High Priority:**
|
||||
|
||||
- [x] Localization in Japanese and English.
|
||||
- [ ] User guide.
|
||||
- [x] User guide.
|
||||
- [x] Japanese and English dataset fine tune training.
|
||||
|
||||
- [ ] **Features:**
|
||||
@ -227,26 +220,33 @@ ASR processing is performed through Faster_Whisper(ASR marking except Chinese)
|
||||
python ./tools/damo_asr/WhisperASR.py -i <input> -o <output> -f <file_name.list> -l <language>
|
||||
```
|
||||
A custom list save path is enabled
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
|
||||
Special thanks to the following projects and contributors:
|
||||
|
||||
### Theoretical
|
||||
- [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)
|
||||
- [Chinese Speech Pretrain](https://github.com/TencentGameMate/chinese_speech_pretrain)
|
||||
- [contentvec](https://github.com/auspicious3000/contentvec/)
|
||||
- [hifi-gan](https://github.com/jik876/hifi-gan)
|
||||
- [Chinese-Roberta-WWM-Ext-Large](https://huggingface.co/hfl/chinese-roberta-wwm-ext-large)
|
||||
- [fish-speech](https://github.com/fishaudio/fish-speech/blob/main/tools/llama/generate.py#L41)
|
||||
### Pretrained Models
|
||||
- [Chinese Speech Pretrain](https://github.com/TencentGameMate/chinese_speech_pretrain)
|
||||
- [Chinese-Roberta-WWM-Ext-Large](https://huggingface.co/hfl/chinese-roberta-wwm-ext-large)
|
||||
### Text Frontend for Inference
|
||||
- [paddlespeech zh_normalization](https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/paddlespeech/t2s/frontend/zh_normalization)
|
||||
- [LangSegment](https://github.com/juntaosun/LangSegment)
|
||||
### WebUI Tools
|
||||
- [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)
|
||||
|
||||
## Thanks to all contributors for their efforts
|
||||
|
||||
|
54
api.py
54
api.py
@ -144,7 +144,7 @@ parser.add_argument("-dt", "--default_refer_text", type=str, default="", help="
|
||||
parser.add_argument("-dl", "--default_refer_language", type=str, default="", help="默认参考音频语种")
|
||||
|
||||
parser.add_argument("-d", "--device", type=str, default=g_config.infer_device, help="cuda / cpu / mps")
|
||||
parser.add_argument("-a", "--bind_addr", type=str, default="127.0.0.1", help="default: 127.0.0.1")
|
||||
parser.add_argument("-a", "--bind_addr", type=str, default="0.0.0.0", help="default: 0.0.0.0")
|
||||
parser.add_argument("-p", "--port", type=int, default=g_config.api_port, help="default: 9880")
|
||||
parser.add_argument("-fp", "--full_precision", action="store_true", default=False, help="覆盖config.is_half为False, 使用全精度")
|
||||
parser.add_argument("-hp", "--half_precision", action="store_true", default=False, help="覆盖config.is_half为True, 使用半精度")
|
||||
@ -227,6 +227,44 @@ def is_full(*items): # 任意一项为空返回False
|
||||
return False
|
||||
return True
|
||||
|
||||
def change_sovits_weights(sovits_path):
|
||||
global vq_model, hps
|
||||
dict_s2 = torch.load(sovits_path, map_location="cpu")
|
||||
hps = dict_s2["config"]
|
||||
hps = DictToAttrRecursive(hps)
|
||||
hps.model.semantic_frame_rate = "25hz"
|
||||
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
|
||||
)
|
||||
if ("pretrained" not in sovits_path):
|
||||
del vq_model.enc_q
|
||||
if is_half == True:
|
||||
vq_model = vq_model.half().to(device)
|
||||
else:
|
||||
vq_model = vq_model.to(device)
|
||||
vq_model.eval()
|
||||
print(vq_model.load_state_dict(dict_s2["weight"], strict=False))
|
||||
with open("./sweight.txt", "w", encoding="utf-8") as f:
|
||||
f.write(sovits_path)
|
||||
def change_gpt_weights(gpt_path):
|
||||
global hz, max_sec, t2s_model, config
|
||||
hz = 50
|
||||
dict_s1 = torch.load(gpt_path, map_location="cpu")
|
||||
config = dict_s1["config"]
|
||||
max_sec = config["data"]["max_sec"]
|
||||
t2s_model = Text2SemanticLightningModule(config, "****", is_train=False)
|
||||
t2s_model.load_state_dict(dict_s1["weight"])
|
||||
if is_half == True:
|
||||
t2s_model = t2s_model.half()
|
||||
t2s_model = t2s_model.to(device)
|
||||
t2s_model.eval()
|
||||
total = sum([param.nelement() for param in t2s_model.parameters()])
|
||||
print("Number of parameter: %.2fM" % (total / 1e6))
|
||||
with open("./gweight.txt", "w", encoding="utf-8") as f: f.write(gpt_path)
|
||||
|
||||
|
||||
def get_bert_feature(text, word2ph):
|
||||
with torch.no_grad():
|
||||
@ -452,6 +490,20 @@ def handle(refer_wav_path, prompt_text, prompt_language, text, text_language):
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
#clark新增-----2024-02-21
|
||||
#可在启动后动态修改模型,以此满足同一个api不同的朗读者请求
|
||||
@app.post("/set_model")
|
||||
async def set_model(request: Request):
|
||||
json_post_raw = await request.json()
|
||||
global gpt_path
|
||||
gpt_path=json_post_raw.get("gpt_model_path")
|
||||
global sovits_path
|
||||
sovits_path=json_post_raw.get("sovits_model_path")
|
||||
print("gptpath"+gpt_path+";vitspath"+sovits_path)
|
||||
change_sovits_weights(sovits_path)
|
||||
change_gpt_weights(gpt_path)
|
||||
return "ok"
|
||||
# 新增-----end------
|
||||
|
||||
@app.post("/control")
|
||||
async def control(request: Request):
|
||||
|
@ -82,7 +82,7 @@
|
||||
"source": [
|
||||
"# @title launch WebUI 启动WebUI\n",
|
||||
"!/usr/local/bin/pip install ipykernel\n",
|
||||
"!sed -i '9s/False/True/' /content/GPT-SoVITS/config.py\n",
|
||||
"!sed -i '10s/False/True/' /content/GPT-SoVITS/config.py\n",
|
||||
"%cd /content/GPT-SoVITS/\n",
|
||||
"!/usr/local/bin/python webui.py"
|
||||
],
|
||||
|
@ -19,8 +19,6 @@ exp_root = "logs"
|
||||
python_exec = sys.executable or "python"
|
||||
if torch.cuda.is_available():
|
||||
infer_device = "cuda"
|
||||
elif torch.backends.mps.is_available():
|
||||
infer_device = "mps"
|
||||
else:
|
||||
infer_device = "cpu"
|
||||
|
||||
|
@ -2,13 +2,20 @@
|
||||
|
||||
# 获取当前日期,格式为 YYYYMMDD
|
||||
DATE=$(date +%Y%m%d)
|
||||
# 获取最新的 Git commit 哈希值的前 7 位
|
||||
COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-7)
|
||||
|
||||
# 构建 full 版本的镜像
|
||||
docker build --build-arg IMAGE_TYPE=full -t breakstring/gpt-sovits:latest .
|
||||
# 为同一个镜像添加带日期的标签
|
||||
docker tag breakstring/gpt-sovits:latest breakstring/gpt-sovits:dev-$DATE
|
||||
# 为同一个镜像添加带当前代码库Commit哈希值的标签
|
||||
docker tag breakstring/gpt-sovits:latest breakstring/gpt-sovits:dev-$COMMIT_HASH
|
||||
|
||||
# 构建 elite 版本的镜像
|
||||
|
||||
# 构建 elite 版本的镜像(无模型下载步骤,需手工将模型下载安装进容器)
|
||||
docker build --build-arg IMAGE_TYPE=elite -t breakstring/gpt-sovits:latest-elite .
|
||||
# 为同一个镜像添加带日期的标签
|
||||
docker tag breakstring/gpt-sovits:latest-elite breakstring/gpt-sovits:dev-$DATE-elite
|
||||
# 为同一个镜像添加带当前代码库Commit哈希值的标签
|
||||
docker tag breakstring/gpt-sovits:latest-elite breakstring/gpt-sovits:dev-$COMMIT_HASH-elite
|
||||
|
@ -113,12 +113,44 @@
|
||||
|
||||
2-DPO Loss实验性训练选项开启,通过构造负样本训练缓解GPT重复漏字问题。推理界面公开几个推理参数。 https://github.com/RVC-Boss/GPT-SoVITS/pull/457
|
||||
|
||||
### 20240214更新
|
||||
|
||||
1-训练支持中文实验名(原来会报错)
|
||||
|
||||
2-DPO训练改为可勾选选项而非必须。如勾选batch size自动减半。修复推理界面新参数不传参的问题。
|
||||
|
||||
### 20240216更新
|
||||
|
||||
1-支持无参考文本输入
|
||||
|
||||
2-修复中文文本前端bug https://github.com/RVC-Boss/GPT-SoVITS/issues/475
|
||||
|
||||
### 20240221更新
|
||||
|
||||
1-数据处理添加语音降噪选项(降噪为只剩16k采样率,除非底噪很大先不急着用哦。)
|
||||
|
||||
2-中文日文前端处理优化 https://github.com/RVC-Boss/GPT-SoVITS/pull/559 https://github.com/RVC-Boss/GPT-SoVITS/pull/556 https://github.com/RVC-Boss/GPT-SoVITS/pull/532 https://github.com/RVC-Boss/GPT-SoVITS/pull/507 https://github.com/RVC-Boss/GPT-SoVITS/pull/509
|
||||
|
||||
3-mac CPU推理更快因此把推理设备从mps改到CPU
|
||||
|
||||
4-colab修复不开启公网url
|
||||
|
||||
### 20240306更新
|
||||
|
||||
1-推理加速50%(RTX3090+pytorch2.2.1+cu11.8+win10+py39 tested)https://github.com/RVC-Boss/GPT-SoVITS/pull/672
|
||||
|
||||
2-如果用faster whisper非中文ASR不再需要先下中文funasr模型
|
||||
|
||||
3-修复uvr5去混响模型 是否混响 反的 https://github.com/RVC-Boss/GPT-SoVITS/pull/610
|
||||
|
||||
4-faster whisper如果无cuda可用自动cpu推理 https://github.com/RVC-Boss/GPT-SoVITS/pull/675
|
||||
|
||||
5-修改is_half的判断使在Mac上能正常CPU推理 https://github.com/RVC-Boss/GPT-SoVITS/pull/573
|
||||
|
||||
|
||||
todolist:
|
||||
|
||||
1-中文多音字推理优化
|
||||
|
||||
2-训练支持中文实验名(原来会报错)
|
||||
1-中文多音字推理优化(有没有人来测试的,欢迎把测试结果写在pr评论区里) https://github.com/RVC-Boss/GPT-SoVITS/pull/488
|
||||
|
||||
|
||||
|
||||
|
@ -17,12 +17,6 @@
|
||||
|
||||
---
|
||||
|
||||
> 查看我们的介绍视频 [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw)
|
||||
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
中国地区用户可使用 AutoDL 云端镜像进行体验:https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official
|
||||
|
||||
## 功能:
|
||||
|
||||
1. **零样本文本到语音(TTS):** 输入 5 秒的声音样本,即刻体验文本到语音转换。
|
||||
@ -33,46 +27,29 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-
|
||||
|
||||
4. **WebUI 工具:** 集成工具包括声音伴奏分离、自动训练集分割、中文自动语音识别(ASR)和文本标注,协助初学者创建训练数据集和 GPT/SoVITS 模型。
|
||||
|
||||
## 环境准备
|
||||
**查看我们的介绍视频 [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw)**
|
||||
|
||||
如果你是 Windows 用户(已在 win>=10 上测试),可以直接通过预打包文件安装。只需下载[预打包文件](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true),解压后双击 go-webui.bat 即可启动 GPT-SoVITS-WebUI。
|
||||
未见过的说话者 few-shot 微调演示:
|
||||
|
||||
### 测试通过的 Python 和 PyTorch 版本
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
## 安装
|
||||
|
||||
中国地区用户可[点击此处](https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official)使用 AutoDL 云端镜像进行体验。
|
||||
|
||||
### 测试通过的环境
|
||||
|
||||
- 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.3.0.dev20240122 和 macOS 14.3(Apple 芯片,GPU)
|
||||
- Python 3.9、Pytorch 2.3.0.dev20240122 和 macOS 14.3(Apple 芯片)
|
||||
|
||||
_注意: numba==0.56.4 需要 python<3.11_
|
||||
|
||||
### Mac 用户
|
||||
### Windows
|
||||
|
||||
如果你是 Mac 用户,请先确保满足以下条件以使用 GPU 进行训练和推理:
|
||||
如果你是 Windows 用户(已在 win>=10 上测试),可以直接下载[预打包文件](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true),解压后双击 go-webui.bat 即可启动 GPT-SoVITS-WebUI。
|
||||
|
||||
- 搭载 Apple 芯片或 AMD GPU 的 Mac
|
||||
- macOS 12.3 或更高版本
|
||||
- 已通过运行`xcode-select --install`安装 Xcode command-line tools
|
||||
|
||||
_其他 Mac 仅支持使用 CPU 进行推理_
|
||||
|
||||
然后使用以下命令安装:
|
||||
|
||||
#### 创建环境
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
```
|
||||
|
||||
#### 安装依赖
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip uninstall torch torchaudio
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
```
|
||||
|
||||
### 使用 Conda 快速安装
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
@ -80,15 +57,37 @@ conda activate GPTSoVits
|
||||
bash install.sh
|
||||
```
|
||||
|
||||
### 手动安装包
|
||||
### macOS
|
||||
|
||||
#### Pip 包
|
||||
只有符合以下条件的 Mac 可以训练模型:
|
||||
|
||||
- 搭载 Apple 芯片的 Mac
|
||||
- 运行macOS 12.3 或更高版本
|
||||
- 已通过运行`xcode-select --install`安装 Xcode command-line tools
|
||||
|
||||
**所有 Mac 都可使用 CPU 进行推理,且已测试性能优于 GPU。**
|
||||
|
||||
首先确保你已通过运行 `brew install ffmpeg` 或 `conda install ffmpeg` 安装 FFmpeg,然后运行以下命令安装:
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
_注:只有安装了Pytorch Nightly才可训练模型。_
|
||||
|
||||
### 手动安装
|
||||
|
||||
#### 安装依赖
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
#### FFmpeg
|
||||
#### 安装 FFmpeg
|
||||
|
||||
##### Conda 使用者
|
||||
|
||||
@ -104,12 +103,6 @@ sudo apt install libsox-dev
|
||||
conda install -c conda-forge 'ffmpeg<7'
|
||||
```
|
||||
|
||||
##### MacOS 使用者
|
||||
|
||||
```bash
|
||||
brew install ffmpeg
|
||||
```
|
||||
|
||||
##### Windows 使用者
|
||||
|
||||
下载并将 [ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) 和 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) 放置在 GPT-SoVITS 根目录下。
|
||||
@ -141,11 +134,11 @@ docker compose -f "docker-compose.yaml" up -d
|
||||
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
|
||||
```
|
||||
|
||||
### 预训练模型
|
||||
## 预训练模型
|
||||
|
||||
从 [GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) 下载预训练模型,并将它们放置在 `GPT_SoVITS\pretrained_models` 中。
|
||||
|
||||
对于 UVR5(人声/伴奏分离和混响移除,另外),从 [UVR5 Weights](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights) 下载模型,并将它们放置在 `tools/uvr5/uvr5_weights` 中。
|
||||
对于 UVR5(人声/伴奏分离和混响移除,附加),从 [UVR5 Weights](https://huggingface.co/lj1995/VoiceConversionWebUI/tree/main/uvr5_weights) 下载模型,并将它们放置在 `tools/uvr5/uvr5_weights` 中。
|
||||
|
||||
中国地区用户可以进入以下链接并点击“下载副本”下载以上两个模型:
|
||||
|
||||
@ -153,7 +146,7 @@ docker run --rm -it --gpus=all --env=is_half=False --volume=G:\GPT-SoVITS-Docker
|
||||
|
||||
- [UVR5 Weights](https://www.icloud.com.cn/iclouddrive/0bekRKDiJXboFhbfm3lM2fVbA#UVR5_Weights)
|
||||
|
||||
对于中文自动语音识别(另外),从 [Damo ASR Model](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/files), [Damo VAD Model](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/files), 和 [Damo Punc Model](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/files) 下载模型,并将它们放置在 `tools/damo_asr/models` 中。
|
||||
对于中文自动语音识别(附加),从 [Damo ASR Model](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/files), [Damo VAD Model](https://modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-pytorch/files), 和 [Damo Punc Model](https://modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/files) 下载模型,并将它们放置在 `tools/damo_asr/models` 中。
|
||||
|
||||
## 数据集格式
|
||||
|
||||
|
@ -17,10 +17,6 @@
|
||||
|
||||
---
|
||||
|
||||
> [デモ動画](https://www.bilibili.com/video/BV12g4y1m7Uw)をチェック!
|
||||
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
## 機能:
|
||||
|
||||
1. **ゼロショット TTS:** 5 秒間のボーカルサンプルを入力すると、即座にテキストから音声に変換されます。
|
||||
@ -31,48 +27,27 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-
|
||||
|
||||
4. **WebUI ツール:** 統合されたツールには、音声伴奏の分離、トレーニングセットの自動セグメンテーション、中国語 ASR、テキストラベリングが含まれ、初心者がトレーニングデータセットと GPT/SoVITS モデルを作成するのを支援します。
|
||||
|
||||
## 環境の準備
|
||||
**[デモ動画](https://www.bilibili.com/video/BV12g4y1m7Uw)をチェック!**
|
||||
|
||||
Windows ユーザーであれば(win>=10 にてテスト済み)、prezip 経由で直接インストールできます。[prezip](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true) をダウンロードして解凍し、go-webui.bat をダブルクリックするだけで GPT-SoVITS-WebUI が起動します。
|
||||
未見の話者数ショット微調整デモ:
|
||||
|
||||
### Python と PyTorch のバージョン
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
## インストール
|
||||
|
||||
### テスト済みの環境
|
||||
|
||||
- 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.3.0.dev20240122, macOS 14.3 (Apple silicon, GPU)
|
||||
- Python 3.9, PyTorch 2.3.0.dev20240122, macOS 14.3 (Apple silicon)
|
||||
|
||||
_注記: numba==0.56.4 は py<3.11 が必要です_
|
||||
|
||||
### Mac ユーザーへ
|
||||
### Windows
|
||||
|
||||
如果あなたが Mac ユーザーである場合、GPU を使用してトレーニングおよび推論を行うために以下の条件を満たしていることを確認してください:
|
||||
Windows ユーザーの場合(win>=10 でテスト済み)、[事前にパッケージ化されたディストリビューション](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true)を直接ダウンロードし、_go-webui.bat_ をダブルクリックして GPT-SoVITS-WebUI を起動することができます。
|
||||
|
||||
- Apple シリコンまたは AMD GPU を搭載した Mac コンピューター
|
||||
- macOS 12.3 以降
|
||||
- `xcode-select --install`を実行してインストールされた Xcode コマンドラインツール
|
||||
|
||||
_その他の Mac は CPU のみで推論を行うことができます。_
|
||||
|
||||
次に、以下のコマンドを使用してインストールします:
|
||||
|
||||
#### 環境作成
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
```
|
||||
|
||||
#### Pip パッケージ
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip uninstall torch torchaudio
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
```
|
||||
|
||||
_注記: UVR5 を使用して前処理を行う場合は、[オリジナルプロジェクトの GUI をダウンロード](https://github.com/Anjok07/ultimatevocalremovergui)して、「GPU Conversion」を選択することをお勧めします。さらに、特に推論時にメモリリークの問題が発生する可能性があります。推論 webUI を再起動することでメモリを解放することができます。_
|
||||
|
||||
### Conda によるクイックインストール
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
@ -80,15 +55,37 @@ conda activate GPTSoVits
|
||||
bash install.sh
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
モデルをトレーニングできるMacは、以下の条件を満たす必要があります:
|
||||
|
||||
- Appleシリコンを搭載したMacコンピュータ
|
||||
- macOS 12.3以降
|
||||
- `xcode-select --install`を実行してインストールされたXcodeコマンドラインツール
|
||||
|
||||
**すべてのMacはCPUを使用して推論を行うことができ、GPU推論よりも優れていることが実証されています。**
|
||||
|
||||
まず、`brew install ffmpeg`または`conda install ffmpeg`を実行してFFmpegをインストールしたことを確認してください。次に、以下のコマンドを使用してインストールします:
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
_注:PyTorch Nightlyをインストールした場合にのみ、モデルのトレーニングが可能です。_
|
||||
|
||||
### 手動インストール
|
||||
|
||||
#### Pip パッケージ
|
||||
#### 依存関係をインストールします
|
||||
|
||||
```bash
|
||||
pip install -r requirementx.txt
|
||||
```
|
||||
|
||||
#### FFmpeg
|
||||
#### FFmpegをインストールします。
|
||||
|
||||
##### Conda ユーザー
|
||||
|
||||
@ -104,12 +101,6 @@ sudo apt install libsox-dev
|
||||
conda install -c conda-forge 'ffmpeg<7'
|
||||
```
|
||||
|
||||
##### MacOS ユーザー
|
||||
|
||||
```bash
|
||||
brew install ffmpeg
|
||||
```
|
||||
|
||||
##### Windows ユーザー
|
||||
|
||||
[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe) と [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe) をダウンロードし、GPT-SoVITS のルートディレクトリに置きます。
|
||||
@ -141,7 +132,7 @@ docker compose -f "docker-compose.yaml" up -d
|
||||
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
|
||||
```
|
||||
|
||||
### 事前訓練済みモデル
|
||||
## 事前訓練済みモデル
|
||||
|
||||
[GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS) から事前訓練済みモデルをダウンロードし、`GPT_SoVITSpretrained_models` に置きます。
|
||||
|
||||
|
@ -50,9 +50,45 @@
|
||||
2. 중국어 및 영어 문자열의 문장 부호가 잘리는 문제 및 문장의 시작과 끝에 문장 부호가 추가되는 문제를 수정했습니다.
|
||||
3. 문장 부호의 수를 확장하였습니다.
|
||||
|
||||
todolist:
|
||||
### 20240201 업데이트
|
||||
|
||||
1. 동음이의어(중문) 추론 최적화
|
||||
2. 영문 대문자 인식 및 영문 하이픈 [문제](https://github.com/RVC-Boss/GPT-SoVITS/issues/271)
|
||||
3. 텍스트에 % 기호가 포함되어 있으면 오류가 발생하며 추론이 불가능합니다. 또한 '元/吨'이 '元吨'으로 읽히지 않고 '元每吨'으로 읽히도록 하는 등의 문제가 존재합니다. 이러한 문제를 해결하기 위해 어떤 라이브러리를 사용해야 하며, 이에 대한 개선을 고민하고 있습니다.
|
||||
4. 중-일-영, 중-영, 일-영을 포함한 다섯 가지 언어를 지원하는 것을 목표로 잡고있습니다.
|
||||
1. uvr5가 잘못된 형식으로 읽어들이는 문제를 수정하였습니다.
|
||||
2. 중국어, 일본어, 영어가 혼합된 여러 텍스트를 자동으로 분리하여 언어를 인식합니다.
|
||||
|
||||
### 20240202 업데이트
|
||||
|
||||
1. asr 경로의 끝에 `/`가 포함되어 있는 경우 오류가 발생하는 문제를 수정하였습니다.
|
||||
2. paddlespeech의 Normalizer를 도입하여 [문제를 해결](https://github.com/RVC-Boss/GPT-SoVITS/pull/377)하여, 예를 들어 xx.xx%(백분율), 元/吨이 元吨으로 읽히는 문제를 해결하였습니다. 또한, 밑줄이 더 이상 오류를 발생시키지 않습니다.
|
||||
|
||||
### 20240207 업데이트
|
||||
|
||||
1. 언어 전달 매개변수가 혼란스러워져 [중국어 추론 효과가 저하되는 문제](https://github.com/RVC-Boss/GPT-SoVITS/issues/391)를 수정하였습니다.
|
||||
2. uvr5가 `inf everywhere` [오류를 반환하는 문제](https://github.com/RVC-Boss/GPT-SoVITS/pull/403)를 수정하였습니다.
|
||||
3. uvr5의 `is_half` 매개변수가 bool로 변환되지 않아 항상 반정밀도 추론으로 설정되어 16 시리즈 그래픽 카드에서 `inf`가 반환되는 [문제](https://github.com/RVC-Boss/GPT-SoVITS/commit/14a285109a521679f8846589c22da8f656a46ad8)를 수정하였습니다.
|
||||
4. 영어 텍스트 입력을 최적화하였습니다.
|
||||
5. gradio 종속성을 지원합니다.
|
||||
6. 루트 디렉토리가 비어 있으면 `.list` 전체 경로를 자동으로 읽습니다.
|
||||
7. faster whisper ASR 일본어 및 영어를 지원합니다.
|
||||
|
||||
### 20240208 업데이트
|
||||
|
||||
1. GPT 학습이 카드에 따라 멈추는 문제와 [GPT 학습 중 ZeroDivisionError](https://github.com/RVC-Boss/GPT-SoVITS/commit/59f35adad85815df27e9c6b33d420f5ebfd8376b) 문제를 수정하였습니다.
|
||||
|
||||
### 20240212 업데이트
|
||||
|
||||
1. faster whisper 및 funasr 로직을 최적화하였습니다. faster whisper는 이미지 스토어에서 다운로드하여 huggingface에 연결하지 못하는 문제를 회피합니다.
|
||||
2. DPO Loss 실험적 학습 옵션을 활성화하여 부정적 샘플을 생성하여 [GPT 반복 및 누락 문자 문제](https://github.com/RVC-Boss/GPT-SoVITS/pull/457)를 완화합니다. 추론 인터페이스에 몇 가지 추론 매개변수를 공개합니다.
|
||||
|
||||
### 20240214 업데이트
|
||||
|
||||
1. 학습에서 중국어 실험 이름을 지원합니다. (이전에 오류가 발생했습니다)
|
||||
2. DPO 학습을 선택적으로 설정할 수 있도록 변경하였습니다. 배치 크기를 선택하면 자동으로 절반으로 줄어듭니다. 추론 인터페이스에서 새로운 매개변수를 전달하지 않는 문제를 수정하였습니다.
|
||||
|
||||
### 20240216 업데이트
|
||||
|
||||
1. 참조 텍스트 입력을 지원합니다.
|
||||
2. 프론트엔드에 있던 중국어 텍스트 입력 버그를 수정하였습니다.
|
||||
|
||||
todolist :
|
||||
|
||||
1. 중국어 다음음자 추론 최적화
|
||||
|
@ -17,12 +17,6 @@
|
||||
|
||||
---
|
||||
|
||||
> 데모 비디오를 확인하세요! [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw)
|
||||
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
중국 지역의 사용자는 AutoDL 클라우드 이미지를 사용하여 체험할 수 있습니다: https://www.codewithgpu.com/i/RVC-Boss/GPT-SoVITS/GPT-SoVITS-Official
|
||||
|
||||
## 기능:
|
||||
|
||||
1. **제로샷 텍스트 음성 변환 (TTS):** 5초의 음성 샘플을 입력하면 즉시 텍스트를 음성으로 변환할 수 있습니다.
|
||||
@ -33,46 +27,27 @@ https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-
|
||||
|
||||
4. **WebUI 도구:** 음성 반주 분리, 자동 훈련 데이터셋 분할, 중국어 자동 음성 인식(ASR) 및 텍스트 주석 등의 도구를 통합하여 초보자가 훈련 데이터셋과 GPT/SoVITS 모델을 생성하는 데 도움을 줍니다.
|
||||
|
||||
## 환경 준비
|
||||
**데모 비디오를 확인하세요! [demo video](https://www.bilibili.com/video/BV12g4y1m7Uw)**
|
||||
|
||||
Windows 사용자는 (win>=10 에서 테스트되었습니다) 미리 빌드된 파일을 다운로드하여 설치할 수 있습니다. 다운로드 후 GPT-SoVITS-WebUI를 시작하려면 압축을 풀고 go-webui.bat을 두 번 클릭하면 됩니다.
|
||||
보지 못한 발화자의 퓨샷(few-shot) 파인튜닝 데모:
|
||||
|
||||
### 테스트된 Python 및 PyTorch 버전
|
||||
https://github.com/RVC-Boss/GPT-SoVITS/assets/129054828/05bee1fa-bdd8-4d85-9350-80c060ab47fb
|
||||
|
||||
## 설치
|
||||
|
||||
### 테스트 통과 환경
|
||||
|
||||
- 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.3.0.dev20240122 및 macOS 14.3 (Apple 칩, GPU)
|
||||
- Python 3.9, Pytorch 2.3.0.dev20240122 및 macOS 14.3 (Apple Slilicon)
|
||||
|
||||
_참고: numba==0.56.4 는 python<3.11 을 필요로 합니다._
|
||||
|
||||
### MacOS 사용자
|
||||
### Windows
|
||||
|
||||
MacOS 사용자는 GPU를 사용하여 훈련 및 추론을 하려면 다음 조건을 충족해야 합니다:
|
||||
Windows 사용자이며 (win>=10에서 테스트 완료) [미리 패키지된 배포판](https://huggingface.co/lj1995/GPT-SoVITS-windows-package/resolve/main/GPT-SoVITS-beta.7z?download=true)을 직접 다운로드하여 _go-webui.bat_을 더블클릭하면 GPT-SoVITS-WebUI를 시작할 수 있습니다.
|
||||
|
||||
- Apple 칩 또는 AMD GPU가 장착된 Mac
|
||||
- macOS 12.3 이상
|
||||
- `xcode-select --install`을 실행하여 Xcode command-line tools를 설치했습니다.
|
||||
|
||||
_다른 Mac은 CPU를 사용하여 추론만 지원합니다._
|
||||
|
||||
그런 다음 다음 명령을 사용하여 설치합니다:
|
||||
|
||||
#### 환경 설정
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
```
|
||||
|
||||
#### 의존성 모듈 설치
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip uninstall torch torchaudio
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
```
|
||||
|
||||
### Conda를 사용한 간편 설치
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
@ -80,15 +55,37 @@ conda activate GPTSoVits
|
||||
bash install.sh
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
다음 조건을 충족하는 Mac에서만 모델을 훈련할 수 있습니다:
|
||||
|
||||
- Apple 실리콘을 탑재한 Mac
|
||||
- macOS 12.3 이상 버전
|
||||
- `xcode-select --install`을 실행하여 Xcode 명령줄 도구가 설치됨
|
||||
|
||||
**모든 Mac은 CPU를 사용하여 추론할 수 있으며, GPU 추론보다 우수한 성능을 보여주었습니다.**
|
||||
|
||||
먼저 `brew install ffmpeg` 또는 `conda install ffmpeg`를 실행하여 FFmpeg가 설치되었는지 확인한 다음, 다음 명령어를 사용하여 설치하세요:
|
||||
|
||||
```bash
|
||||
conda create -n GPTSoVits python=3.9
|
||||
conda activate GPTSoVits
|
||||
|
||||
pip3 install --pre torch torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
_참고: PyTorch Nightly가 설치되어야만 모델을 훈련할 수 있습니다._
|
||||
|
||||
### 수동 설치
|
||||
|
||||
#### Pip 패키지
|
||||
#### 의존성 설치
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
#### FFmpeg
|
||||
#### FFmpeg 설치
|
||||
|
||||
##### Conda 사용자
|
||||
|
||||
@ -104,12 +101,6 @@ sudo apt install libsox-dev
|
||||
conda install -c conda-forge 'ffmpeg<7'
|
||||
```
|
||||
|
||||
##### MacOS 사용자
|
||||
|
||||
```bash
|
||||
brew install ffmpeg
|
||||
```
|
||||
|
||||
##### Windows 사용자
|
||||
|
||||
[ffmpeg.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffmpeg.exe)와 [ffprobe.exe](https://huggingface.co/lj1995/VoiceConversionWebUI/blob/main/ffprobe.exe)를 GPT-SoVITS root 디렉토리에 넣습니다.
|
||||
@ -144,7 +135,7 @@ docker compose -f "docker-compose.yaml" up -d
|
||||
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
|
||||
```
|
||||
|
||||
### 사전 훈련된 모델
|
||||
## 사전 훈련된 모델
|
||||
|
||||
[GPT-SoVITS Models](https://huggingface.co/lj1995/GPT-SoVITS)에서 사전 훈련된 모델을 다운로드하고 `GPT_SoVITS\pretrained_models`에 넣습니다.
|
||||
|
||||
|
218
gpt-sovits_kaggle.ipynb
Normal file
218
gpt-sovits_kaggle.ipynb
Normal file
@ -0,0 +1,218 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "45857cb2",
|
||||
"metadata": {
|
||||
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
|
||||
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:43:46.735480Z",
|
||||
"iopub.status.busy": "2024-02-18T14:43:46.735183Z",
|
||||
"iopub.status.idle": "2024-02-18T14:48:10.724175Z",
|
||||
"shell.execute_reply": "2024-02-18T14:48:10.723059Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": 263.994935,
|
||||
"end_time": "2024-02-18T14:48:10.726613",
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:43:46.731678",
|
||||
"status": "completed"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!git clone https://github.com/RVC-Boss/GPT-SoVITS.git\n",
|
||||
"%cd GPT-SoVITS\n",
|
||||
"!apt-get update && apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && git lfs install\n",
|
||||
"!pip install -r requirements.txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b9d346b4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:48:10.815802Z",
|
||||
"iopub.status.busy": "2024-02-18T14:48:10.814899Z",
|
||||
"iopub.status.idle": "2024-02-18T14:50:31.253276Z",
|
||||
"shell.execute_reply": "2024-02-18T14:50:31.252024Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": 140.484893,
|
||||
"end_time": "2024-02-18T14:50:31.255720",
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:48:10.770827",
|
||||
"status": "completed"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"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/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",
|
||||
"!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",
|
||||
"# # @title UVR5 pretrains 安装uvr5模型\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/tools/uvr5\n",
|
||||
"!git clone https://huggingface.co/Delik/uvr5_weights\n",
|
||||
"!git config core.sparseCheckout true\n",
|
||||
"!mv /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models/GPT-SoVITS/* /kaggle/working/GPT-SoVITS/GPT_SoVITS/pretrained_models/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ea94d245",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:29:01.071549Z",
|
||||
"iopub.status.busy": "2024-02-18T14:29:01.070592Z",
|
||||
"iopub.status.idle": "2024-02-18T14:40:45.318368Z",
|
||||
"shell.execute_reply": "2024-02-18T14:40:45.317130Z",
|
||||
"shell.execute_reply.started": "2024-02-18T14:29:01.071512Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"exception": false,
|
||||
"start_time": "2024-02-18T14:50:31.309013",
|
||||
"status": "running"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# @title launch WebUI 启动WebUI\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/\n",
|
||||
"!npm install -g localtunnel\n",
|
||||
"import subprocess\n",
|
||||
"import threading\n",
|
||||
"import time\n",
|
||||
"import socket\n",
|
||||
"import urllib.request\n",
|
||||
"def iframe_thread(port):\n",
|
||||
" while True:\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
|
||||
" result = sock.connect_ex(('127.0.0.1', port))\n",
|
||||
" if result == 0:\n",
|
||||
" break\n",
|
||||
" sock.close()\n",
|
||||
"\n",
|
||||
" from colorama import Fore, Style\n",
|
||||
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
|
||||
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
|
||||
" for line in p.stdout:\n",
|
||||
" print(line.decode(), end='')\n",
|
||||
"threading.Thread (target=iframe_thread, daemon=True, args=(9874,)).start()\n",
|
||||
"\n",
|
||||
"!python webui.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "dda88a6d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-02-18T14:40:56.880608Z",
|
||||
"iopub.status.busy": "2024-02-18T14:40:56.879879Z"
|
||||
},
|
||||
"papermill": {
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"exception": null,
|
||||
"start_time": null,
|
||||
"status": "pending"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 开启推理页面\n",
|
||||
"%cd /kaggle/working/GPT-SoVITS/\n",
|
||||
"!npm install -g localtunnel\n",
|
||||
"import subprocess\n",
|
||||
"import threading\n",
|
||||
"import time\n",
|
||||
"import socket\n",
|
||||
"import urllib.request\n",
|
||||
"def iframe_thread(port):\n",
|
||||
" while True:\n",
|
||||
" time.sleep(0.5)\n",
|
||||
" sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
|
||||
" result = sock.connect_ex(('127.0.0.1', port))\n",
|
||||
" if result == 0:\n",
|
||||
" break\n",
|
||||
" sock.close()\n",
|
||||
"\n",
|
||||
" from colorama import Fore, Style\n",
|
||||
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
|
||||
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
|
||||
" for line in p.stdout:\n",
|
||||
" print(line.decode(), end='')\n",
|
||||
"threading.Thread (target=iframe_thread, daemon=True, args=(9872,)).start()\n",
|
||||
"\n",
|
||||
"!python ./GPT_SoVITS/inference_webui.py"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kaggle": {
|
||||
"accelerator": "nvidiaTeslaT4",
|
||||
"dataSources": [
|
||||
{
|
||||
"datasetId": 4459328,
|
||||
"sourceId": 7649639,
|
||||
"sourceType": "datasetVersion"
|
||||
}
|
||||
],
|
||||
"dockerImageVersionId": 30646,
|
||||
"isGpuEnabled": true,
|
||||
"isInternetEnabled": true,
|
||||
"language": "python",
|
||||
"sourceType": "notebook"
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.13"
|
||||
},
|
||||
"papermill": {
|
||||
"default_parameters": {},
|
||||
"duration": null,
|
||||
"end_time": null,
|
||||
"environment_variables": {},
|
||||
"exception": null,
|
||||
"input_path": "__notebook__.ipynb",
|
||||
"output_path": "__notebook__.ipynb",
|
||||
"parameters": {},
|
||||
"start_time": "2024-02-18T14:43:44.011910",
|
||||
"version": "2.5.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
@ -2,6 +2,18 @@
|
||||
"很遗憾您这没有能用的显卡来支持您训练": "Unfortunately, there is no compatible GPU available to support your training.",
|
||||
"UVR5已开启": "UVR5 opened ",
|
||||
"UVR5已关闭": "UVR5 closed",
|
||||
"输入文件夹路径": "Input folder path",
|
||||
"输出文件夹路径": "Output folder path",
|
||||
"ASR 模型": "ASR model",
|
||||
"ASR 模型尺寸": "ASR model size",
|
||||
"ASR 语言设置": "ASR language",
|
||||
"模型切换": "Model switch",
|
||||
"是否开启dpo训练选项(实验性)": "Enable DPO training (experimental feature)",
|
||||
"开启无参考文本模式。不填参考文本亦相当于开启。": "Enable no reference mode. If you don't fill 'Text for reference audio', no reference mode will be enabled.",
|
||||
"使用无参考文本模式时建议使用微调的GPT": "Please use your trained GPT model if you don't use reference audio.",
|
||||
"后续将支持转音素、手工修改音素、语音合成分步执行。": " Step-to-step phoneme transformation and modification coming soon!",
|
||||
"gpt采样参数(无参考文本时不要太低):": "GPT parameters:",
|
||||
"按标点符号切": "Slice by every punct",
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>LICENSE</b>.": "This software is open source under the MIT license. The author does not have any control over the software. Users who use the software and distribute the sounds exported by the software are solely responsible. <br>If you do not agree with this clause, you cannot use or reference any codes and files within the software package. See the root directory <b>Agreement-LICENSE</b> for details.",
|
||||
"0-前置数据集获取工具": "0-Fetch dataset",
|
||||
"0a-UVR5人声伴奏分离&去混响去延迟工具": "0a-UVR5 webui (for vocal separation, deecho, dereverb and denoise)",
|
||||
|
@ -8,8 +8,16 @@
|
||||
"是否开启UVR5-WebUI": "¿Habilitar UVR5-WebUI?",
|
||||
"UVR5进程输出信息": "Información de salida del proceso UVR5",
|
||||
"0b-语音切分工具": "0b-Herramienta de división de voz",
|
||||
".list标注文件的路径": "Ruta del archivo de anotación .list",
|
||||
"GPT模型列表": "Lista de modelos GPT",
|
||||
"SoVITS模型列表": "Lista de modelos SoVITS",
|
||||
"填切割后音频所在目录!读取的音频文件完整路径=该目录-拼接-list文件里波形对应的文件名(不是全路径)。": "Directorio donde se guardan los archivos de audio después del corte! Ruta completa del archivo de audio a leer = este directorio - nombre de archivo correspondiente a la forma de onda en el archivo de lista (no la ruta completa).",
|
||||
"音频自动切分输入路径,可文件可文件夹": "Ruta de entrada para la división automática de audio, puede ser un archivo o una carpeta",
|
||||
"切分后的子音频的输出根目录": "Directorio raíz de salida de los sub-audios después de la división",
|
||||
"怎么切": "Cómo cortar",
|
||||
"不切": "No cortar",
|
||||
"凑四句一切": "Completa cuatro oraciones para rellenar todo",
|
||||
"按英文句号.切": "Cortar por puntos en inglés.",
|
||||
"threshold:音量小于这个值视作静音的备选切割点": "umbral: puntos de corte alternativos considerados como silencio si el volumen es menor que este valor",
|
||||
"min_length:每段最小多长,如果第一段太短一直和后面段连起来直到超过这个值": "min_length: duración mínima de cada segmento, si el primer segmento es demasiado corto, se conecta continuamente con los siguientes hasta que supera este valor",
|
||||
"min_interval:最短切割间隔": "min_interval: intervalo mínimo de corte",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>LICENSE</b>.": "본 소프트웨어는 MIT 라이선스로 오픈 소스로 제공되며, 제작자는 소프트웨어에 대해 어떠한 제어력도 가지지 않습니다. 소프트웨어 사용자 및 소프트웨어에서 내보낸 소리를 전파하는 자는 전적으로 책임져야 합니다. <br>이 조항을 인정하지 않으면 소프트웨어의 코드 및 파일을 사용하거나 인용할 수 없습니다. 루트 디렉터리의 <b>LICENSE</b>를 참조하십시오.",
|
||||
"0-前置数据集获取工具": "0-전방 데이터 세트 수집 도구",
|
||||
"0a-UVR5人声伴奏分离&去混响去延迟工具": "0a-UVR5 보컬 및 반주 분리 및 에코 및 지연 제거 도구",
|
||||
"是否开启UVR5-WebUI": "UVR5-WebUI 활성화 여부",
|
||||
"是否开启UVR5-WebUI": "UVR5-WebUI를 여시겠습니까?",
|
||||
"UVR5进程输出信息": "UVR5 프로세스 출력 정보",
|
||||
"0b-语音切分工具": "0b-음성 분리 도구",
|
||||
".list标注文件的路径": ".list 주석 파일 경로",
|
||||
|
@ -23,6 +23,6 @@ PyYAML
|
||||
psutil
|
||||
jieba_fast
|
||||
jieba
|
||||
LangSegment
|
||||
LangSegment>=0.2.0
|
||||
Faster_Whisper
|
||||
OpenCC
|
@ -4,12 +4,12 @@ os.environ["HF_ENDPOINT"]="https://hf-mirror.com"
|
||||
import traceback
|
||||
import requests
|
||||
from glob import glob
|
||||
import torch
|
||||
|
||||
from faster_whisper import WhisperModel
|
||||
from tqdm import tqdm
|
||||
|
||||
from tools.asr.config import check_fw_local_models
|
||||
from tools.asr.funasr_asr import only_asr
|
||||
|
||||
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
|
||||
|
||||
@ -45,8 +45,9 @@ def execute_asr(input_folder, output_folder, model_size, language,precision):
|
||||
if language == 'auto':
|
||||
language = None #不设置语种由模型自动输出概率最高的语种
|
||||
print("loading faster whisper model:",model_size,model_path)
|
||||
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||
try:
|
||||
model = WhisperModel(model_path, device="cuda", compute_type=precision)
|
||||
model = WhisperModel(model_path, device=device, compute_type=precision)
|
||||
except:
|
||||
return print(traceback.format_exc())
|
||||
output = []
|
||||
@ -68,6 +69,8 @@ def execute_asr(input_folder, output_folder, model_size, language,precision):
|
||||
|
||||
if info.language == "zh":
|
||||
print("检测为中文文本,转funasr处理")
|
||||
if("only_asr"not in globals()):
|
||||
from tools.asr.funasr_asr import only_asr##如果用英文就不需要导入下载模型
|
||||
text = only_asr(file)
|
||||
|
||||
if text == '':
|
||||
|
29
tools/cmd-denoise.py
Normal file
29
tools/cmd-denoise.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os,argparse
|
||||
|
||||
from modelscope.pipelines import pipeline
|
||||
from modelscope.utils.constant import Tasks
|
||||
from tqdm import tqdm
|
||||
|
||||
path_denoise = 'tools/denoise-model/speech_frcrn_ans_cirm_16k'
|
||||
path_denoise = path_denoise if os.path.exists(path_denoise) else "damo/speech_frcrn_ans_cirm_16k"
|
||||
ans = pipeline(Tasks.acoustic_noise_suppression,model=path_denoise)
|
||||
def execute_denoise(input_folder,output_folder):
|
||||
os.makedirs(output_folder,exist_ok=True)
|
||||
# print(input_folder)
|
||||
# print(list(os.listdir(input_folder).sort()))
|
||||
for name in tqdm(os.listdir(input_folder)):
|
||||
ans("%s/%s"%(input_folder,name),output_path='%s/%s'%(output_folder,name))
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-i", "--input_folder", type=str, required=True,
|
||||
help="Path to the folder containing WAV files.")
|
||||
parser.add_argument("-o", "--output_folder", type=str, required=True,
|
||||
help="Output folder to store transcriptions.")
|
||||
parser.add_argument("-p", "--precision", type=str, default='float16', choices=['float16','float32'],
|
||||
help="fp16 or fp32")#还没接入
|
||||
cmd = parser.parse_args()
|
||||
execute_denoise(
|
||||
input_folder = cmd.input_folder,
|
||||
output_folder = cmd.output_folder,
|
||||
)
|
2
tools/denoise-model/.gitignore
vendored
Normal file
2
tools/denoise-model/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
285
tools/i18n/locale/ko_KR.json
Normal file
285
tools/i18n/locale/ko_KR.json
Normal file
@ -0,0 +1,285 @@
|
||||
{
|
||||
"很遗憾您这没有能用的显卡来支持您训练": "죄송합니다. 훈련을 지원할 수 있는 그래픽 카드가 없습니다.",
|
||||
"UVR5已开启": "UVR5가 활성화되었습니다",
|
||||
"UVR5已关闭": "UVR5가 비활성화되었습니다",
|
||||
"本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责. <br>如不认可该条款, 则不能使用或引用软件包内任何代码和文件. 详见根目录<b>LICENSE</b>.": "본 소프트웨어는 MIT 라이선스로 오픈 소스로 제공되며, 제작자는 소프트웨어에 대해 어떠한 제어력도 가지지 않습니다. 소프트웨어 사용자 및 소프트웨어에서 내보낸 소리를 전파하는 자는 전적으로 책임져야 합니다. <br>이 조항을 인정하지 않으면 소프트웨어의 코드 및 파일을 사용하거나 인용할 수 없습니다. 루트 디렉터리의 <b>LICENSE</b>를 참조하십시오.",
|
||||
"0-前置数据集获取工具": "0-전방 데이터 세트 수집 도구",
|
||||
"0a-UVR5人声伴奏分离&去混响去延迟工具": "0a-UVR5 보컬 및 반주 분리 및 에코 및 지연 제거 도구",
|
||||
"是否开启UVR5-WebUI": "UVR5-WebUI를 여시겠습니까?",
|
||||
"UVR5进程输出信息": "UVR5 프로세스 출력 정보",
|
||||
"0b-语音切分工具": "0b-음성 분리 도구",
|
||||
".list标注文件的路径": ".list 주석 파일 경로",
|
||||
"GPT模型路径": "GPT 모델 경로",
|
||||
"SoVITS模型列表": "SoVITS 모델 목록",
|
||||
"填切割后音频所在目录!读取的音频文件完整路径=该目录-拼接-list文件里波形对应的文件名(不是全路径)。": "분리된 오디오가 있는 디렉터리를 입력하십시오! 읽은 오디오 파일의 전체 경로 = 해당 디렉터리-연결-목록 파일에 해당하는 원본 이름 (전체 경로가 아님).",
|
||||
"音频自动切分输入路径,可文件可文件夹": "오디오 자동 분리 입력 경로, 파일 또는 폴더 가능",
|
||||
"切分后的子音频的输出根目录": "분리된 하위 오디오의 출력 기본 디렉터리",
|
||||
"怎么切": "자르기 옵션",
|
||||
"不切": "자르지 않음",
|
||||
"凑四句一切": "네 문장의 세트를 완성하세요.",
|
||||
"按英文句号.切": "영어 문장으로 분리하기",
|
||||
"threshold:音量小于这个值视作静音的备选切割点": "임계 값: 이 값보다 작은 볼륨은 대체 분리 지점으로 간주됩니다.",
|
||||
"min_length:每段最小多长,如果第一段太短一直和后面段连起来直到超过这个值": "최소 길이: 각 세그먼트의 최소 길이. 첫 번째 세그먼트가 너무 짧으면 계속해서 뒷부분과 연결하여 이 값 이상이 될 때까지",
|
||||
"min_interval:最短切割间隔": "최소 분리 간격",
|
||||
"hop_size:怎么算音量曲线,越小精度越大计算量越高(不是精度越大效果越好)": "hop 크기: 볼륨 곡선을 계산하는 방법. 작을수록 정확도가 높아지지만 계산량이 높아집니다 (정확도가 높다고 효과가 좋아지지 않음)",
|
||||
"max_sil_kept:切完后静音最多留多长": "최대 유지되는 정적 길이 (분리 후)",
|
||||
"开启语音切割": "음성 분리 활성화",
|
||||
"终止语音切割": "음성 분리 종료",
|
||||
"max:归一化后最大值多少": "최대 값 (정규화 후)",
|
||||
"alpha_mix:混多少比例归一化后音频进来": "알파 믹스: 정규화된 오디오가 들어오는 비율",
|
||||
"切割使用的进程数": "사용되는 프로세스 수로 자르기",
|
||||
"语音切割进程输出信息": "음성 분리 프로세스 출력 정보",
|
||||
"0c-中文批量离线ASR工具": "0c-중국어 대량 오프라인 ASR 도구",
|
||||
"开启离线批量ASR": "오프라인 대량 ASR 활성화",
|
||||
"终止ASR进程": "ASR 프로세스 종료",
|
||||
"批量ASR(中文only)输入文件夹路径": "대량 ASR (중국어 전용) 입력 폴더 경로",
|
||||
"ASR进程输出信息": "ASR 프로세스 출력 정보",
|
||||
"0d-语音文本校对标注工具": "0d-음성 텍스트 교정 주석 도구",
|
||||
"是否开启打标WebUI": "웹 기반 주석 활성화 여부",
|
||||
"打标数据标注文件路径": "주석 데이터 주석 파일 경로",
|
||||
"打标工具进程输出信息": "주석 도구 프로세스 출력 정보",
|
||||
"1-GPT-SoVITS-TTS": "1-GPT-SoVITS-TTS",
|
||||
"*实验/模型名": "*실험/모델 이름",
|
||||
"显卡信息": "그래픽 카드 정보",
|
||||
"预训练的SoVITS-G模型路径": "사전 훈련된 SoVITS-G 모델 경로",
|
||||
"预训练的SoVITS-D模型路径": "사전 훈련된 SoVITS-D 모델 경로",
|
||||
"预训练的GPT模型路径": "사전 훈련된 GPT 모델 경로",
|
||||
"1A-训练集格式化工具": "1A-훈련 세트 형식 지정 도구",
|
||||
"输出logs/实验名目录下应有23456开头的文件和文件夹": "logs/실험 이름 디렉터리에는 23456으로 시작하는 파일과 폴더가 있어야 함",
|
||||
"*文本标注文件": "*텍스트 주석 파일",
|
||||
"*训练集音频文件目录": "*훈련 세트 오디오 파일 디렉터리",
|
||||
"训练集音频文件目录 拼接 list文件里波形对应的文件名。": "훈련 세트 오디오 파일 디렉터리 - 목록 파일에 해당하는 원형 이름 연결",
|
||||
"1Aa-文本内容": "1Aa-텍스트 내용",
|
||||
"GPU卡号以-分割,每个卡号一个进程": "GPU 카드 번호는 -로 구분되며 각 카드 번호에 하나의 프로세스가 있어야 함",
|
||||
"预训练的中文BERT模型路径": "사전 훈련된 중국어 BERT 모델 경로",
|
||||
"开启文本获取": "텍스트 추출 활성화",
|
||||
"终止文本获取进程": "텍스트 추출 프로세스 종료",
|
||||
"文本进程输出信息": "텍스트 프로세스 출력 정보",
|
||||
"1Ab-SSL自监督特征提取": "1Ab-SSL 자기 지도 특징 추출",
|
||||
"预训练的SSL模型路径": "사전 훈련된 SSL 모델 경로",
|
||||
"开启SSL提取": "SSL 추출 활성화",
|
||||
"终止SSL提取进程": "SSL 추출 프로세스 종료",
|
||||
"SSL进程输出信息": "SSL 프로세스 출력 정보",
|
||||
"1Ac-语义token提取": "1Ac-의미 토큰 추출",
|
||||
"开启语义token提取": "의미 토큰 추출 활성화",
|
||||
"终止语义token提取进程": "의미 토큰 추출 프로세스 종료",
|
||||
"语义token提取进程输出信息": "의미 토큰 추출 프로세스 출력 정보",
|
||||
"1Aabc-训练集格式化一键三连": "1Aabc-훈련 세트 형식 지정 일괄 처리",
|
||||
"开启一键三连": "일괄 처리 활성화",
|
||||
"终止一键三连": "일괄 처리 종료",
|
||||
"一键三连进程输出信息": "일괄 처리 프로세스 출력 정보",
|
||||
"1B-微调训练": "1B-미세 조정 훈련",
|
||||
"1Ba-SoVITS训练。用于分享的模型文件输出在SoVITS_weights下。": "1Ba-SoVITS 훈련. 공유 용 모델 파일은 SoVITS_weights 하위에 출력됩니다.",
|
||||
"每张显卡的batch_size": "각 그래픽 카드의 배치 크기",
|
||||
"总训练轮数total_epoch,不建议太高": "총 훈련 라운드 수 (total_epoch), 너무 높지 않게 권장됨",
|
||||
"文本模块学习率权重": "텍스트 모듈 학습률 가중치",
|
||||
"保存频率save_every_epoch": "저장 빈도 (각 라운드마다)",
|
||||
"是否仅保存最新的ckpt文件以节省硬盘空间": "디스크 공간을 절약하기 위해 최신 ckpt 파일만 저장할지 여부",
|
||||
"是否在每次保存时间点将最终小模型保存至weights文件夹": "각 저장 시간에 최종 작은 모델을 weights 폴더에 저장할지 여부",
|
||||
"开启SoVITS训练": "SoVITS 훈련 활성화",
|
||||
"终止SoVITS训练": "SoVITS 훈련 종료",
|
||||
"SoVITS训练进程输出信息": "SoVITS 훈련 프로세스 출력 정보",
|
||||
"1Bb-GPT训练。用于分享的模型文件输出在GPT_weights下。": "1Bb-GPT 훈련. 공유 용 모델 파일은 GPT_weights 하위에 출력됩니다.",
|
||||
"总训练轮数total_epoch": "총 훈련 라운드 수 (total_epoch)",
|
||||
"开启GPT训练": "GPT 훈련 활성화",
|
||||
"终止GPT训练": "GPT 훈련 종료",
|
||||
"GPT训练进程输出信息": "GPT 훈련 프로세스 출력 정보",
|
||||
"1C-推理": "1C-추론",
|
||||
"选择训练完存放在SoVITS_weights和GPT_weights下的模型。默认的一个是底模,体验5秒Zero Shot TTS用。": "SoVITS_weights 및 GPT_weights에 저장된 훈련 완료된 모델 중 선택. 기본적으로 하나는 기본 모델이며 5초 Zero Shot TTS를 체험할 수 있습니다.",
|
||||
"*GPT模型列表": "*GPT 모델 목록",
|
||||
"*SoVITS模型列表": "*SoVITS 모델 목록",
|
||||
"GPU卡号,只能填1个整数": "GPU 카드 번호, 1개의 정수만 입력 가능",
|
||||
"刷新模型路径": "모델 경로 새로 고침",
|
||||
"是否开启TTS推理WebUI": "TTS 추론 WebUI 활성화 여부",
|
||||
"TTS推理WebUI进程输出信息": "TTS 추론 WebUI 프로세스 출력 정보",
|
||||
"2-GPT-SoVITS-变声": "2-GPT-SoVITS-음성 변환",
|
||||
"施工中,请静候佳音": "공사 중입니다. 기다려주십시오.",
|
||||
"参考音频在3~10秒范围外,请更换!": "참고 오디오가 3~10초 범위를 벗어났습니다. 다른 것으로 바꾸십시오!",
|
||||
"请上传3~10秒内参考音频,超过会报错!": "3~10초 이내의 참고 오디오를 업로드하십시오. 초과하면 오류가 발생합니다!",
|
||||
"TTS推理进程已开启": "TTS 추론 프로세스가 열렸습니다",
|
||||
"TTS推理进程已关闭": "TTS 추론 프로세스가 닫혔습니다",
|
||||
"打标工具WebUI已开启": "주석 도구 WebUI가 열렸습니다",
|
||||
"打标工具WebUI已关闭": "주석 도구 WebUI가 닫혔습니다",
|
||||
"*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。": "*합성할 대상 텍스트를 입력하십시오. 중국어와 영어를 혼합하면 중국어를 선택하고 일본어와 영어를 혼합하면 일본어를 선택하십시오. 중국어와 일본어를 혼합하는 것은 아직 지원되지 않으며 대상 언어가 아닌 텍스트는 자동으로 버려집니다.",
|
||||
"*请填写需要合成的目标文本": "*합성할 대상 텍스트를 입력하십시오",
|
||||
"ASR任务开启:%s": "ASR 작업 시작: %s",
|
||||
"GPT训练完成": "GPT 훈련 완료",
|
||||
"GPT训练开始:%s": "GPT 훈련 시작: %s",
|
||||
"SSL提取进程执行中": "SSL 추출 프로세스 실행 중",
|
||||
"SSL提取进程结束": "SSL 추출 프로세스 종료",
|
||||
"SoVITS训练完成": "SoVITS 훈련 완료",
|
||||
"SoVITS训练开始:%s": "SoVITS 훈련 시작: %s",
|
||||
"一键三连中途报错": "일괄 처리 중 오류 발생",
|
||||
"一键三连进程结束": "일괄 처리 프로세스 종료",
|
||||
"中文": "중국어",
|
||||
"凑50字一切": "50자를 채우십시오",
|
||||
"凑五句一切": "다섯 문장을 채우십시오",
|
||||
"切分后文本": "분리된 텍스트",
|
||||
"切割执行中": "분리 진행 중",
|
||||
"切割结束": "분리 종료",
|
||||
"参考音频的文本": "참고 오디오의 텍스트",
|
||||
"参考音频的语种": "참고 오디오의 언어",
|
||||
"合成语音": "합성 음성",
|
||||
"后续将支持混合语种编码文本输入。": "향후 혼합 언어 코딩 텍스트 입력을 지원할 예정입니다.",
|
||||
"已有正在进行的ASR任务,需先终止才能开启下一次任务": "이미 진행 중인 ASR 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的GPT训练任务,需先终止才能开启下一次任务": "이미 진행 중인 GPT 훈련 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的SSL提取任务,需先终止才能开启下一次任务": "이미 진행 중인 SSL 추출 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的SoVITS训练任务,需先终止才能开启下一次任务": "이미 진행 중인 SoVITS 훈련 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的一键三连任务,需先终止才能开启下一次任务": "이미 진행 중인 일괄 처리 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的切割任务,需先终止才能开启下一次任务": "이미 진행 중인 분리 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的文本任务,需先终止才能开启下一次任务": "이미 진행 중인 텍스트 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已有正在进行的语义token提取任务,需先终止才能开启下一次任务": "이미 진행 중인 의미 토큰 추출 작업이 있습니다. 다음 작업을 시작하려면 먼저 종료하십시오.",
|
||||
"已终止ASR进程": "ASR 프로세스 종료됨",
|
||||
"已终止GPT训练": "GPT 훈련 종료됨",
|
||||
"已终止SoVITS训练": "SoVITS 훈련 종료됨",
|
||||
"已终止所有1a进程": "모든 1a 프로세스 종료됨",
|
||||
"已终止所有1b进程": "모든 1b 프로세스 종료됨",
|
||||
"已终止所有一键三连进程": "모든 일괄 처리 프로세스 종료됨",
|
||||
"已终止所有切割进程": "모든 분리 프로세스 종료됨",
|
||||
"已终止所有语义token进程": "모든 의미 토큰 프로세스 종료됨",
|
||||
"按中文句号。切": "중국어 문장으로 분리하십시오.",
|
||||
"文本切分工具。太长的文本合成出来效果不一定好,所以太长建议先切。合成会根据文本的换行分开合成再拼起来。": "텍스트 분리 도구. 너무 긴 텍스트는 합성 결과가 항상 좋지 않을 수 있으므로 너무 길면 먼저 분리하는 것이 좋습니다. 합성은 텍스트 줄 바꿈을 기준으로 분리되어 다시 조합됩니다.",
|
||||
"文本进程执行中": "텍스트 프로세스 실행 중",
|
||||
"文本进程结束": "텍스트 프로세스 종료",
|
||||
"日文": "일본어",
|
||||
"英文": "영어",
|
||||
"语义token提取进程执行中": "의미 토큰 추출 프로세스 실행 중",
|
||||
"语义token提取进程结束": "의미 토큰 추출 프로세스 종료",
|
||||
"请上传参考音频": "참고 오디오를 업로드하십시오",
|
||||
"输入路径不存在": "입력 경로가 존재하지 않습니다",
|
||||
"输入路径存在但既不是文件也不是文件夹": "입력 경로가 파일이나 폴더가 아닙니다",
|
||||
"输出的语音": "출력 음성",
|
||||
"进度:1a-done": "진행: 1a-done",
|
||||
"进度:1a-done, 1b-ing": "진행: 1a-done, 1b-ing",
|
||||
"进度:1a-ing": "진행: 1a-ing",
|
||||
"进度:1a1b-done": "진행: 1a1b-done",
|
||||
"进度:1a1b-done, 1cing": "진행: 1a1b-done, 1cing",
|
||||
"进度:all-done": "진행: all-done",
|
||||
"需要合成的切分前文本": "합성해야 할 분할 전 텍스트",
|
||||
"需要合成的文本": "합성해야 할 텍스트",
|
||||
"需要合成的语种": "합성해야 할 언어",
|
||||
">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音": ">=3이면 harvest 음고 인식 결과에 중앙값 필터를 사용하며, 값은 필터 반경이며 사용하면 소리를 약하게 할 수 있습니다",
|
||||
"A模型权重": "A 모델 가중치",
|
||||
"A模型路径": "A 모델 경로",
|
||||
"B模型路径": "B 모델 경로",
|
||||
"E:\\语音音频+标注\\米津玄师\\src": "E:\\음성 오디오 + 주석\\Miyuki Kenshi\\src",
|
||||
"F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调": "F0 곡선 파일, 선택 사항, 한 줄에 하나의 음고, 기본 F0 및 음조 대신 사용",
|
||||
"Index Rate": "인덱스 비율",
|
||||
"Onnx导出": "Onnx 내보내기",
|
||||
"Onnx输出路径": "Onnx 출력 경로",
|
||||
"RVC模型路径": "RVC 모델 경로",
|
||||
"ckpt处理": "ckpt 처리",
|
||||
"harvest进程数": "harvest 프로세스 수",
|
||||
"index文件路径不可包含中文": "인덱스 파일 경로에는 중국어를 포함할 수 없습니다",
|
||||
"pth文件路径不可包含中文": "pth 파일 경로에는 중국어를 포함할 수 없습니다",
|
||||
"rmvpe卡号配置:以-分隔输入使用的不同进程卡号,例如0-0-1使用在卡0上跑2个进程并在卡1上跑1个进程": "rmvpe 카드 번호 구성: 각 입력에 사용되는 다른 프로세스 카드를 -로 구분하여 입력하십시오. 예: 0-0-1은 카드 0에서 2개의 프로세스를 실행하고 카드 1에서 1개의 프로세스를 실행합니다",
|
||||
"step1: 填写实验配置. 实验数据放在logs下, 每个实验一个文件夹, 需手工输入实验名路径, 内含实验配置, 日志, 训练得到的模型文件. ": "step1: 실험 구성 입력. 실험 데이터는 logs 하위에 있으며 각 실험에 대한 폴더가 있어야합니다. 실험 이름 경로를 수동으로 입력해야하며 실험 구성, 로그, 훈련된 모델 파일이 포함되어 있습니다.",
|
||||
"step1:正在处理数据": "step1: 데이터 처리 중",
|
||||
"step2:正在提取音高&正在提取特征": "step2: 음고 추출 및 특징 추출 중",
|
||||
"step2a: 自动遍历训练文件夹下所有可解码成音频的文件并进行切片归一化, 在实验目录下生成2个wav文件夹; 暂时只支持单人训练. ": "step2a: 자동으로 훈련 폴더에서 오디오로 디코딩할 수 있는 모든 파일을 반복하고 슬라이스 정규화를 수행하여 실험 디렉토리에 2 개의 wav 폴더를 생성합니다. 현재 단일 훈련만 지원됩니다.",
|
||||
"step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)": "step2b: CPU로 음고 추출(모델이 음고를 지원하는 경우), GPU로 특징 추출(카드 번호 선택)",
|
||||
"step3: 填写训练设置, 开始训练模型和索引": "step3: 훈련 설정 입력, 모델 및 인덱스 훈련 시작",
|
||||
"step3a:正在训练模型": "step3a: 모델 훈련 중",
|
||||
"一键训练": "일괄 훈련",
|
||||
"也可批量输入音频文件, 二选一, 优先读文件夹": "오디오 파일을 일괄로 입력할 수도 있습니다. 둘 중 하나를 선택하고 폴더를 읽기를 우선합니다.",
|
||||
"以-分隔输入使用的卡号, 例如 0-1-2 使用卡0和卡1和卡2": "-로 구분하여 입력에 사용되는 카드 번호를 지정하십시오. 예 : 0-1-2는 카드 0, 1 및 2를 사용합니다",
|
||||
"伴奏人声分离&去混响&去回声": "반주 및 보컬 분리 & 리버브 제거 & 에코 제거",
|
||||
"使用模型采样率": "모델 샘플링 속도 사용",
|
||||
"使用设备采样率": "기기 샘플링 속도 사용",
|
||||
"保存名": "저장 이름",
|
||||
"保存的文件名, 默认空为和源文件同名": "저장할 파일 이름, 기본적으로 공백은 원본 파일과 동일한 이름입니다",
|
||||
"保存的模型名不带后缀": "저장할 모델 이름에는 확장자가 없습니다",
|
||||
"保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果": "클리어 자음 및 숨소를 보호하여 전자 음향 찢김과 같은 아티팩트를 방지하려면 0.5로 설정하되, 보호 강도를 높이려면 0.5로 당기지 않고 낮추면 인덱스 효과가 감소할 수 있습니다",
|
||||
"修改": "수정",
|
||||
"修改模型信息(仅支持weights文件夹下提取的小模型文件)": "모델 정보 수정 (weights 폴더에서 추출된 작은 모델 파일만 지원됨)",
|
||||
"停止音频转换": "오디오 변환 중지",
|
||||
"全流程结束!": "전체 프로세스 완료!",
|
||||
"刷新音色列表和索引路径": "음색 목록 및 인덱스 경로 새로 고침",
|
||||
"加载模型": "모델 로드",
|
||||
"加载预训练底模D路径": "사전 훈련된 기본 모델 D 경로 로드",
|
||||
"加载预训练底模G路径": "사전 훈련된 기본 모델 G 경로 로드",
|
||||
"单次推理": "단일 추론",
|
||||
"卸载音色省显存": "음색 언로드 및 GPU 메모리 절약",
|
||||
"变调(整数, 半音数量, 升八度12降八度-12)": "음높이 변경(정수, 반음 수, 올림 높이 12 내림 높이 -12)",
|
||||
"后处理重采样至最终采样率,0为不进行重采样": "후 처리를 통한 최종 샘플링률 재샘플링, 0은 재샘플링 미실행",
|
||||
"否": "아니오",
|
||||
"启用相位声码器": "페이즈 보코더 사용",
|
||||
"响应阈值": "응답 임계값",
|
||||
"响度因子": "음량 요소",
|
||||
"处理数据": "데이터 처리",
|
||||
"导出Onnx模型": "Onnx 모델 내보내기",
|
||||
"导出文件格式": "내보내기 파일 형식",
|
||||
"常见问题解答": "자주 묻는 질문 해결",
|
||||
"常规设置": "일반 설정",
|
||||
"开始音频转换": "오디오 변환 시작",
|
||||
"性能设置": "성능 설정",
|
||||
"批量推理": "일괄 추론",
|
||||
"批量转换, 输入待转换音频文件夹, 或上传多个音频文件, 在指定文件夹(默认opt)下输出转换的音频. ": "일괄 변환, 변환 대기 중인 오디오 폴더를 입력하거나 여러 오디오 파일을 업로드하고 지정된 폴더(opt 기본값)에 변환된 오디오를 출력합니다.",
|
||||
"指定输出主人声文件夹": "지정된 주인 목소리 출력 폴더",
|
||||
"指定输出文件夹": "지정된 출력 폴더",
|
||||
"指定输出非主人声文件夹": "지정된 비주인 목소리 출력 폴더",
|
||||
"推理时间(ms):": "추론 시간(ms):",
|
||||
"推理音色": "추론 음색",
|
||||
"提取": "추출",
|
||||
"提取音高和处理数据使用的CPU进程数": "음높이 추출 및 데이터 처리에 사용되는 CPU 프로세스 수 추출",
|
||||
"是": "예",
|
||||
"是否缓存所有训练集至显存. 10min以下小数据可缓存以加速训练, 大数据缓存会炸显存也加不了多少速": "모든 훈련 세트를 GPU 메모리에 캐시할지 여부. 10분 미만의 소량 데이터는 훈련 속도를 높이기 위해 캐시할 수 있지만, 대량 데이터를 캐시하면 메모리가 터지고 속도가 크게 향상되지 않을 수 있습니다.",
|
||||
"查看": "보기",
|
||||
"查看模型信息(仅支持weights文件夹下提取的小模型文件)": "모델 정보보기(작은 모델 파일로 추출된 weights 폴더에서만 지원)",
|
||||
"检索特征占比": "특징 비율 검색",
|
||||
"模型": "모델",
|
||||
"模型推理": "모델 추론",
|
||||
"模型提取(输入logs文件夹下大文件模型路径),适用于训一半不想训了模型没有自动提取保存小文件模型,或者想测试中间模型的情况": "모델 추출(로그 폴더에 대형 파일 모델 경로 입력), 반 훈련하고 싶지 않거나 모델이 자동으로 작은 파일 모델로 추출되지 않았거나 중간 모델을 테스트하려는 경우에 사용",
|
||||
"模型是否带音高指导": "모델에 음높이 안내가 있는지 여부",
|
||||
"模型是否带音高指导(唱歌一定要, 语音可以不要)": "모델에 음높이 안내가 있는지 여부(노래에는 필수, 음성은 선택 사항)",
|
||||
"模型是否带音高指导,1是0否": "모델에 음높이 안내가 있는지 여부, 1이면 있음 0이면 없음",
|
||||
"模型版本型号": "모델 버전 및 모델 번호",
|
||||
"模型融合, 可用于测试音色融合": "모델 통합, 음색 통합 테스트에 사용 가능",
|
||||
"模型路径": "모델 경로",
|
||||
"淡入淡出长度": "페이드 인/아웃 길이",
|
||||
"版本": "버전",
|
||||
"特征提取": "특성 추출",
|
||||
"特征检索库文件路径,为空则使用下拉的选择结果": "특성 검색 라이브러리 파일 경로, 비어 있으면 드롭다운 선택 결과 사용",
|
||||
"男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ": "남성을 여성으로 추천 +12키, 여성을 남성으로 추천 -12키, 음역 폭발로 음색이 왜곡되면 적절한 음역으로 직접 조절 가능",
|
||||
"目标采样率": "목표 샘플링률",
|
||||
"算法延迟(ms):": "알고리즘 지연 시간(ms):",
|
||||
"自动检测index路径,下拉式选择(dropdown)": "자동으로 index 경로 감지, 드롭다운 선택",
|
||||
"融合": "융합",
|
||||
"要改的模型信息": "수정할 모델 정보",
|
||||
"要置入的模型信息": "삽입할 모델 정보",
|
||||
"训练": "훈련",
|
||||
"训练模型": "모델 훈련",
|
||||
"训练特征索引": "특성 인덱스 훈련",
|
||||
"训练结束, 您可查看控制台训练日志或实验文件夹下的train.log": "훈련 종료, 콘솔 훈련 로그 또는 실험 폴더의 train.log를 확인할 수 있습니다",
|
||||
"请指定说话人id": "화자 ID 지정",
|
||||
"请选择index文件": "index 파일 선택",
|
||||
"请选择pth文件": "pth 파일 선택",
|
||||
"请选择说话人id": "화자 ID 선택",
|
||||
"转换": "변환",
|
||||
"输入实验名": "실험명 입력",
|
||||
"输入待处理音频文件夹路径": "처리 대기 중인 오디오 폴더 경로 입력",
|
||||
"输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)": "처리 대기 중인 오디오 폴더 경로 입력(파일 관리자 주소 표시 줄에서 복사하면 됨)",
|
||||
"输入待处理音频文件路径(默认是正确格式示例)": "처리 대기 중인 오디오 파일 경로 입력(기본적으로 올바른 형식의 예제)",
|
||||
"输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络": "소스 음량 에너벌롭을 입력하여 출력 음량 에너벌롭 합성 비율을 대체하면 1에 가까울수록 출력 에너벌롭 사용",
|
||||
"输入监听": "입력 모니터링",
|
||||
"输入训练文件夹路径": "훈련 폴더 경로 입력",
|
||||
"输入设备": "입력 장치",
|
||||
"输入降噪": "노이즈 감소 입력",
|
||||
"输出信息": "출력 정보",
|
||||
"输出变声": "음성 출력",
|
||||
"输出设备": "출력 장치",
|
||||
"输出降噪": "노이즈 감소 출력",
|
||||
"输出音频(右下角三个点,点了可以下载)": "출력 오디오(우하단 세 점, 클릭하면 다운로드 가능)",
|
||||
"选择.index文件": "index 파일 선택",
|
||||
"选择.pth文件": "pth 파일 선택",
|
||||
"选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU": "음높이 추출 알고리즘 선택, 노래 입력에 pm 사용 가능, harvest는 저음이 좋지만 매우 느림, crepe 효과는 좋지만 GPU 사용",
|
||||
"选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU,rmvpe效果最好且微吃GPU": "음높이 추출 알고리즘 선택, 노래 입력에 pm 사용 가능, harvest는 저음이 좋지만 매우 느림, crepe 효과는 좋지만 GPU 사용, rmvpe 효과가 가장 좋으며 약간의 GPU 사용",
|
||||
"选择音高提取算法:输入歌声可用pm提速,高质量语音但CPU差可用dio提速,harvest质量更好但慢,rmvpe效果最好且微吃CPU/GPU": "음높이 추출 알고리즘 선택: 노래 입력에 pm 사용 가능, 고품질 음성이지만 CPU가 낮음, dio 사용 가능, harvest 품질이 더 좋지만 느림, rmvpe 효과가 최고이며 CPU/GPU 약간 사용",
|
||||
"采样率:": "샘플링률:",
|
||||
"采样长度": "샘플링 길이",
|
||||
"重载设备列表": "장치 목록 다시로드",
|
||||
"音调设置": "음조 설정",
|
||||
"音频设备(请使用同种类驱动)": "오디오 장치(동일한 유형의 드라이버 사용 권장)",
|
||||
"音高算法": "음높이 알고리즘",
|
||||
"额外推理时长": "추가 추론 시간"
|
||||
}
|
@ -252,5 +252,5 @@ class MDXNetDereverb:
|
||||
self.pred = Predictor(self)
|
||||
self.device = cpu
|
||||
|
||||
def _path_audio_(self, input, vocal_root, others_root, format, is_hp3=False):
|
||||
def _path_audio_(self, input, others_root, vocal_root, format, is_hp3=False):
|
||||
self.pred.prediction(input, vocal_root, others_root, format)
|
||||
|
40
webui.py
40
webui.py
@ -117,6 +117,7 @@ def change_choices():
|
||||
p_label=None
|
||||
p_uvr5=None
|
||||
p_asr=None
|
||||
p_denoise=None
|
||||
p_tts_inference=None
|
||||
|
||||
def kill_proc_tree(pid, including_parent=True):
|
||||
@ -220,6 +221,29 @@ def close_asr():
|
||||
kill_process(p_asr.pid)
|
||||
p_asr=None
|
||||
return "已终止ASR进程",{"__type__":"update","visible":True},{"__type__":"update","visible":False}
|
||||
def open_denoise(denoise_inp_dir, denoise_opt_dir):
|
||||
global p_denoise
|
||||
if(p_denoise==None):
|
||||
denoise_inp_dir=my_utils.clean_path(denoise_inp_dir)
|
||||
denoise_opt_dir=my_utils.clean_path(denoise_opt_dir)
|
||||
cmd = '"%s" tools/cmd-denoise.py -i "%s" -o "%s" -p %s'%(python_exec,denoise_inp_dir,denoise_opt_dir,"float16"if is_half==True else "float32")
|
||||
|
||||
yield "语音降噪任务开启:%s"%cmd,{"__type__":"update","visible":False},{"__type__":"update","visible":True}
|
||||
print(cmd)
|
||||
p_denoise = Popen(cmd, shell=True)
|
||||
p_denoise.wait()
|
||||
p_denoise=None
|
||||
yield f"语音降噪任务完成, 查看终端进行下一步",{"__type__":"update","visible":True},{"__type__":"update","visible":False}
|
||||
else:
|
||||
yield "已有正在进行的语音降噪任务,需先终止才能开启下一次任务",{"__type__":"update","visible":False},{"__type__":"update","visible":True}
|
||||
# return None
|
||||
|
||||
def close_denoise():
|
||||
global p_denoise
|
||||
if(p_denoise!=None):
|
||||
kill_process(p_denoise.pid)
|
||||
p_denoise=None
|
||||
return "已终止语音降噪进程",{"__type__":"update","visible":True},{"__type__":"update","visible":False}
|
||||
|
||||
p_train_SoVITS=None
|
||||
def open1Ba(batch_size,total_epoch,exp_name,text_low_lr_rate,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers1Ba,pretrained_s2G,pretrained_s2D):
|
||||
@ -266,7 +290,7 @@ def close1Ba():
|
||||
return "已终止SoVITS训练",{"__type__":"update","visible":True},{"__type__":"update","visible":False}
|
||||
|
||||
p_train_GPT=None
|
||||
def open1Bb(batch_size,total_epoch,exp_name,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers,pretrained_s1):
|
||||
def open1Bb(batch_size,total_epoch,exp_name,if_dpo,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers,pretrained_s1):
|
||||
global p_train_GPT
|
||||
if(p_train_GPT==None):
|
||||
with open("GPT_SoVITS/configs/s1longer.yaml")as f:
|
||||
@ -283,6 +307,7 @@ def open1Bb(batch_size,total_epoch,exp_name,if_save_latest,if_save_every_weights
|
||||
data["train"]["save_every_n_epoch"]=save_every_epoch
|
||||
data["train"]["if_save_every_weights"]=if_save_every_weights
|
||||
data["train"]["if_save_latest"]=if_save_latest
|
||||
data["train"]["if_dpo"]=if_dpo
|
||||
data["train"]["half_weights_save_dir"]=GPT_weight_root
|
||||
data["train"]["exp_name"]=exp_name
|
||||
data["train_semantic_path"]="%s/6-name2semantic.tsv"%s1_dir
|
||||
@ -677,6 +702,13 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
alpha=gr.Slider(minimum=0,maximum=1,step=0.05,label=i18n("alpha_mix:混多少比例归一化后音频进来"),value=0.25,interactive=True)
|
||||
n_process=gr.Slider(minimum=1,maximum=n_cpu,step=1,label=i18n("切割使用的进程数"),value=4,interactive=True)
|
||||
slicer_info = gr.Textbox(label=i18n("语音切割进程输出信息"))
|
||||
gr.Markdown(value=i18n("0bb-语音降噪工具"))
|
||||
with gr.Row():
|
||||
open_denoise_button = gr.Button(i18n("开启语音降噪"), variant="primary",visible=True)
|
||||
close_denoise_button = gr.Button(i18n("终止语音降噪进程"), variant="primary",visible=False)
|
||||
denoise_input_dir=gr.Textbox(label=i18n("降噪音频文件输入文件夹"),value="")
|
||||
denoise_output_dir=gr.Textbox(label=i18n("降噪结果输出文件夹"),value="output/denoise_opt")
|
||||
denoise_info = gr.Textbox(label=i18n("语音降噪进程输出信息"))
|
||||
gr.Markdown(value=i18n("0c-中文批量离线ASR工具"))
|
||||
with gr.Row():
|
||||
open_asr_button = gr.Button(i18n("开启离线批量ASR"), variant="primary",visible=True)
|
||||
@ -739,6 +771,9 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
close_asr_button.click(close_asr, [], [asr_info,open_asr_button,close_asr_button])
|
||||
open_slicer_button.click(open_slice, [slice_inp_path,slice_opt_root,threshold,min_length,min_interval,hop_size,max_sil_kept,_max,alpha,n_process], [slicer_info,open_slicer_button,close_slicer_button])
|
||||
close_slicer_button.click(close_slice, [], [slicer_info,open_slicer_button,close_slicer_button])
|
||||
open_denoise_button.click(open_denoise, [denoise_input_dir,denoise_output_dir], [denoise_info,open_denoise_button,close_denoise_button])
|
||||
close_denoise_button.click(close_denoise, [], [denoise_info,open_denoise_button,close_denoise_button])
|
||||
|
||||
with gr.TabItem(i18n("1-GPT-SoVITS-TTS")):
|
||||
with gr.Row():
|
||||
exp_name = gr.Textbox(label=i18n("*实验/模型名"), value="xxx", interactive=True)
|
||||
@ -807,6 +842,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
with gr.Row():
|
||||
batch_size1Bb = gr.Slider(minimum=1,maximum=40,step=1,label=i18n("每张显卡的batch_size"),value=default_batch_size,interactive=True)
|
||||
total_epoch1Bb = gr.Slider(minimum=2,maximum=50,step=1,label=i18n("总训练轮数total_epoch"),value=15,interactive=True)
|
||||
if_dpo = gr.Checkbox(label=i18n("是否开启dpo训练选项(实验性)"), value=False, interactive=True, show_label=True)
|
||||
if_save_latest1Bb = gr.Checkbox(label=i18n("是否仅保存最新的ckpt文件以节省硬盘空间"), value=True, interactive=True, show_label=True)
|
||||
if_save_every_weights1Bb = gr.Checkbox(label=i18n("是否在每次保存时间点将最终小模型保存至weights文件夹"), value=True, interactive=True, show_label=True)
|
||||
save_every_epoch1Bb = gr.Slider(minimum=1,maximum=50,step=1,label=i18n("保存频率save_every_epoch"),value=5,interactive=True)
|
||||
@ -817,7 +853,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
||||
info1Bb=gr.Textbox(label=i18n("GPT训练进程输出信息"))
|
||||
button1Ba_open.click(open1Ba, [batch_size,total_epoch,exp_name,text_low_lr_rate,if_save_latest,if_save_every_weights,save_every_epoch,gpu_numbers1Ba,pretrained_s2G,pretrained_s2D], [info1Ba,button1Ba_open,button1Ba_close])
|
||||
button1Ba_close.click(close1Ba, [], [info1Ba,button1Ba_open,button1Ba_close])
|
||||
button1Bb_open.click(open1Bb, [batch_size1Bb,total_epoch1Bb,exp_name,if_save_latest1Bb,if_save_every_weights1Bb,save_every_epoch1Bb,gpu_numbers1Bb,pretrained_s1], [info1Bb,button1Bb_open,button1Bb_close])
|
||||
button1Bb_open.click(open1Bb, [batch_size1Bb,total_epoch1Bb,exp_name,if_dpo,if_save_latest1Bb,if_save_every_weights1Bb,save_every_epoch1Bb,gpu_numbers1Bb,pretrained_s1], [info1Bb,button1Bb_open,button1Bb_close])
|
||||
button1Bb_close.click(close1Bb, [], [info1Bb,button1Bb_open,button1Bb_close])
|
||||
with gr.TabItem(i18n("1C-推理")):
|
||||
gr.Markdown(value=i18n("选择训练完存放在SoVITS_weights和GPT_weights下的模型。默认的一个是底模,体验5秒Zero Shot TTS用。"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user