Adding support for setting number of threads to faster-whisper cpu, reading from cli, yaml or env var.

This commit is contained in:
Marko Henning
2024-11-19 17:19:02 +01:00
parent 9528468ebb
commit 663675c7b2
3 changed files with 31 additions and 6 deletions
+3 -2
View File
@@ -36,7 +36,7 @@ from inspect import signature
from abc import abstractmethod
import warnings
from .misc import WHISPER_DEFAULT_PATH, SCRAIBE_TORCH_DEVICE
from .misc import WHISPER_DEFAULT_PATH, SCRAIBE_TORCH_DEVICE, SCRAIBE_NUM_THREADS
whisper = TypeVar('whisper')
@@ -348,7 +348,8 @@ class FasterWhisperTranscriber(Transcriber):
f'device {device}! Changing compute type to int8.')
compute_type = 'int8'
_model = FasterWhisperModel(model, download_root=download_root,
device=device, compute_type=compute_type)
device=device, compute_type=compute_type,
cpu_threads=SCRAIBE_NUM_THREADS)
return cls(_model, model_name=model)