Add custom vocabulary / hotwords support
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user