Add custom vocabulary / hotwords support

This commit is contained in:
Aaron Boxer
2026-04-17 09:36:05 -04:00
committed by Aaron Boxer
parent 9a71a95ca8
commit 4210697ca6
4 changed files with 16 additions and 4 deletions
@@ -34,6 +34,7 @@ class ServeClientFasterWhisper(ServeClientBase):
same_output_threshold=7,
cache_path="~/.cache/whisper-live/",
translation_queue=None,
hotwords=None,
):
"""
Initialize a ServeClient instance.
@@ -78,6 +79,7 @@ class ServeClientFasterWhisper(ServeClientBase):
self.task = task
self.initial_prompt = initial_prompt
self.vad_parameters = vad_parameters or {"threshold": 0.5}
self.hotwords = hotwords
device = "cuda" if torch.cuda.is_available() else "cpu"
if device == "cuda":
@@ -231,7 +233,8 @@ class ServeClientFasterWhisper(ServeClientBase):
language=self.language,
task=self.task,
vad_filter=self.use_vad,
vad_parameters=self.vad_parameters if self.use_vad else None)
vad_parameters=self.vad_parameters if self.use_vad else None,
hotwords=self.hotwords)
if ServeClientFasterWhisper.SINGLE_MODEL:
ServeClientFasterWhisper.SINGLE_MODEL_LOCK.release()