mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 21:44:13 +03:00
Import faster_whisper conditinally to avoid illegal instruction
This commit is contained in:
parent
0314bdf84c
commit
6ee5f246aa
@ -4,7 +4,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import sherpa_onnx
|
import sherpa_onnx
|
||||||
from faster_whisper.utils import download_model
|
|
||||||
|
|
||||||
from frigate.comms.inter_process import InterProcessRequestor
|
from frigate.comms.inter_process import InterProcessRequestor
|
||||||
from frigate.const import MODEL_CACHE_DIR
|
from frigate.const import MODEL_CACHE_DIR
|
||||||
@ -25,6 +24,9 @@ class AudioTranscriptionModelRunner:
|
|||||||
|
|
||||||
if model_size == "large":
|
if model_size == "large":
|
||||||
# use the Whisper download function instead of our own
|
# use the Whisper download function instead of our own
|
||||||
|
# Import dynamically to avoid crashes on systems without AVX support
|
||||||
|
from faster_whisper.utils import download_model
|
||||||
|
|
||||||
logger.debug("Downloading Whisper audio transcription model")
|
logger.debug("Downloading Whisper audio transcription model")
|
||||||
download_model(
|
download_model(
|
||||||
size_or_id="small" if device == "cuda" else "tiny",
|
size_or_id="small" if device == "cuda" else "tiny",
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from faster_whisper import WhisperModel
|
|
||||||
from peewee import DoesNotExist
|
from peewee import DoesNotExist
|
||||||
|
|
||||||
from frigate.comms.inter_process import InterProcessRequestor
|
from frigate.comms.inter_process import InterProcessRequestor
|
||||||
@ -51,6 +50,9 @@ class AudioTranscriptionPostProcessor(PostProcessorApi):
|
|||||||
|
|
||||||
def __build_recognizer(self) -> None:
|
def __build_recognizer(self) -> None:
|
||||||
try:
|
try:
|
||||||
|
# Import dynamically to avoid crashes on systems without AVX support
|
||||||
|
from faster_whisper import WhisperModel
|
||||||
|
|
||||||
self.recognizer = WhisperModel(
|
self.recognizer = WhisperModel(
|
||||||
model_size_or_path="small",
|
model_size_or_path="small",
|
||||||
device="cuda"
|
device="cuda"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user