Update logic to get segment from features before encoding #705
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quick fix for #646
I tested with a poor quality audio file (192s) and received:
ctranslate2==3.24.0
andfaster-whisper==0.10.1
, the execution time is 12.9sctranslate2==3.24.0
andfaster-whisper==1.0.1
, the execution time is 28.9sBelow is my testing code:
After investigating, I found that the logic changes below increased the latency:
Old logic:
New update logic in #646:
Cutting the segment like this changed the
encode_output
and it only happens at the last loop because thensegment_size < self.feature_extractor.nb_max_frames
.So the
decode_result
also changed and it's quality is reduced in my tests.Specifically, I got the following error in my log:
=> The quality of
decode_result
is poor and repetitive so it takes more iterations to decode and export final result, leading to increased transcription time.For more info, you can check this logic.