Implement VadOptions (#198)

* Implement VadOptions

* Fix line too long

./faster_whisper/transcribe.py:226:101: E501 line too long (111 > 100 characters)

* Reformatted files with black

* black .\faster_whisper\vad.py    
* black .\faster_whisper\transcribe.py

* Fix import order with isort

* isort .\faster_whisper\vad.py
* isort .\faster_whisper\transcribe.py

* Made recommended changes

Recommended in https://github.com/guillaumekln/faster-whisper/pull/198

* Fix typing of vad_options argument

---------

Co-authored-by: Guillaume Klein <guillaumekln@users.noreply.github.com>
This commit is contained in:
FlippFuzz
2023-05-09 18:47:02 +08:00
committed by GitHub
parent d889345e07
commit 5d8f3e2d90
3 changed files with 50 additions and 24 deletions

View File

@@ -29,7 +29,7 @@ def test_transcribe(jfk_path):
def test_vad(jfk_path):
model = WhisperModel("tiny")
segments, _ = model.transcribe(
segments, info = model.transcribe(
jfk_path,
vad_filter=True,
vad_parameters=dict(min_silence_duration_ms=500, speech_pad_ms=200),
@@ -47,6 +47,9 @@ def test_vad(jfk_path):
assert 0 < segment.start < 1
assert 10 < segment.end < 11
assert info.vad_options.min_silence_duration_ms == 500
assert info.vad_options.speech_pad_ms == 200
def test_stereo_diarization(data_dir):
model = WhisperModel("tiny")