From 97cfbfee1d11363ee1d54b0b704d8361d49c6f11 Mon Sep 17 00:00:00 2001 From: Lewis Wolfgang Date: Mon, 5 Aug 2024 10:01:27 -0400 Subject: [PATCH] Install silero via pip --- pyproject.toml | 2 +- src/pipecat/vad/silero.py | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 33a72a041..3c94aadf4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ moondream = [ "einops~=0.8.0", "timm~=0.9.16", "transformers~=4.40.2" ] openai = [ "openai~=1.35.0" ] openpipe = [ "openpipe~=4.18.0" ] playht = [ "pyht~=0.0.28" ] -silero = [ "torch~=2.3.1", "torchaudio~=2.3.1" ] +silero = [ "silero-vad~=5.1" ] websocket = [ "websockets~=12.0", "fastapi~=0.111.0" ] whisper = [ "faster-whisper~=1.0.3" ] xtts = [ "resampy~=0.4.3" ] diff --git a/src/pipecat/vad/silero.py b/src/pipecat/vad/silero.py index 4fdf5c767..b801b4545 100644 --- a/src/pipecat/vad/silero.py +++ b/src/pipecat/vad/silero.py @@ -15,6 +15,7 @@ from loguru import logger try: + from silero_vad import load_silero_vad import torch # We don't use torchaudio here, but we need to try importing it because # Silero uses it. @@ -37,10 +38,6 @@ def __init__( self, *, sample_rate: int = 16000, - version: str = "v5.0", - force_reload: bool = False, - skip_validation: bool = True, - trust_repo: bool = True, params: VADParams = VADParams()): super().__init__(sample_rate=sample_rate, num_channels=1, params=params) @@ -49,11 +46,7 @@ def __init__( logger.debug("Loading Silero VAD model...") - (self._model, _) = torch.hub.load(repo_or_dir=f"snakers4/silero-vad:{version}", - model="silero_vad", - force_reload=force_reload, - skip_validation=skip_validation, - trust_repo=trust_repo) + self._model = load_silero_vad() self._last_reset_time = 0 @@ -94,20 +87,12 @@ def __init__( self, *, sample_rate: int = 16000, - version: str = "v5.0", - force_reload: bool = False, - skip_validation: bool = True, - trust_repo: bool = True, vad_params: VADParams = VADParams(), audio_passthrough: bool = False): super().__init__() self._vad_analyzer = SileroVADAnalyzer( sample_rate=sample_rate, - version=version, - force_reload=force_reload, - skip_validation=skip_validation, - trust_repo=trust_repo, params=vad_params) self._audio_passthrough = audio_passthrough