File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -744,7 +744,7 @@ def transcribe(
744
744
clip_timestamps : Union [str , List [float ]] = "0" ,
745
745
hallucination_silence_threshold : Optional [float ] = None ,
746
746
hotwords : Optional [str ] = None ,
747
- language_detection_threshold : Optional [ float ] = 0.5 ,
747
+ language_detection_threshold : float = 0.5 ,
748
748
language_detection_segments : int = 1 ,
749
749
) -> Tuple [Iterable [Segment ], TranscriptionInfo ]:
750
750
"""Transcribes an input file.
Original file line number Diff line number Diff line change 2
2
import os
3
3
4
4
import numpy as np
5
+ import pytest
5
6
6
7
from faster_whisper import BatchedInferencePipeline , WhisperModel , decode_audio
7
8
@@ -269,3 +270,9 @@ def test_monotonic_timestamps(physcisworks_path):
269
270
assert word .start <= word .end
270
271
assert word .end <= segments [i ].end
271
272
assert segments [- 1 ].end <= info .duration
273
+
274
+
275
+ def test_language_detection_threshold_none_raises_error (jfk_path ):
276
+ model = WhisperModel ("tiny" )
277
+ with pytest .raises (TypeError ):
278
+ model .transcribe (jfk_path , language_detection_threshold = None ) # type: ignore
You can’t perform that action at this time.
0 commit comments