diff --git a/app.py b/app.py index 92c2e13..f9ceb5e 100644 --- a/app.py +++ b/app.py @@ -19,6 +19,7 @@ from common.constants import ( DEFAULT_SPLIT_INTERVAL, DEFAULT_STYLE, DEFAULT_STYLE_WEIGHT, + GRADIO_THEME, LATEST_VERSION, Languages, ) @@ -284,7 +285,7 @@ if __name__ == "__main__": initial_id = 0 initial_pth_files = model_holder.model_files_dict[model_names[initial_id]] - with gr.Blocks(theme="NoCrypt/miku") as app: + with gr.Blocks(theme=GRADIO_THEME) as app: gr.Markdown(initial_md) with gr.Accordion(label="使い方", open=False): gr.Markdown(how_to_md) diff --git a/common/constants.py b/common/constants.py index ce40958..d2d6352 100644 --- a/common/constants.py +++ b/common/constants.py @@ -1,6 +1,10 @@ import enum -LATEST_VERSION: str = "2.1.1" +# Built-in theme: "default", "base", "monochrome", "soft", "glass" +# See https://huggingface.co/spaces/gradio/theme-gallery for more themes +GRADIO_THEME: str = "NoCrypt/miku" + +LATEST_VERSION: str = "2.2" DEFAULT_STYLE: str = "Neutral" DEFAULT_STYLE_WEIGHT: float = 5.0 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 79a29a5..b73d36d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,8 +7,10 @@ - バッチサイズのデフォルトを4から2に変更。学習が遅い場合はバッチサイズを下げて試してみて、VRAMに余裕があれば上げてください。バッチサイズごとのVRAM使用量目安は、1: 6GB, 2: 8GB, 3: 10GB, 4: 12GB くらいのようです。 - 学習の際の検証データ数をデフォルトで0に変更し、また検証データ数を学習用WebUIで指定できるようにした - Tensorboardのログ間隔を学習用WebUIで指定できるようにした +- UIのテーマを`common/constants.py`の`GRADIO_THEME`で指定できるようにした ### バグ修正等 +- JP-Extra使用時にバッチサイズが1だと学習中にエラーが発生するバグを修正 - 「こんにちは!?!?!?!?」等、感嘆符等の記号が連続すると学習・音声合成でエラーになるバグを修正 - `—` (em dash, U+2014) や `―` (quotation dash, U+2015) 等のダッシュやハイフンの各種変種が、種類によって「-」に正規化されたりされていなかったりする処理を、全て「-」に正規化するように修正 diff --git a/webui_dataset.py b/webui_dataset.py index 5b25afe..2885e27 100644 --- a/webui_dataset.py +++ b/webui_dataset.py @@ -4,6 +4,7 @@ import os import gradio as gr import yaml +from common.constants import GRADIO_THEME from common.log import logger from common.subprocess_utils import run_script_with_log @@ -115,7 +116,7 @@ Style-Bert-VITS2の学習用データセットを作成するためのツール - 手動で書き起こしをいろいろ修正したり結果を細かく確認したい場合は、[Aivis Dataset](https://github.com/litagin02/Aivis-Dataset)もおすすめします。書き起こし部分もかなり工夫されています。ですがファイル数が多い場合などは、このツールで簡易的に切り出してデータセットを作るだけでも十分という気もしています。 """ -with gr.Blocks(theme="NoCrypt/miku") as app: +with gr.Blocks(theme=GRADIO_THEME) as app: gr.Markdown(initial_md) model_name = gr.Textbox( label="モデル名を入力してください(話者名としても使われます)。" diff --git a/webui_merge.py b/webui_merge.py index 96fc366..7d11862 100644 --- a/webui_merge.py +++ b/webui_merge.py @@ -10,7 +10,7 @@ import yaml from safetensors import safe_open from safetensors.torch import save_file -from common.constants import DEFAULT_STYLE +from common.constants import DEFAULT_STYLE, GRADIO_THEME from common.log import logger from common.tts_model import Model, ModelHolder @@ -171,6 +171,8 @@ def merge_models_gr( speech_style_weight, tempo_weight, ): + if output_name == "": + return "Error: 新しいモデル名を入力してください。" merged_model_path = merge_models( model_path_a, model_path_b, @@ -190,6 +192,8 @@ def merge_style_gr( output_name, style_triple_list_str: str, ): + if output_name == "": + return "Error: 新しいモデル名を入力してください。", None style_triple_list = [] for line in style_triple_list_str.split("\n"): if not line: @@ -295,7 +299,7 @@ if len(model_names) == 0: initial_id = 0 initial_model_files = model_holder.model_files_dict[model_names[initial_id]] -with gr.Blocks(theme="NoCrypt/miku") as app: +with gr.Blocks(theme=GRADIO_THEME) as app: gr.Markdown(initial_md) with gr.Accordion(label="使い方", open=False): gr.Markdown(initial_md) diff --git a/webui_style_vectors.py b/webui_style_vectors.py index d99c3ce..b89c9c9 100644 --- a/webui_style_vectors.py +++ b/webui_style_vectors.py @@ -12,7 +12,7 @@ from sklearn.cluster import DBSCAN, AgglomerativeClustering, KMeans from sklearn.manifold import TSNE from umap import UMAP -from common.constants import DEFAULT_STYLE +from common.constants import DEFAULT_STYLE, GRADIO_THEME from common.log import logger from config import config @@ -209,9 +209,7 @@ def save_style_vectors_from_clustering(model_name, style_names_str: str): style_names = [name.strip() for name in style_names_str.split(",")] style_name_list = [DEFAULT_STYLE] + style_names if len(style_name_list) != len(centroids) + 1: - return ( - f"スタイルの数が合いません。`,`で正しく{len(centroids)}個に区切られているか確認してください: {style_names_str}" - ) + return f"スタイルの数が合いません。`,`で正しく{len(centroids)}個に区切られているか確認してください: {style_names_str}" if len(set(style_names)) != len(style_names): return f"スタイル名が重複しています。" @@ -325,7 +323,7 @@ UMAPの場合はepsは0.3くらい、t-SNEの場合は2.5くらいがいいか https://ja.wikipedia.org/wiki/DBSCAN """ -with gr.Blocks(theme="NoCrypt/miku") as app: +with gr.Blocks(theme=GRADIO_THEME) as app: gr.Markdown(initial_md) with gr.Row(): model_name = gr.Textbox(placeholder="your_model_name", label="モデル名") @@ -380,7 +378,9 @@ with gr.Blocks(theme="NoCrypt/miku") as app: dbscan_button = gr.Button("スタイル分けを実行") num_styles_result = gr.Textbox(label="スタイル数") gr.Markdown("スタイル分けの結果") - gr.Markdown("注意: もともと256次元なものをを2次元に落としているので、正確なベクトルの位置関係ではありません。") + gr.Markdown( + "注意: もともと256次元なものをを2次元に落としているので、正確なベクトルの位置関係ではありません。" + ) with gr.Row(): gr_plot = gr.Plot() with gr.Column(): @@ -436,7 +436,9 @@ with gr.Blocks(theme="NoCrypt/miku") as app: outputs=[info2], ) with gr.Tab("方法2: 手動でスタイルを選ぶ"): - gr.Markdown("下のテキスト欄に、各スタイルの代表音声のファイル名を`,`区切りで、その横に対応するスタイル名を`,`区切りで入力してください。") + gr.Markdown( + "下のテキスト欄に、各スタイルの代表音声のファイル名を`,`区切りで、その横に対応するスタイル名を`,`区切りで入力してください。" + ) gr.Markdown("例: `angry.wav, sad.wav, happy.wav`と`Angry, Sad, Happy`") gr.Markdown( f"注意: {DEFAULT_STYLE}スタイルは自動的に保存されます、手動では{DEFAULT_STYLE}という名前のスタイルは指定しないでください。" diff --git a/webui_train.py b/webui_train.py index ddae8f4..670d5df 100644 --- a/webui_train.py +++ b/webui_train.py @@ -2,8 +2,8 @@ import argparse import json import os import shutil -import subprocess import socket +import subprocess import sys import time import webbrowser @@ -13,7 +13,7 @@ from multiprocessing import cpu_count import gradio as gr import yaml -from common.constants import LATEST_VERSION +from common.constants import GRADIO_THEME, LATEST_VERSION from common.log import logger from common.stdout_wrapper import SAFE_STDOUT from common.subprocess_utils import run_script_with_log, second_elem_of @@ -421,7 +421,7 @@ english_teacher.wav|Mary|EN|How are you? I'm fine, thank you, and you? """ if __name__ == "__main__": - with gr.Blocks(theme="NoCrypt/miku").queue() as app: + with gr.Blocks(theme=GRADIO_THEME).queue() as app: gr.Markdown(initial_md) with gr.Accordion(label="データの前準備", open=False): gr.Markdown(prepare_md) @@ -435,7 +435,7 @@ if __name__ == "__main__": ) batch_size = gr.Slider( label="バッチサイズ", - info="速度が異様に遅い場合は小さく、VRAMに余裕があれば大きくしてください。使用量目安: 1: 6GB, 2: 8GB, 3: 10GB, 4: 12GB", + info="学習速度が遅い場合は小さくして試し、VRAMに余裕があれば大きくしてください。JP-Extra版でのVRAM使用量目安: 1: 6GB, 2: 8GB, 3: 10GB, 4: 12GB", value=2, minimum=1, maximum=64, @@ -516,7 +516,7 @@ if __name__ == "__main__": gr.Markdown(value="#### Step 1: 設定ファイルの生成") use_jp_extra_manual = gr.Checkbox( label="JP-Extra版を使う", - value=False, + value=True, ) batch_size_manual = gr.Slider( label="バッチサイズ",