Skip to content

Commit 19f97fa

Browse files
ClericalAidChristian
andauthored
Update whisper params to match the struct in whisper.h (vocodedev#517)
Co-authored-by: Christian <[email protected]>
1 parent bceb874 commit 19f97fa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

vocode/utils/whisper_cpp/whisper_params.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ class WhisperFullParams(ctypes.Structure):
55
_fields_ = [
66
("strategy", ctypes.c_int),
77
#
8-
("n_max_text_ctx", ctypes.c_int),
98
("n_threads", ctypes.c_int),
9+
("n_max_text_ctx", ctypes.c_int),
1010
("offset_ms", ctypes.c_int),
1111
("duration_ms", ctypes.c_int),
1212
#
1313
("translate", ctypes.c_bool),
1414
("no_context", ctypes.c_bool),
15+
("no_timestamps", ctypes.c_bool),
1516
("single_segment", ctypes.c_bool),
1617
("print_special", ctypes.c_bool),
1718
("print_progress", ctypes.c_bool),
@@ -26,13 +27,17 @@ class WhisperFullParams(ctypes.Structure):
2627
("max_tokens", ctypes.c_int),
2728
#
2829
("speed_up", ctypes.c_bool),
30+
("debug_mode", ctypes.c_bool),
2931
("audio_ctx", ctypes.c_int),
3032
#
33+
("tdrz_enable", ctypes.c_bool),
34+
#
3135
("initial_prompt", ctypes.c_char_p),
3236
("prompt_tokens", ctypes.c_void_p),
3337
("prompt_n_tokens", ctypes.c_int),
3438
#
3539
("language", ctypes.c_char_p),
40+
("detect_language", ctypes.c_bool),
3641
#
3742
("suppress_blank", ctypes.c_bool),
3843
("suppress_non_speech_tokens", ctypes.c_bool),
@@ -47,7 +52,7 @@ class WhisperFullParams(ctypes.Structure):
4752
("no_speech_thold", ctypes.c_float),
4853
#
4954
("greedy", ctypes.c_int * 1),
50-
("beam_search", ctypes.c_int * 3),
55+
("beam_search", ctypes.c_int * 2),
5156
#
5257
("new_segment_callback", ctypes.c_void_p),
5358
("new_segment_callback_user_data", ctypes.c_void_p),
@@ -60,4 +65,9 @@ class WhisperFullParams(ctypes.Structure):
6065
#
6166
("logits_filter_callback", ctypes.c_void_p),
6267
("logits_filter_callback_user_data", ctypes.c_void_p),
68+
#
69+
("grammar_rules", ctypes.POINTER(ctypes.c_void_p)),
70+
("n_grammar_rules", ctypes.c_size_t),
71+
("i_start_rule", ctypes.c_size_t),
72+
("grammar_penalty", ctypes.c_float),
6373
]

0 commit comments

Comments
 (0)