Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the official silero-vad package #333

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ lmdb==1.3.0
onnxruntime
soundfile==0.10.3.post1
pypeln==0.4.9
silero-vad @ git+https://github.com/pengzhendong/silero-vad.git
silero-vad
pre-commit==3.5.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"kaldiio",
"torch>=1.12.0",
"torchaudio>=0.12.0",
"silero-vad @ git+https://github.com/pengzhendong/silero-vad.git",
"silero-vad",
]

setup(
Expand Down
8 changes: 4 additions & 4 deletions wespeaker/cli/speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sys

import numpy as np
from silero_vad import SileroVAD
from silero_vad import load_silero_vad, read_audio, get_speech_timestamps
import torch
import torchaudio
import torchaudio.compliance.kaldi as kaldi
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(self, model_dir: str):
self.model = get_speaker_model(
configs['model'])(**configs['model_args'])
load_checkpoint(self.model, model_path)
self.vad = SileroVAD()
self.vad = load_silero_vad()
self.table = {}
self.resample_rate = 16000
self.apply_vad = False
Expand Down Expand Up @@ -141,8 +141,8 @@ def extract_embedding(self, audio_path: str):
if self.apply_vad:
# TODO(Binbin Zhang): Refine the segments logic, here we just
# suppose there is only silence at the start/end of the speech
segments = self.vad.get_speech_timestamps(audio_path,
return_seconds=True)
wav = read_audio(audio_path)
segments = get_speech_timestamps(wav, self.vad, return_seconds=True)
pcmTotal = torch.Tensor()
if len(segments) > 0: # remove all the silence
for segment in segments:
Expand Down
4 changes: 2 additions & 2 deletions wespeaker/models/repvgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import wespeaker.models.pooling_layers as pooling_layers

optional_groupwise_layers = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26]
g2_map = {l: 2 for l in optional_groupwise_layers}
g4_map = {l: 4 for l in optional_groupwise_layers}
g2_map = dict.fromkeys(optional_groupwise_layers, 2)
g4_map = dict.fromkeys(optional_groupwise_layers, 4)


class SEBlock_2D(torch.nn.Module):
Expand Down
Loading