From 4ae9cc7c58ec8c7f177d5275ac23eba28550223b Mon Sep 17 00:00:00 2001 From: Aristeu Junior Date: Thu, 14 Mar 2024 07:47:55 -0300 Subject: [PATCH] Update Wav2Vec2Process.py-alpha --- resources/Wav2Vec2Process.py-alpha | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/Wav2Vec2Process.py-alpha b/resources/Wav2Vec2Process.py-alpha index 366bedf..a1bcbde 100644 --- a/resources/Wav2Vec2Process.py-alpha +++ b/resources/Wav2Vec2Process.py-alpha @@ -16,6 +16,12 @@ def main(): import os os.environ["OMP_NUM_THREADS"] = "6" + try: + if os.environ["IPED_CUDA_MULTIPLIER"]: + cudaMultiplier = int(os.environ["IPED_CUDA_MULTIPLIER"]) + except: + cudaMultiplier = 1 + from faster_whisper import WhisperModel @@ -31,8 +37,9 @@ def main(): else: deviceId = 'cpu' - try: - model = WhisperModel(modelName, device=deviceId, device_index=int(deviceNum), compute_type="int8") + try: + from math import floor + model = WhisperModel(modelName, device=deviceId, device_index=floor(int(deviceNum)/cudaMultiplier), compute_type="int8") except Exception as e: if deviceId != 'cpu':