Dev 2.3. (#242)
* Fix inputs of duration discriminator * Add LSTM * Update models.py * Update tensorboard scalar * Noise injection for minimizing modality gap * Update infer.py * support bf16 run * del unused_para flag * support bf16 config * add grad clip * fix(logger and grad):add dur grad,fix grad clip * Update webui_preprocess.py * Fix English G2P * fix(bert_gen):add pass * Pass SDP to DD * Update webui_preprocess.py * Update config.json * Update webui.py * Update chinese_bert.py * Upload webui for deploy * Update webui.py * torch.save as pt not npy * Update config.json * add freeze emo vq * Update webui_preprocess.py * Fix tone_sandhi.py * Comment up grad clip * Fix in-place addition * Add SLM discriminator * Add DDP for WD * Feat: Style text: make emotions and style similar to the style text by mixing bert (#240) (#241) * fix:(oldVersion210) Load on demand Emotion model * feat: update fastapi.py. 添加更多错误日志信息 * Switch pyopenjtalk to pyopenjtalk-prebuilt * fix: update fastapi.py. 2.2 reference适配 * Update resample.py * 修复Onnx导出的BUG (#237) * Add files via upload * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add files via upload * Add files via upload * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Delete attentions_onnx.py * Delete models_onnx.py * Add files via upload * Add files via upload * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update __init__.py * Update __init__.py * Update __init__.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- * Fix onnx * Format export * Feat: style-text and bert mixing (JA only) * Ensure the same tensor shape * Update * update gradio version * Fix * Style text for chinese and english (ver 2.2) * Style text for chinese and english (ver 2.1) * Style text in FastAPI * Translate style text desc in chinese --------- Co-authored-by: litagin02 <139731664+litagin02@users.noreply.github.com> Co-authored-by: Sora <654163754@qq.com> Co-authored-by: Sihan Wang <wangsihan1995@gmail.com> Co-authored-by: Ναρουσέ·μ·γιουμεμί·Χινακάννα <40709280+NaruseMioShirakana@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Remove CLAP * Revert "Remove CLAP" This reverts commit 62fd59bc837c580239840a2bc84b15e0663730fc. Revert * Remove CLAP * bf16 audo grad cilp * Update webui and infer utils * Update webui.py * Update webui.py * Update webui-preprocess.py * Update webui_preprocess.py --------- Co-authored-by: Sihan Wang <wangsihan1995@gmail.com> Co-authored-by: OedoSoldier <31711261+OedoSoldier@users.noreply.github.com> Co-authored-by: litagin02 <139731664+litagin02@users.noreply.github.com> Co-authored-by: Sora <654163754@qq.com> Co-authored-by: Ναρουσέ·μ·γιουμεμί·Χινακάννα <40709280+NaruseMioShirakana@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -19,9 +19,9 @@ def generate_config(data_dir, batch_size):
|
||||
assert data_dir != "", "数据集名称不能为空"
|
||||
start_path, _, train_path, val_path, config_path = get_path(data_dir)
|
||||
if os.path.isfile(config_path):
|
||||
config = json.load(open(config_path))
|
||||
config = json.load(open(config_path, "r", encoding="utf-8"))
|
||||
else:
|
||||
config = json.load(open("configs/config.json"))
|
||||
config = json.load(open("configs/config.json", "r", encoding="utf-8"))
|
||||
config["data"]["training_files"] = train_path
|
||||
config["data"]["validation_files"] = val_path
|
||||
config["train"]["batch_size"] = batch_size
|
||||
@@ -44,7 +44,7 @@ def resample(data_dir):
|
||||
in_dir = os.path.join(start_path, "raw")
|
||||
out_dir = os.path.join(start_path, "wavs")
|
||||
subprocess.run(
|
||||
f"python resample.py "
|
||||
f"python resample_legacy.py "
|
||||
f"--sr 44100 "
|
||||
f"--in_dir {in_dir} "
|
||||
f"--out_dir {out_dir} ",
|
||||
@@ -60,7 +60,9 @@ def preprocess_text(data_dir):
|
||||
with open(lbl_path, "w", encoding="utf-8") as f:
|
||||
for line in lines:
|
||||
path, spk, language, text = line.strip().split("|")
|
||||
path = os.path.join(start_path, "wavs", os.path.basename(path))
|
||||
path = os.path.join(start_path, "wavs", os.path.basename(path)).replace(
|
||||
"\\", "/"
|
||||
)
|
||||
f.writelines(f"{path}|{spk}|{language}|{text}\n")
|
||||
subprocess.run(
|
||||
f"python preprocess_text.py "
|
||||
@@ -83,16 +85,6 @@ def bert_gen(data_dir):
|
||||
return "BERT 特征文件生成完成"
|
||||
|
||||
|
||||
def clap_gen(data_dir):
|
||||
assert data_dir != "", "数据集名称不能为空"
|
||||
_, _, _, _, config_path = get_path(data_dir)
|
||||
subprocess.run(
|
||||
f"python clap_gen.py " f"--config {config_path}",
|
||||
shell=True,
|
||||
)
|
||||
return "CLAP 特征文件生成完成"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with gr.Blocks() as app:
|
||||
with gr.Row():
|
||||
@@ -104,9 +96,9 @@ if __name__ == "__main__":
|
||||
"- [中文 RoBERTa](https://huggingface.co/hfl/chinese-roberta-wwm-ext-large)\n"
|
||||
"- [日文 DeBERTa](https://huggingface.co/ku-nlp/deberta-v2-large-japanese-char-wwm)\n"
|
||||
"- [英文 DeBERTa](https://huggingface.co/microsoft/deberta-v3-large)\n"
|
||||
"- [CLAP](https://huggingface.co/laion/clap-htsat-fused)\n"
|
||||
"- [WavLM](https://huggingface.co/microsoft/wavlm-base-plus)\n"
|
||||
"\n"
|
||||
"将 BERT 模型放置到 `bert` 文件夹下,CLAP 模型放置到 `emotional` 文件夹下,覆盖同名文件夹。\n"
|
||||
"将 BERT 模型放置到 `bert` 文件夹下,WavLM 模型放置到 `slm` 文件夹下,覆盖同名文件夹。\n"
|
||||
"\n"
|
||||
"数据准备:\n"
|
||||
"将数据放置在 data 文件夹下,按照如下结构组织:\n"
|
||||
@@ -156,12 +148,10 @@ if __name__ == "__main__":
|
||||
preprocess_text_btn = gr.Button(value="执行", variant="primary")
|
||||
_ = gr.Markdown(value="## 第四步:生成 BERT 特征文件")
|
||||
bert_gen_btn = gr.Button(value="执行", variant="primary")
|
||||
_ = gr.Markdown(value="## 第五步:生成 CLAP 特征文件")
|
||||
clap_gen_btn = gr.Button(value="执行", variant="primary")
|
||||
_ = gr.Markdown(
|
||||
value="## 训练模型及部署:\n"
|
||||
"修改根目录下的 `config.yml` 中 `dataset_path` 一项为 `data/{你的数据集名称}`\n"
|
||||
"- 训练:将[预训练模型文件](https://openi.pcl.ac.cn/Stardust_minus/Bert-VITS2/modelmanage/show_model)(`D_0.pth`、`DUR_0.pth` 和 `G_0.pth`)放到 `data/{你的数据集名称}/models` 文件夹下,执行 `torchrun --nproc_per_node=1 train_ms.py` 命令(多卡运行可参考 `run_MnodesAndMgpus.sh` 中的命令。\n"
|
||||
"- 训练:将[预训练模型文件](https://openi.pcl.ac.cn/Stardust_minus/Bert-VITS2/modelmanage/show_model)(`D_0.pth`、`DUR_0.pth`、`WD_0.pth` 和 `G_0.pth`)放到 `data/{你的数据集名称}/models` 文件夹下,执行 `torchrun --nproc_per_node=1 train_ms.py` 命令(多卡运行可参考 `run_MnodesAndMgpus.sh` 中的命令。\n"
|
||||
"- 部署:修改根目录下的 `config.yml` 中 `webui` 下 `model` 一项为 `models/{权重文件名}.pth` (如 G_10000.pth),然后执行 `python webui.py`"
|
||||
)
|
||||
|
||||
@@ -171,7 +161,6 @@ if __name__ == "__main__":
|
||||
resample_btn.click(resample, inputs=[data_dir], outputs=[info])
|
||||
preprocess_text_btn.click(preprocess_text, inputs=[data_dir], outputs=[info])
|
||||
bert_gen_btn.click(bert_gen, inputs=[data_dir], outputs=[info])
|
||||
clap_gen_btn.click(clap_gen, inputs=[data_dir], outputs=[info])
|
||||
|
||||
webbrowser.open("http://127.0.0.1:7860")
|
||||
app.launch(share=False, server_port=7860)
|
||||
|
||||
Reference in New Issue
Block a user