How to use a custom VAD model
mainYou can provide a custom Voice Activity Detection (VAD) model by wrapping it in the whisper_s2t.speech_segmenter.VADBaseClass.
Your custom class must implement a __call__ method that:
- Accepts an
audio_signalas input. - Returns a numpy array of shape T x 3 (where T is frame length).
- Each row must contain
[speech_prob, frame_start_time, frame_end_time].
Pass the instance to load_model via the vad_model parameter.
# Assuming CustomVAD inherits from whisper_s2t.speech_segmenter.VADBaseClass
vad_model = CustomVAD()
model = whisper_s2t.load_model(model_identifier="large-v2", backend='CTranslate2', vad_model=vad_model)