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

Add duration of audio and VAD removed duration to BatchedInferencePipeline #1186

Merged
merged 14 commits into from
Dec 23, 2024
Merged
9 changes: 9 additions & 0 deletions faster_whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ def transcribe(
audio = decode_audio(audio, sampling_rate=sampling_rate)
duration = audio.shape[0] / sampling_rate

self.model.logger.info(
"Processing audio with duration %s", format_timestamp(duration)
)

chunk_length = chunk_length or self.model.feature_extractor.chunk_length
# if no segment split is provided, use vad_model and generate segments
if not clip_timestamps:
Expand Down Expand Up @@ -421,6 +425,11 @@ def transcribe(
/ sampling_rate
)

self.model.logger.info(
"VAD filter removed %s of audio",
format_timestamp(duration - duration_after_vad),
)

audio_chunks, chunks_metadata = collect_chunks(audio, clip_timestamps)
features = (
[self.model.feature_extractor(chunk)[..., :-1] for chunk in audio_chunks]
Expand Down
Loading