@@ -32,6 +32,7 @@ def transcribe_with_whisper(
32
32
vad_options ,
33
33
language ,
34
34
batch_size : int = 16 ,
35
+ chunk_size : int = 20 ,
35
36
model : str = WHISPER_MODEL ,
36
37
device : str = device ,
37
38
device_index : int = 0 ,
@@ -44,6 +45,7 @@ def transcribe_with_whisper(
44
45
Args:
45
46
audio (Audio): The audio to transcribe.
46
47
batch_size (int): Batch size for transcription (default 16).
48
+ chunk_size (int): Chunk size for transcription (default 20).
47
49
model (str): Name of the Whisper model to use.
48
50
device (str): Device to use for PyTorch inference.
49
51
device_index (int): Device index to use for FasterWhisper inference.
@@ -88,7 +90,7 @@ def transcribe_with_whisper(
88
90
threads = faster_whisper_threads ,
89
91
)
90
92
logger .debug ("Transcription model loaded successfully" )
91
- result = model .transcribe (audio = audio , batch_size = batch_size , language = language )
93
+ result = model .transcribe (audio = audio , batch_size = batch_size , chunk_size = chunk_size , language = language )
92
94
93
95
# Log GPU memory before cleanup
94
96
if torch .cuda .is_available ():
@@ -250,10 +252,11 @@ def process_audio_common(params: SpeechToTextProcessingParams, session):
250
252
)
251
253
252
254
logger .debug (
253
- "Transcription parameters - task: %s, language: %s, batch_size: %d, model: %s, device: %s, device_index: %d, compute_type: %s, threads: %d" ,
255
+ "Transcription parameters - task: %s, language: %s, batch_size: %d, chunk_size: %d, model: %s, device: %s, device_index: %d, compute_type: %s, threads: %d" ,
254
256
params .whisper_model_params .task ,
255
257
params .whisper_model_params .language ,
256
258
params .whisper_model_params .batch_size ,
259
+ params .whisper_model_params .chunk_size ,
257
260
params .whisper_model_params .model ,
258
261
params .whisper_model_params .device ,
259
262
params .whisper_model_params .device_index ,
@@ -268,6 +271,7 @@ def process_audio_common(params: SpeechToTextProcessingParams, session):
268
271
vad_options = params .vad_options ,
269
272
language = params .whisper_model_params .language ,
270
273
batch_size = params .whisper_model_params .batch_size ,
274
+ chunk_size = params .whisper_model_params .chunk_size ,
271
275
model = params .whisper_model_params .model ,
272
276
device = params .whisper_model_params .device ,
273
277
device_index = params .whisper_model_params .device_index ,
0 commit comments