mirror of
https://github.com/openai/whisper.git
synced 2025-03-30 14:28:27 +00:00
Merge bf2612f723584b5d154fc68e1c5d15bd2812f574 into 517a43ecd132a2089d85f4ebc044728a71d49f6e
This commit is contained in:
commit
c811c75b3c
@ -186,6 +186,7 @@ def transcribe(
|
||||
[temperature] if isinstance(temperature, (int, float)) else temperature
|
||||
)
|
||||
decode_result = None
|
||||
results = {}
|
||||
|
||||
for t in temperatures:
|
||||
kwargs = {**decode_options}
|
||||
@ -200,6 +201,8 @@ def transcribe(
|
||||
options = DecodingOptions(**kwargs, temperature=t)
|
||||
decode_result = model.decode(segment, options)
|
||||
|
||||
results[t] = decode_result
|
||||
|
||||
needs_fallback = False
|
||||
if (
|
||||
compression_ratio_threshold is not None
|
||||
@ -220,6 +223,9 @@ def transcribe(
|
||||
needs_fallback = False # silence
|
||||
if not needs_fallback:
|
||||
break
|
||||
else:
|
||||
# all failed
|
||||
return max(results.values(), key=lambda r: r.avg_logprob)
|
||||
|
||||
return decode_result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user