add support for CPU_THREADS config (#28)
This commit is contained in:
@@ -67,3 +67,4 @@ services:
|
||||
PUBLIC_WHISHPER_PROFILE: cpu
|
||||
WHISPER_MODELS_DIR: /app/models
|
||||
UPLOAD_DIR: /app/uploads
|
||||
CPU_THREADS: 4
|
||||
@@ -26,8 +26,10 @@ class FasterWhisperBackend(Backend):
|
||||
raise RuntimeError(f"model not found in {local_model_path}")
|
||||
|
||||
def load(self) -> None:
|
||||
# Get CPU threads env variable or default to 4
|
||||
cpu_threads = int(os.environ.get("CPU_THREADS", 4))
|
||||
self.model = WhisperModel(
|
||||
self.model_path(), device=self.device, compute_type=self.quantization
|
||||
self.model_path(), device=self.device, compute_type=self.quantization, cpu_threads=cpu_threads
|
||||
)
|
||||
|
||||
def get_model(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user