Skip to content

Commit

Permalink
Install silero via pip
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisWolfgang committed Aug 5, 2024
1 parent 65b136b commit 97cfbfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
19 changes: 2 additions & 17 deletions src/pipecat/vad/silero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 97cfbfe

Please sign in to comment.