This commit is contained in:
litagin02
2023-12-30 00:46:33 +09:00
parent 82ef037b91
commit 939cf3ec05
5 changed files with 32 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ call Style-Bert-VITS2\scripts\Setup-Python.bat ..\..\lib\python ..\venv
if %errorlevel% neq 0 ( popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( popd & exit /b %errorlevel% )
@REM 依存関係インストール @REM 依存関係インストール
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
pip install -r Style-Bert-VITS2\requirements.txt pip install -r Style-Bert-VITS2\requirements.txt
@@ -60,7 +60,6 @@ python initialize.py
echo ---------------------------------------- echo ----------------------------------------
echo モデルのダウンロードが完了し、インストールが完了しました! echo モデルのダウンロードが完了し、インストールが完了しました!
echo 音声合成のWebUIを起動します。 echo 音声合成のWebUIを起動します。
echo いつでもこのウィンドウを閉じて終了できます。
echo ---------------------------------------- echo ----------------------------------------
@REM 音声合成WebUIの起動 @REM 音声合成WebUIの起動

View File

@@ -24,7 +24,7 @@ del Style-Bert-VITS2.zip
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )
@REM Bert-VITS2-masterの中身をStyle-Bert-VITS2に上書き移動 @REM Bert-VITS2-masterの中身をStyle-Bert-VITS2に上書き移動
xcopy /QSY .\Style-Bert-VITS2-master .\Style-Bert-VITS2 xcopy /QSY .\Style-Bert-VITS2-master\ .\Style-Bert-VITS2\
rmdir /s /q Style-Bert-VITS2-master rmdir /s /q Style-Bert-VITS2-master
if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% )

View File

@@ -659,8 +659,8 @@ def train_and_evaluate(
global_step += 1 global_step += 1
# 本家ではこれをスピードアップのために消すと書かれていたので、一応消してみる # 本家ではこれをスピードアップのために消すと書かれていたので、一応消してみる
# gc.collect() gc.collect()
# torch.cuda.empty_cache() torch.cuda.empty_cache()
if rank == 0: if rank == 0:
logger.info(f"====> Epoch: {epoch}, step: {global_step}") logger.info(f"====> Epoch: {epoch}, step: {global_step}")

View File

@@ -348,7 +348,7 @@ def clean_checkpoints(path_to_models="logs/44k/", n_ckpts_to_keep=2, sort_by_tim
] ]
def del_info(fn): def del_info(fn):
return logger.info(f".. Free up space by deleting ckpt {fn}") return logger.info(f"Free up space by deleting ckpt {fn}")
def del_routine(x): def del_routine(x):
return [os.remove(x), del_info(x)] return [os.remove(x), del_info(x)]

View File

@@ -62,7 +62,7 @@ def initialize(model_name, batch_size, epochs, save_every_steps, bf16_run):
return True, "Step 1, Success: 初期設定が完了しました" return True, "Step 1, Success: 初期設定が完了しました"
def resample(model_name, normalize, num_processes): def resample(model_name, normalize, trim, num_processes):
logger.info("Step 2: start resampling...") logger.info("Step 2: start resampling...")
dataset_path, _, _, _, _ = get_path(model_name) dataset_path, _, _, _, _ = get_path(model_name)
in_dir = os.path.join(dataset_path, "raw") in_dir = os.path.join(dataset_path, "raw")
@@ -80,6 +80,8 @@ def resample(model_name, normalize, num_processes):
] ]
if normalize: if normalize:
cmd.append("--normalize") cmd.append("--normalize")
if trim:
cmd.append("--trim")
success, message = run_script_with_log(cmd) success, message = run_script_with_log(cmd)
if not success: if not success:
logger.error(f"Step 2: resampling failed.") logger.error(f"Step 2: resampling failed.")
@@ -174,7 +176,14 @@ def style_gen(model_name, num_processes):
def preprocess_all( def preprocess_all(
model_name, batch_size, epochs, save_every_steps, bf16_run, num_processes, normalize model_name,
batch_size,
epochs,
save_every_steps,
bf16_run,
num_processes,
normalize,
trim,
): ):
if model_name == "": if model_name == "":
return False, "Error: モデル名を入力してください" return False, "Error: モデル名を入力してください"
@@ -183,7 +192,7 @@ def preprocess_all(
) )
if not success: if not success:
return False, message return False, message
success, message = resample(model_name, normalize, num_processes) success, message = resample(model_name, normalize, trim, num_processes)
if not success: if not success:
return False, message return False, message
success, message = preprocess_text(model_name) success, message = preprocess_text(model_name)
@@ -313,6 +322,10 @@ if __name__ == "__main__":
label="音声の音量を正規化する", label="音声の音量を正規化する",
value=True, value=True,
) )
trim = gr.Checkbox(
label="音声の最初と最後の無音を取り除く",
value=True,
)
with gr.Column(): with gr.Column():
preprocess_button = gr.Button(value="自動前処理を実行", variant="primary") preprocess_button = gr.Button(value="自動前処理を実行", variant="primary")
info_all = gr.Textbox(label="状況") info_all = gr.Textbox(label="状況")
@@ -362,6 +375,10 @@ if __name__ == "__main__":
label="音声の音量を正規化する", label="音声の音量を正規化する",
value=True, value=True,
) )
trim_resample = gr.Checkbox(
label="音声の最初と最後の無音を取り除く",
value=True,
)
with gr.Column(): with gr.Column():
resample_btn = gr.Button(value="実行", variant="primary") resample_btn = gr.Button(value="実行", variant="primary")
info_resample = gr.Textbox(label="状況") info_resample = gr.Textbox(label="状況")
@@ -413,6 +430,7 @@ if __name__ == "__main__":
bf16_run, bf16_run,
num_processes, num_processes,
normalize, normalize,
trim,
], ],
outputs=[info_all], outputs=[info_all],
) )
@@ -429,7 +447,12 @@ if __name__ == "__main__":
) )
resample_btn.click( resample_btn.click(
second_elem_of(resample), second_elem_of(resample),
inputs=[model_name, normalize_resample, num_processes_resample], inputs=[
model_name,
normalize_resample,
trim_resample,
num_processes_resample,
],
outputs=[info_resample], outputs=[info_resample],
) )
preprocess_text_btn.click( preprocess_text_btn.click(