From 13172de3f98d2fc8969375ca02f7dadce584fe63 Mon Sep 17 00:00:00 2001 From: michelia Date: Tue, 26 Nov 2024 15:26:33 +0800 Subject: [PATCH] fix: faster_whisper should separate device and index --- vox_box/backends/stt/faster_whisper.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vox_box/backends/stt/faster_whisper.py b/vox_box/backends/stt/faster_whisper.py index 7f80ae3..75611e6 100644 --- a/vox_box/backends/stt/faster_whisper.py +++ b/vox_box/backends/stt/faster_whisper.py @@ -46,9 +46,18 @@ def load(self): if platform.system() == "Darwin": compute_type = "int8" + device = self._cfg.device + device_index = 0 + if self._cfg.device != "cpu": + arr = device.split(":") + device = arr[0] + if len(arr) > 1: + device_index = int(arr[1]) + self._model = WhisperModel( self._cfg.model, - self._cfg.device, + device=device, + device_index=device_index, cpu_threads=cpu_threads, compute_type=compute_type, )