This commit is contained in:
litagin02
2024-03-15 20:16:58 +09:00
parent d808cd635d
commit 3efcb98858
9 changed files with 102 additions and 21 deletions

View File

@@ -6,7 +6,19 @@
"source": [
"# Style-Bert-VITS2ライブラリの使用例\n",
"\n",
"`pip install style-bert-vits2`を使った、colabで動く使用例です。"
"`pip install style-bert-vits2`を使った、jupyter notebookでの使用例です。Google colab等でも動きます。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# PyTorch環境の構築ない場合\n",
"# 参照: https://pytorch.org/get-started/locally/\n",
"\n",
"!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118"
]
},
{
@@ -17,7 +29,9 @@
},
"outputs": [],
"source": [
"!pip install style-bert-vits2==2.4.dev0"
"# style-bert-vits2のインストール\n",
"\n",
"!pip install style-bert-vits2"
]
},
{
@@ -28,6 +42,8 @@
},
"outputs": [],
"source": [
"# BERTモデルをロードローカルに手動でダウンロードする必要はありません\n",
"\n",
"from style_bert_vits2.nlp import bert_models\n",
"from style_bert_vits2.constants import Languages\n",
"\n",
@@ -48,6 +64,9 @@
},
"outputs": [],
"source": [
"# Hugging Faceから試しにデフォルトモデルをダウンロードしてみて、それを音声合成に使ってみる\n",
"# model_assetsディレクトリにダウンロードされます\n",
"\n",
"from pathlib import Path\n",
"from huggingface_hub import hf_hub_download\n",
"\n",
@@ -73,14 +92,16 @@
},
"outputs": [],
"source": [
"# 上でダウンロードしたモデルファイルを指定して音声合成のテスト\n",
"\n",
"from style_bert_vits2.tts_model import TTSModel\n",
"\n",
"assets_root = Path(\"model_assets\")\n",
"\n",
"model = TTSModel(\n",
" model_path=assets_root / model_file,\n",
" config_path = assets_root / config_file,\n",
" style_vec_path = assets_root / style_file,\n",
" config_path=assets_root / config_file,\n",
" style_vec_path=assets_root / style_file,\n",
" device=\"cpu\"\n",
")"
]