File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -731,7 +731,7 @@ def transcribe(
731731 clip_timestamps : Union [str , List [float ]] = "0" ,
732732 hallucination_silence_threshold : Optional [float ] = None ,
733733 hotwords : Optional [str ] = None ,
734- language_detection_threshold : Optional [ float ] = 0.5 ,
734+ language_detection_threshold : float = 0.5 ,
735735 language_detection_segments : int = 1 ,
736736 ) -> Tuple [Iterable [Segment ], TranscriptionInfo ]:
737737 """Transcribes an input file.
Original file line number Diff line number Diff line change 22import os
33
44import numpy as np
5+ import pytest
56
67from faster_whisper import BatchedInferencePipeline , WhisperModel , decode_audio
78
@@ -269,3 +270,9 @@ def test_monotonic_timestamps(physcisworks_path):
269270 assert word .start <= word .end
270271 assert word .end <= segments [i ].end
271272 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