Display time taken to run whisperCallable.invoke() (#20)
Browse files- Display time taken to run whisperCallable.invoke() (1db1652ddd938383ff52d5b077306586ffab0e4b)
Co-authored-by: FlippFuzz <FlippFuzz@users.noreply.huggingface.co>
- src/vad.py +6 -1
src/vad.py
CHANGED
@@ -205,11 +205,16 @@ class AbstractTranscription(ABC):
|
|
205 |
|
206 |
print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ",
|
207 |
segment_duration, "expanded: ", segment_expand_amount, "prompt: ", segment_prompt, "language: ", detected_language)
|
208 |
-
|
|
|
|
|
209 |
scaled_progress_listener = SubTaskProgressListener(progressListener, base_task_total=progress_total_duration,
|
210 |
sub_task_start=segment_start - progress_start_offset, sub_task_total=segment_duration)
|
211 |
segment_result = whisperCallable.invoke(segment_audio, segment_index, segment_prompt, detected_language, progress_listener=scaled_progress_listener)
|
212 |
|
|
|
|
|
|
|
213 |
adjusted_segments = self.adjust_timestamp(segment_result["segments"], adjust_seconds=segment_start, max_source_time=segment_duration)
|
214 |
|
215 |
# Propagate expand amount to the segments
|
|
|
205 |
|
206 |
print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ",
|
207 |
segment_duration, "expanded: ", segment_expand_amount, "prompt: ", segment_prompt, "language: ", detected_language)
|
208 |
+
|
209 |
+
perf_start_time = time.perf_counter()
|
210 |
+
|
211 |
scaled_progress_listener = SubTaskProgressListener(progressListener, base_task_total=progress_total_duration,
|
212 |
sub_task_start=segment_start - progress_start_offset, sub_task_total=segment_duration)
|
213 |
segment_result = whisperCallable.invoke(segment_audio, segment_index, segment_prompt, detected_language, progress_listener=scaled_progress_listener)
|
214 |
|
215 |
+
perf_end_time = time.perf_counter()
|
216 |
+
print("Whisper took {} seconds".format(perf_end_time - perf_start_time))
|
217 |
+
|
218 |
adjusted_segments = self.adjust_timestamp(segment_result["segments"], adjust_seconds=segment_start, max_source_time=segment_duration)
|
219 |
|
220 |
# Propagate expand amount to the segments
|