From a6ff44ccddc014cabc6aa048b2a213b2a69231e8 Mon Sep 17 00:00:00 2001 From: ssskip Date: Sun, 28 Apr 2024 18:54:55 +0800 Subject: [PATCH] Fix audio model initialization in se_extractor.py with cpu support --- openvoice/se_extractor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openvoice/se_extractor.py b/openvoice/se_extractor.py index a41c2566..c3fa01ae 100644 --- a/openvoice/se_extractor.py +++ b/openvoice/se_extractor.py @@ -19,7 +19,10 @@ def split_audio_whisper(audio_path, audio_name, target_dir='processed'): global model if model is None: - model = WhisperModel(model_size, device="cuda", compute_type="float16") + if torch.cuda.is_available(): + model = WhisperModel(model_size, device="cuda", compute_type="float16") + else: + model = WhisperModel(model_size, device="cpu", compute_type="int8") audio = AudioSegment.from_file(audio_path) max_len = len(audio)