Update transcribe.py

Fixed comments
This commit is contained in:
Alexander Kuznetsov 2024-11-03 13:02:15 +03:00 committed by GitHub
parent f3184f3829
commit ce1b65e386
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,6 +47,7 @@ def transcribe(
no_speech_threshold: Optional[float] = 0.6, no_speech_threshold: Optional[float] = 0.6,
condition_on_previous_text: bool = True, condition_on_previous_text: bool = True,
initial_prompt: Optional[str] = None, initial_prompt: Optional[str] = None,
carry_initial_prompt: bool = False,
word_timestamps: bool = False, word_timestamps: bool = False,
prepend_punctuations: str = "\"'“¿([{-", prepend_punctuations: str = "\"'“¿([{-",
append_punctuations: str = "\"'.。,!?::”)]}、", append_punctuations: str = "\"'.。,!?::”)]}、",
@ -208,7 +209,7 @@ def transcribe(
compression_ratio_threshold is not None compression_ratio_threshold is not None
and decode_result.compression_ratio > compression_ratio_threshold and decode_result.compression_ratio > compression_ratio_threshold
): ):
needs_fallback = True # too repetitive <-- We can inprove it... needs_fallback = True # too repetitive
if ( if (
logprob_threshold is not None logprob_threshold is not None
and decode_result.avg_logprob < logprob_threshold and decode_result.avg_logprob < logprob_threshold
@ -220,9 +221,9 @@ def transcribe(
): ):
needs_fallback = False # silence needs_fallback = False # silence
if ( if (
compression_ratio_hallucination_threshold is not None compression_ratio_hallucination_threshold is not None
and decode_result.compression_ratio > compression_ratio_hallucination_threshold and decode_result.compression_ratio > compression_ratio_hallucination_threshold
and t == temperatures[-1] and t == temperatures[-1]
): ):
# Discard the segment # Discard the segment
return None # Skip to the next segment return None # Skip to the next segment