Skip to content

Commit

Permalink
fix enable_chinese_lang = False
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-esir committed Jan 31, 2024
1 parent 5d6b33d commit 1dc4719
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
37 changes: 10 additions & 27 deletions notebooks/284-openvoice/284-openvoice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -95,28 +95,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\pesir\\devel\\envs\\py10-openvoice\\lib\\site-packages\\pydub\\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\n",
" warn(\"Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\", RuntimeWarning)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Importing the dtw module. When using in academic works please cite:\n",
" T. Giorgino. Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package.\n",
" J. Stat. Soft., doi:10.18637/jss.v031.i07.\n",
"\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import torch\n",
Expand Down Expand Up @@ -170,7 +151,7 @@
"metadata": {},
"outputs": [],
"source": [
"enable_chinese_lang = True"
"enable_chinese_lang = False"
]
},
{
Expand Down Expand Up @@ -209,7 +190,9 @@
"\n",
"if enable_chinese_lang:\n",
" zh_base_speaker_tts = BaseSpeakerTTS(f'{zh_ckpt_path}/config.json', device=pt_device)\n",
" zh_base_speaker_tts.load_ckpt(f'{zh_ckpt_path}/checkpoint.pth')"
" zh_base_speaker_tts.load_ckpt(f'{zh_ckpt_path}/checkpoint.pth')\n",
"else:\n",
" zh_base_speaker_tts = None"
]
},
{
Expand Down Expand Up @@ -342,7 +325,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a4c0fe479cf54161a77669b26cb850a6",
"model_id": "b74d87b8b3914ee69cb1d0bd6ca54bc6",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -389,7 +372,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3cbc2a28f53a4dc38fc8623e762c188a",
"model_id": "e3dc3666c26c432bac345c670fd42c3a",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -595,7 +578,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dbd8beab04034c9a8b9a920ac581eb10",
"model_id": "06bf423069e045e5bbb4d5e5ce424e2d",
"version_major": 2,
"version_minor": 0
},
Expand Down
6 changes: 6 additions & 0 deletions notebooks/284-openvoice/openvoice_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def predict_impl(prompt, style, audio_file_pth, agree, output_dir, tone_color_co

if language_predicted == "zh":
tts_model = zh_tts_model
if zh_tts_model is None:
gr.Warning(f"TTS model for Chinece language was not loaded please set 'enable_chinese_lang=True`")
return (
text_hint,
None,
)
source_se = zh_source_se
language = 'Chinese'
if style not in ['default']:
Expand Down

0 comments on commit 1dc4719

Please sign in to comment.