From 5fcdb19f8baffffe3a57e18c9dd6e68da45bb37e Mon Sep 17 00:00:00 2001 From: mrq Date: Sun, 19 Feb 2023 01:47:06 +0000 Subject: [PATCH] I forgot to make it update the whisper model at runtime --- src/utils.py | 11 +++++++++++ src/webui.py | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/utils.py b/src/utils.py index f9ce8d3..ea5303d 100755 --- a/src/utils.py +++ b/src/utils.py @@ -765,6 +765,17 @@ def get_dataset_list(dir="./training/"): def get_training_list(dir="./training/"): return sorted([f'./training/{d}/train.yaml' for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d)) and len(os.listdir(os.path.join(dir, d))) > 0 and "train.yaml" in os.listdir(os.path.join(dir, d)) ]) +def update_whisper_model(name): + global whisper_model + if whisper_model: + del whisper_model + whisper_model = None + + args.whisper_model = name + + print(f"Loading Whisper model: {args.whisper_model}") + whisper_model = whisper.load_model(args.whisper_model) + def update_autoregressive_model(path_name): global tts if not tts: diff --git a/src/webui.py b/src/webui.py index 1550a2f..7c2b115 100755 --- a/src/webui.py +++ b/src/webui.py @@ -209,10 +209,8 @@ def history_copy_settings( voice, file ): return import_generate_settings( f"./results/{voice}/{file}" ) def update_model_settings( autoregressive_model, whisper_model ): - if args.autoregressive_model != autoregressive_model: - update_autoregressive_model(autoregressive_model) - - args.whisper_model = whisper_model + update_autoregressive_model(autoregressive_model) + update_whisper_model(whisper_model) save_args_settings()