Skip to content

Commit

Permalink
Fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Dec 1, 2024
1 parent 913086a commit 406acdd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/whisper_ctranslate2/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,10 @@ def __init__(
download_root=cache_directory,
local_files_only=local_files_only,
)

self.batch_size = batch_size
if batched:
if batch_size:
self.batched_model = BatchedInferencePipeline(model=self.model)
else:
self.batched_model = BatchedInferencePipeline(
model=self.model, batch_size=batch_size
)
self.batched_model = BatchedInferencePipeline(model=self.model)
else:
self.batched_model = None

Expand All @@ -150,6 +147,10 @@ def inference(
model = self.model
vad = options.vad_filter

batch_size = (
{"batch_size": self.batch_size} if self.batch_size is not None else {}
)

segments, info = model.transcribe(
audio=audio,
language=language,
Expand Down Expand Up @@ -177,6 +178,7 @@ def inference(
hallucination_silence_threshold=options.hallucination_silence_threshold,
vad_filter=vad,
vad_parameters=vad_parameters,
**batch_size,
)

language_name = LANGUAGES[info.language].title()
Expand Down

0 comments on commit 406acdd

Please sign in to comment.