Install & Compatibility
Where this runs
tested against v6.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 33.17s
py 3.11
✕ build_error
✓ 26.53s
py 3.12
✕ build_error
✓ 25.03s
py 3.13
✕ build_error
✓ 23.3s
py 3.9
✕ build_error
2/3 runs
1707MB installed
● package 1707MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
torchaudio
✓ import torchaudio
silero_vad model and utils
✓ model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad', model='silero_vad', force_reload=True)
✗ from silero_vad import model, utils
Silero VAD models and utilities are primarily loaded via `torch.hub.load` from the GitHub repository, not direct package imports.
get_speech_timestamps
✓ from utils import get_speech_timestamps
`get_speech_timestamps` is part of the `utils` tuple returned by `torch.hub.load`.
VADIterator
✓ from utils import VADIterator
`VADIterator` is part of the `utils` tuple returned by `torch.hub.load`.
This quickstart demonstrates how to load the Silero VAD model and its associated utilities using `torch.hub.load`. It then generates dummy audio, processes it to detect speech segments using `get_speech_timestamps`, and also illustrates the use of `VADIterator` for processing audio in chunks, useful for real-time applications. Ensure PyTorch and Torchaudio are installed, and optionally `onnxruntime` if ONNX inference is desired.
import torch
import torchaudio
import numpy as np
# Ensure PyTorch is installed and CUDA if available
if not torch.cuda.is_available():
print("Warning: CUDA not available, using CPU for VAD.")
# Load the Silero VAD model and utilities from torch hub
# force_reload=True ensures you get the latest version from the repo
# onnx=True if you have onnxruntime installed and want to use ONNX model
model, utils = torch.hub.load(
repo_or_dir='snakers4/silero-vad',
model='silero_vad',
force_reload=True,
onnx=False # Set to True if onnxruntime is installed and preferred
)
# Destructure utilities
(get_speech_timestamps, save_audio, read_audio, VADIterator, collect_chunks) = utils
# Define the sampling rate required by the model (e.g., 16000 Hz)
SAMPLING_RATE = 16000
# Create dummy audio for demonstration (10 seconds, 16kHz)
samples = SAMPLING_RATE * 10
dummy_audio = torch.randn(samples, dtype=torch.float32)
# Resample dummy audio to the required sampling rate if it's not already
# (In a real scenario, you'd read your audio file with torchaudio.load)
if SAMPLING_RATE != torchaudio.get_sample_rate(dummy_audio):
# This part is illustrative; dummy_audio is already at 16k here
# For real audio: audio, sr = torchaudio.load('your_audio.wav')
# if sr != SAMPLING_RATE: audio = torchaudio.functional.resample(audio, orig_freq=sr, new_freq=SAMPLING_RATE)
pass
# Process the audio to get speech timestamps
speech_timestamps = get_speech_timestamps(dummy_audio, model, sampling_rate=SAMPLING_RATE)
print(f"Speech timestamps detected: {speech_timestamps}")
# Example of using VADIterator for real-time processing (requires audio chunks)
vad_iterator = VADIterator(model, sampling_rate=SAMPLING_RATE)
# Simulate processing small chunks
chunk_size = SAMPLING_RATE * 0.5 # 0.5 second chunks
for i in range(0, dummy_audio.shape[0], int(chunk_size)):
chunk = dummy_audio[i:i + int(chunk_size)]
if chunk.shape[0] < chunk_size: # Handle last chunk
continue
speech_dict = vad_iterator(chunk, return_seconds=True)
if speech_dict:
print(f"Speech detected in chunk starting at {i/SAMPLING_RATE:.2f}s: {speech_dict}")
vad_iterator.reset_states() # Reset internal states after processing
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'silero_vad.utils'
Attempting to import 'silero_vad.utils' directly, which is not the recommended usage pattern.
fixUse torch.hub to load the model and utilities: model, utils = torch.hub.load('snakers4/silero-vad', 'silero_vad'); (get_speech_timestamps, ...) = utils. ImportError: Applying the VAD filter requires the onnxruntime package
The 'onnxruntime' package is not installed, which is required for ONNX model usage in silero-vad.
fixInstall the 'onnxruntime' package using pip: pip install onnxruntime.
ValueError: Input audio chunk is too short
The provided audio chunk is shorter than the minimum required length for processing.
fixEnsure that the input audio chunk meets the minimum length requirement specified by the model.
Audio cannot be casted to tensor. Cast it manually
The input audio data is not in a format that can be automatically converted to a tensor.
fixManually convert the audio data to a tensor format compatible with the model's requirements.
RuntimeError: Applying the VAD filter requires the onnxruntime package.
This error indicates that you are attempting to use the ONNX backend for Silero VAD, but the `onnxruntime` package is not installed in your Python environment.
fixInstall the `onnxruntime` package: `pip install onnxruntime`. For GPU acceleration, install `onnxruntime-gpu`: `pip install onnxruntime-gpu`.
Upgrade
Version history
6.2.1latest on PyPI · released Feb 24, 2026
Audit
Dependencies
onnxruntimeoptionalRequired for ONNX model inference. Optional since v6.2.1.
onnxruntime-gpuoptionalRequired for GPU ONNX model inference. Optional since v6.2.1.