From 1dc47191e008762fe0cce36105aaba894079fa1f Mon Sep 17 00:00:00 2001 From: Pavel Esir Date: Wed, 31 Jan 2024 01:57:05 +0100 Subject: [PATCH] fix enable_chinese_lang = False --- notebooks/284-openvoice/284-openvoice.ipynb | 37 ++++++--------------- notebooks/284-openvoice/openvoice_gradio.py | 6 ++++ 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/notebooks/284-openvoice/284-openvoice.ipynb b/notebooks/284-openvoice/284-openvoice.ipynb index 42d59af6ee1..688ab0d4c8c 100644 --- a/notebooks/284-openvoice/284-openvoice.ipynb +++ b/notebooks/284-openvoice/284-openvoice.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -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", @@ -170,7 +151,7 @@ "metadata": {}, "outputs": [], "source": [ - "enable_chinese_lang = True" + "enable_chinese_lang = False" ] }, { @@ -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" ] }, { @@ -342,7 +325,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "a4c0fe479cf54161a77669b26cb850a6", + "model_id": "b74d87b8b3914ee69cb1d0bd6ca54bc6", "version_major": 2, "version_minor": 0 }, @@ -389,7 +372,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "3cbc2a28f53a4dc38fc8623e762c188a", + "model_id": "e3dc3666c26c432bac345c670fd42c3a", "version_major": 2, "version_minor": 0 }, @@ -595,7 +578,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "dbd8beab04034c9a8b9a920ac581eb10", + "model_id": "06bf423069e045e5bbb4d5e5ce424e2d", "version_major": 2, "version_minor": 0 }, diff --git a/notebooks/284-openvoice/openvoice_gradio.py b/notebooks/284-openvoice/openvoice_gradio.py index c761038ce96..fe9a9394fcb 100644 --- a/notebooks/284-openvoice/openvoice_gradio.py +++ b/notebooks/284-openvoice/openvoice_gradio.py @@ -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']: