Skip to content

Commit

Permalink
Add duration of audio and VAD removed duration to BatchedInferencePip…
Browse files Browse the repository at this point in the history
…eline (#1186)



Co-authored-by: MahmoudAshraf97 <[email protected]>
  • Loading branch information
greenw0lf and MahmoudAshraf97 authored Dec 23, 2024
1 parent 1b24f28 commit 9516429
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 9516429

Please sign in to comment.