diff --git a/Dockerfile.deploy b/Dockerfile.deploy index f6cab39..dd351d1 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -19,4 +19,5 @@ COPY --chown=user . $HOME/app RUN pip install --no-cache-dir -r $HOME/app/requirements.txt -CMD ["python", "server_editor.py"] +# 必要に応じて制限を変更してください +CMD ["python", "server_editor.py", "--line_length", "50", "--line_count", "3"] diff --git a/Editor.bat b/Editor.bat new file mode 100644 index 0000000..7b0836c --- /dev/null +++ b/Editor.bat @@ -0,0 +1,11 @@ +chcp 65001 > NUL +@echo off + +pushd %~dp0 +echo Running server_editor.py --inbroser +venv\Scripts\python server_editor.py --inbrowser + +if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) + +popd +pause \ No newline at end of file diff --git a/common/constants.py b/common/constants.py index 5fe2e0a..751d5e1 100644 --- a/common/constants.py +++ b/common/constants.py @@ -6,8 +6,7 @@ GRADIO_THEME: str = "NoCrypt/miku" LATEST_VERSION: str = "2.3" -USER_DICT_CSV_PATH: str = "dict/user_dict.csv" -USER_DICT_PATH: str = "dict/user.dic" +USER_DICT_DIR = "dict_data" DEFAULT_STYLE: str = "Neutral" DEFAULT_STYLE_WEIGHT: float = 5.0 diff --git a/docs/paperspace.md b/docs/paperspace.md index 924d3b3..b77ef57 100644 --- a/docs/paperspace.md +++ b/docs/paperspace.md @@ -58,9 +58,9 @@ python slice.py --model_name Foo -i /notebooks/inputs python transcribe.py --model_name Foo ``` -それが終わったら、以下のコマンドで一括前処理を行う(パラメータは各自お好み、バッチサイズ6でVRAM 16GBギリくらい)。 +それが終わったら、以下のコマンドで一括前処理を行う(パラメータは各自お好み、バッチサイズ5か6でVRAM 16GBギリくらい)。 ```bash -python preprocess_all.py --model_name Foo -b 6 -e 300 --use_jp_extra +python preprocess_all.py --model_name Foo -b 5 -e 300 --use_jp_extra ``` ### 3. 学習 diff --git a/scripts/Install-Style-Bert-VITS2-CPU.bat b/scripts/Install-Style-Bert-VITS2-CPU.bat index aaf3536..aca6f50 100644 --- a/scripts/Install-Style-Bert-VITS2-CPU.bat +++ b/scripts/Install-Style-Bert-VITS2-CPU.bat @@ -55,11 +55,11 @@ pushd Style-Bert-VITS2 python initialize.py echo ---------------------------------------- -echo Model download is complete. Start the WebUI of the voice synthesis. +echo Model download is complete. Start Style-Bert-VITS2 Editor. echo ---------------------------------------- -@REM 音声合成WebUIの起動 -python app.py +@REM エディターの起動 +python server_editor.py --inbrowser pause diff --git a/scripts/Install-Style-Bert-VITS2.bat b/scripts/Install-Style-Bert-VITS2.bat index 6e99230..59fe97e 100644 --- a/scripts/Install-Style-Bert-VITS2.bat +++ b/scripts/Install-Style-Bert-VITS2.bat @@ -58,11 +58,11 @@ pushd Style-Bert-VITS2 python initialize.py echo ---------------------------------------- -echo Model download is complete. Start the WebUI of the voice synthesis. +echo Model download is complete. Start Style-Bert-VITS2 Editor. echo ---------------------------------------- -@REM 音声合成WebUIの起動 -python app.py +@REM エディターの起動 +python server_editor.py --inbrowser pause diff --git a/scripts/Update-to-Dict-Editor.bat b/scripts/Update-to-Dict-Editor.bat index 254b060..e10060d 100644 --- a/scripts/Update-to-Dict-Editor.bat +++ b/scripts/Update-to-Dict-Editor.bat @@ -12,7 +12,7 @@ if not exist %CURL_CMD% ( @REM Style-Bert-VITS2.zip をGitHubのmasterの最新のものをダウンロード %CURL_CMD% -Lo Style-Bert-VITS2.zip^ - https://github.com/litagin02/Style-Bert-VITS2/archive/refs/heads/master.zip + https://github.com/litagin02/Style-Bert-VITS2/archive/refs/heads/dev.zip if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) @REM Style-Bert-VITS2.zip を解凍(フォルダ名前がBert-VITS2-masterになる) @@ -24,8 +24,8 @@ del Style-Bert-VITS2.zip if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) @REM Bert-VITS2-masterの中身をStyle-Bert-VITS2に上書き移動 -xcopy /QSY .\Style-Bert-VITS2-master\ .\Style-Bert-VITS2\ -rmdir /s /q Style-Bert-VITS2-master +xcopy /QSY .\Style-Bert-VITS2-dev\ .\Style-Bert-VITS2\ +rmdir /s /q Style-Bert-VITS2-dev if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) @REM 仮想環境のpip requirements.txtを更新 @@ -34,17 +34,19 @@ echo call .\Style-Bert-VITS2\scripts\activate.bat call .\Style-Bert-VITS2\venv\Scripts\activate.bat if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) +pause + @REM pyopenjtalk-prebuiltやpyopenjtalkが入っていたら削除 -echo pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk -pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk +echo python -m pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk +python -m pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) @REM pyopenjtalk-dictをインストール -echo pip install -U pyopenjtalk-dict -pip install -U pyopenjtalk-dict +echo python -m pip install -U pyopenjtalk-dict +python -m pip install -U pyopenjtalk-dict @REM その他のrequirements.txtも一応更新 -pip install -U -r Style-Bert-VITS2\requirements.txt +python -m pip install -U -r Style-Bert-VITS2\requirements.txt if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) pushd Style-Bert-VITS2 @@ -52,7 +54,7 @@ pushd Style-Bert-VITS2 echo Update completed. Running Style-Bert-VITS2 Editor... @REM Style-Bert-VITS2 Editorを起動 -python server_editor.py +python server_editor.py --inbrowser pause diff --git a/scripts/Update-to-JP-Extra.bat b/scripts/Update-to-JP-Extra.bat index 95738c6..228cf10 100644 --- a/scripts/Update-to-JP-Extra.bat +++ b/scripts/Update-to-JP-Extra.bat @@ -34,6 +34,15 @@ echo call .\Style-Bert-VITS2\scripts\activate.bat call .\Style-Bert-VITS2\venv\Scripts\activate.bat if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) +echo pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk +pip uninstall -y pyopenjtalk-prebuilt pyopenjtalk +if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) + +echo pip install -U pyopenjtalk-dict +pip install -U pyopenjtalk-dict +if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) + +echo pip install -U -r Style-Bert-VITS2\requirements.txt pip install -U -r Style-Bert-VITS2\requirements.txt if %errorlevel% neq 0 ( pause & popd & exit /b %errorlevel% ) diff --git a/transcribe.py b/transcribe.py index 0ec9e99..4a28fd1 100644 --- a/transcribe.py +++ b/transcribe.py @@ -78,12 +78,9 @@ if __name__ == "__main__": language_id = Languages.ZH.value else: raise ValueError(f"{language} is not supported.") - with open(output_file, "w", encoding="utf-8") as f: - for wav_file in tqdm(wav_files, file=SAFE_STDOUT): - file_name = os.path.basename(wav_file) - text = transcribe( - wav_file, initial_prompt=initial_prompt, language=language - ) + for wav_file in tqdm(wav_files, file=SAFE_STDOUT): + file_name = os.path.basename(wav_file) + text = transcribe(wav_file, initial_prompt=initial_prompt, language=language) + with open(output_file, "a", encoding="utf-8") as f: f.write(f"{file_name}|{model_name}|{language_id}|{text}\n") - f.flush() sys.exit(0)