no_context = enable ? CBool.FALSE : CBool.TRUE;\r
}\r
\r
+ /** Generate timestamps or not? */\r
+ public CBool no_timestamps;\r
+\r
/** Flag to force single segment output (useful for streaming). (default = false) */\r
public CBool single_segment;\r
\r
logits_filter_callback = CallbackReference.getFunctionPointer(callback);\r
}\r
\r
+ /** Grammar stuff */\r
+ public Pointer grammar_rules;\r
+ public long n_grammar_rules;\r
+ public long i_start_rule;\r
+ public float grammar_penalty;\r
+\r
@Override\r
protected List<String> getFieldOrder() {\r
return Arrays.asList("strategy", "n_threads", "n_max_text_ctx", "offset_ms", "duration_ms", "translate",\r
- "no_context", "single_segment",\r
+ "no_context", "single_segment", "no_timestamps",\r
"print_special", "print_progress", "print_realtime", "print_timestamps", "token_timestamps",\r
"thold_pt", "thold_ptsum", "max_len", "split_on_word", "max_tokens", "speed_up", "audio_ctx",\r
"tdrz_enable", "initial_prompt", "prompt_tokens", "prompt_n_tokens", "language", "detect_language",\r
"new_segment_callback", "new_segment_callback_user_data",\r
"progress_callback", "progress_callback_user_data",\r
"encoder_begin_callback", "encoder_begin_callback_user_data",\r
- "logits_filter_callback", "logits_filter_callback_user_data");\r
+ "logits_filter_callback", "logits_filter_callback_user_data",\r
+ "grammar_rules", "n_grammar_rules", "i_start_rule", "grammar_penalty");\r
}\r
}\r
static void init() throws FileNotFoundException {\r
// By default, models are loaded from ~/.cache/whisper/ and are usually named "ggml-${name}.bin"\r
// or you can provide the absolute path to the model file.\r
- String modelName = "../../models/ggml-tiny.bin";\r
-// String modelName = "../../models/ggml-tiny.en.bin";\r
+ //String modelName = "../../models/ggml-tiny.bin";\r
+ String modelName = "../../models/ggml-tiny.en.bin";\r
try {\r
whisper.initContext(modelName);\r
-// whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
-// whisper.getJavaDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
+ //whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
+ //whisper.getJavaDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
modelInitialised = true;\r
} catch (FileNotFoundException ex) {\r
System.out.println("Model " + modelName + " not found");\r
byte[] b = new byte[audioInputStream.available()];\r
float[] floats = new float[b.length / 2];\r
\r
-// WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
+ //WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
params.setProgressCallback((ctx, state, progress, user_data) -> System.out.println("progress: " + progress));\r
params.print_progress = CBool.FALSE;\r
-// params.initial_prompt = "and so my fellow Americans um, like";\r
+ //params.initial_prompt = "and so my fellow Americans um, like";\r
\r
\r
try {\r
byte[] b = new byte[audioInputStream.available()];\r
float[] floats = new float[b.length / 2];\r
\r
-// WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
+ //WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY);\r
WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH);\r
params.setProgressCallback((ctx, state, progress, user_data) -> System.out.println("progress: " + progress));\r
params.print_progress = CBool.FALSE;\r
-// params.initial_prompt = "and so my fellow Americans um, like";\r
-\r
+ //params.initial_prompt = "and so my fellow Americans um, like";\r
\r
try {\r
audioInputStream.read(b);\r