From 2c2c31ef09a6d9795c72430332da72db8ff5f274 Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Tue, 5 Nov 2024 00:03:47 +0000 Subject: [PATCH] F5-TTS final updates --- system/tts_engines/f5tts/model_engine.py | 32 +++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/system/tts_engines/f5tts/model_engine.py b/system/tts_engines/f5tts/model_engine.py index 3d3a68bf..cfe71133 100644 --- a/system/tts_engines/f5tts/model_engine.py +++ b/system/tts_engines/f5tts/model_engine.py @@ -27,7 +27,6 @@ # In this section you will import any imports that your specific TTS Engine will use. You will provide any # start-up errors for those bits, as if you were starting up a normal Python script. Note the logging.disable # a few lines up from here, you may want to # that out while debugging! -from vocos import Vocos import soundfile as sf import tempfile from pydub import AudioSegment, silence @@ -39,9 +38,22 @@ def install_and_restart(): try: - print("##########################################") - print("F5-TTS not found. Attempting to install...") - print("##########################################") + print("#################################################################") + print("Installing required packages for F5-TTS... This may take a while.") + print("################################################################") + + # Install vocos first + print("Installing vocos...") + subprocess.check_call([ + sys.executable, + "-m", + "pip", + "install", + "vocos" + ]) + + # Then install F5-TTS + print("Installing F5-TTS...") subprocess.check_call([ sys.executable, "-m", @@ -49,9 +61,10 @@ def install_and_restart(): "install", "git+https://github.com/SWivid/F5-TTS.git" ]) - print("########################################################") - print("F5-TTS installed successfully! Restarting application...") - print("########################################################") + + print("##############################################################") + print("All packages installed successfully! Restarting application...") + print("##############################################################") # Get the current script's path script_path = sys.argv[0] @@ -61,9 +74,9 @@ def install_and_restart(): except subprocess.CalledProcessError as e: print("########################################################") - print(f"Failed to install F5-TTS: {str(e)}") + print(f"Failed to install required packages: {str(e)}") print("########################################################") - raise ImportError("Could not install required package F5-TTS") + raise ImportError("Could not install required packages") try: from f5_tts.model import CFM, DiT @@ -71,6 +84,7 @@ def install_and_restart(): get_tokenizer, convert_char_to_pinyin, ) + from vocos import Vocos except ImportError: install_and_restart()