From 8877960062d0ddc1f5e942635d73e6a5e635231c Mon Sep 17 00:00:00 2001 From: mrq Date: Wed, 22 Mar 2023 19:53:42 +0000 Subject: [PATCH] fixes for whisperx batching --- src/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 76c8345..5b537ad 100755 --- a/src/utils.py +++ b/src/utils.py @@ -1168,7 +1168,7 @@ def whisper_transcribe( file, language=None ): device = "cuda" if get_device_name() == "cuda" else "cpu" if whisper_vad: if args.whisper_batchsize > 1: - result = whisperx.transcribe_with_vad_parallel(whisper_model, file, whisper_vad, batch_size=args.whisper_batchsize) + result = whisperx.transcribe_with_vad_parallel(whisper_model, file, whisper_vad, batch_size=args.whisper_batchsize, language=language, task="transcribe") else: result = whisperx.transcribe_with_vad(whisper_model, file, whisper_vad) else: @@ -1192,6 +1192,10 @@ def whisper_transcribe( file, language=None ): del result_aligned['segments'][i]['char-segments'] result['segments'] = result_aligned['segments'] + result['text'] = [] + for segment in result['segments']: + result['text'].append(segment['text'].strip()) + result['text'] = " ".join(result['text']) return result