FlippFuzz commited on
Commit
1db1652
1 Parent(s): 751fc8f

Display time taken to run whisperCallable.invoke()

Browse files

Just adding a timer around invoke()

Example:
```
Running whisper from 00:04.250 to 00:06.662 , duration: 2.412 expanded: 0 prompt: None language: None
Thank you for watching!
Whisper took 5.392727698024828 seconds <--- This is the change.
```

Files changed (1) hide show
  1. 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