Skip to content

Commit

Permalink
deps: use pypi provided silero vad, upgrade to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
rpurdel authored Nov 20, 2024
1 parent 67f708c commit 4d17ab9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 254 deletions.
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ langchain-openai = "^0.2.0"
av = "^12.3.0"
pybase64 = "^1.4.0"
vllm = "0.6.2"
silero-vad = "^5.1.2"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ s3transfer==0.10.2 ; python_version >= "3.11" and python_version < "3.12"
safetensors==0.4.5 ; python_version >= "3.11" and python_version < "3.12"
sentencepiece==0.2.0 ; python_version >= "3.11" and python_version < "3.12"
setuptools==75.1.0 ; python_version >= "3.11" and python_version < "3.12"
silero-vad==5.1.2 ; python_version >= "3.11" and python_version < "3.12"
six==1.16.0 ; python_version >= "3.11" and python_version < "3.12"
sniffio==1.3.1 ; python_version >= "3.11" and python_version < "3.12"
sqlalchemy==2.0.35 ; python_version >= "3.11" and python_version < "3.12"
Expand Down
6 changes: 2 additions & 4 deletions skynet/modules/stt/streaming_whisper/cfg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os

from faster_whisper import WhisperModel
from silero_vad import load_silero_vad

from skynet.env import (
device,
Expand All @@ -11,12 +10,11 @@
whisper_model_path,
)
from skynet.logs import get_logger
from skynet.modules.stt.streaming_whisper.utils import vad_utils as vad

log = get_logger(__name__)


vad_model = vad.init_jit_model(f'{os.getcwd()}/skynet/modules/stt/streaming_whisper/models/vad/silero_vad.jit')
vad_model = load_silero_vad(onnx=False)

device = whisper_device if whisper_device != 'auto' else device
log.info(f'Using {device}')
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions skynet/modules/stt/streaming_whisper/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
from numpy import ndarray
from pydantic import BaseModel
from silero_vad import get_speech_timestamps, read_audio
from uuid6 import UUID

import skynet.modules.stt.streaming_whisper.cfg as cfg
Expand Down Expand Up @@ -188,8 +189,8 @@ def is_silent(audio: bytes) -> Tuple[bool, iter]:
chunk_duration = convert_bytes_to_seconds(audio)
wav_header = get_wav_header([audio], chunk_duration_s=chunk_duration)
stream = wav_header + b'' + audio
audio = cfg.vad.read_audio(stream)
st = cfg.vad.get_speech_timestamps(audio, model=cfg.vad_model, return_seconds=True)
audio = read_audio(stream)
st = get_speech_timestamps(audio, model=cfg.vad_model, return_seconds=True)
log.debug(f'Detected speech timestamps: {st}')
silent = True if len(st) == 0 else False
return silent, st
Expand Down
247 changes: 0 additions & 247 deletions skynet/modules/stt/streaming_whisper/utils/vad_utils.py

This file was deleted.

0 comments on commit 4d17ab9

Please sign in to comment.