Foolproof: Disable VAD if clip_timestamps is in use (#769)

* Foolproof: Disable VAD if clip_timestamps is in use

Prevent silly things to happen.
This commit is contained in:
Purfview
2024-04-02 17:20:34 +01:00
committed by GitHub
parent 8ae82c8372
commit b024972a56

View File

@@ -280,6 +280,7 @@ class WhisperModel:
clip_timestamps: Union[str, List[float]] clip_timestamps: Union[str, List[float]]
Comma-separated list start,end,start,end,... timestamps (in seconds) of clips to Comma-separated list start,end,start,end,... timestamps (in seconds) of clips to
process. The last end timestamp defaults to the end of the file. process. The last end timestamp defaults to the end of the file.
vad_filter will be ignored if clip_timestamps is used.
hallucination_silence_threshold: Optional[float] hallucination_silence_threshold: Optional[float]
When word_timestamps is True, skip silent periods longer than this threshold When word_timestamps is True, skip silent periods longer than this threshold
(in seconds) when a possible hallucination is detected (in seconds) when a possible hallucination is detected
@@ -305,7 +306,7 @@ class WhisperModel:
"Processing audio with duration %s", format_timestamp(duration) "Processing audio with duration %s", format_timestamp(duration)
) )
if vad_filter: if vad_filter and clip_timestamps == "0":
if vad_parameters is None: if vad_parameters is None:
vad_parameters = VadOptions() vad_parameters = VadOptions()
elif isinstance(vad_parameters, dict): elif isinstance(vad_parameters, dict):