snakers4 /silero-vad

Silero VAD: pre-trained enterprise-grade Voice Activity Detector

★ 10,588⑂ 879👁 70⑃ 165● 328▤ 14
PythonCreated 2020-11-23
10,588
stars
+0+7+192
879
forks
70
watchers
165
prs
328
issues
14
releases
–
discussions

README

!header


Silero VAD


Silero VAD - pre-trained enterprise-grade Voice Activity Detector (also see our STT models).




  




Real Time Example

https://user-images.githubusercontent.com/36505480/144874384-95f80f6d-a4f1-42cc-9be7-004c891dd481.mp4

Please note, that video loads only if you are logged in your GitHub account. 





Fast start



Dependencies

  System requirements to run python examples on x86-64 systems:
  
  - python 3.8+;
  - 1G+ RAM;
  - A modern CPU with AVX, AVX2, AVX-512 or AMX instruction sets.

  Required:
  
  - torch=1.12.0.
  
  Everything else is optional and installed via extras:
  
  | Extra | Installs | Needed for |
  |---|---|---|
  | silero-vad[audio] | torchaudio=0.12.0,=1.16.1, numpy | ONNX and sequence models |
  | silero-vad[onnx-gpu] | onnxruntime-gpu=1.16.1, numpy | ONNX on GPU |
  | silero-vad[all] | all of the above | everything |
  
  [audio] pulls in torchcodec on Python 3.9+ because torchaudio=2.9 hands decoding over to it and does not work without it; on Python 3.8 pip resolves an older torchaudio that decodes on its own. torchcodec itself needs FFmpeg (4-9) on the system.
  
  The model itself needs only torch — if you already load audio yourself, pass a 1-D float32 torch.Tensor straight to get_speech_timestamps and install nothing extra.
  
  The bundled I/O helpers (read_audio, save_audio) work with either backend: torchaudio if present, otherwise torchcodec. Note that torchcodec resamples through FFmpeg rather than torchaudio.transforms.Resample, so results can differ by ~1e-3 on files that need resampling.
  
  With torchaudio, a proper audio backend is required:
  
  - Option №1 - FFmpeg backend. conda install -c conda-forge 'ffmpeg

Using pip:
pip install silero-vad[audio] (or plain pip install silero-vad if you load audio yourself)

python3
from silero_vad import load_silero_vad, read_audio, get_speech_timestamps
model = load_silero_vad()
wav = read_audio('path_to_audio_file')
speech_timestamps = get_speech_timestamps(
  wav,
  model,
  return_seconds=True,   Return speech timestamps in seconds (default is samples)
)


Using torch.hub:
python3
import torch
torch.set_num_threads(1)

model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad', model='silero_vad')
(get_speech_timestamps, _, read_audio, _, _) = utils

wav = read_audio('path_to_audio_file')
speech_timestamps = get_speech_timestamps(
  wav,
  model,
  return_seconds=True,   Return speech timestamps in seconds (default is samples)
)




Key Features


- Stellar accuracy

  Silero VAD has excellent results on speech detection tasks.
  
- Fast

  One audio chunk (30+ ms) takes less than 1ms to be processed on a single CPU thread. Using batching or GPU can also improve performance considerably. Under certain conditions ONNX may even run up to 4-5x faster. 

- Lightweight

  JIT model is around two megabytes in size.

- General

  Silero VAD was trained on huge corpora that include over 6000 languages and it performs well on audios fr

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON