diff --git a/bindings/java/build.gradle b/bindings/java/build.gradle index 75f3a9cd..eb1a5c07 100644 --- a/bindings/java/build.gradle +++ b/bindings/java/build.gradle @@ -25,13 +25,13 @@ sourceSets { } tasks.register('copyLibwhisperDynlib', Copy) { - from '../../build' - include 'libwhisper.dynlib' + from '../../build/src' + include 'libwhisper.dylib' into 'build/generated/resources/main/darwin' } tasks.register('copyLibwhisperSo', Copy) { - from '../../build' + from '../../build/src' include 'libwhisper.so' into 'build/generated/resources/main/linux-x86-64' } @@ -55,7 +55,12 @@ java { withJavadocJar() } +sourcesJar() { + dependsOn copyLibs +} + jar { + dependsOn copyLibs exclude '**/whisper_java.exp', '**/whisper_java.lib' } @@ -67,6 +72,9 @@ tasks.withType(Test) { useJUnitPlatform() } +test.dependsOn copyLibs +processResources.dependsOn copyLibs + dependencies { implementation "net.java.dev.jna:jna:5.13.0" testImplementation "org.junit.jupiter:junit-jupiter:5.9.2" diff --git a/bindings/java/gradlew b/bindings/java/gradlew old mode 100644 new mode 100755 diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperConstants.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperConstants.java new file mode 100644 index 00000000..0c828f1d --- /dev/null +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperConstants.java @@ -0,0 +1,24 @@ +package io.github.ggerganov.whispercpp; + +/** + * Presets for alignment heads in DTW token timestamps + */ +public class WhisperConstants { + // Alignment heads presets + public static final int WHISPER_AHEADS_NONE = 0; + public static final int WHISPER_AHEADS_TINY_EN = 1; + public static final int WHISPER_AHEADS_TINY = 2; + public static final int WHISPER_AHEADS_BASE_EN = 3; + public static final int WHISPER_AHEADS_BASE = 4; + public static final int WHISPER_AHEADS_SMALL_EN = 5; + public static final int WHISPER_AHEADS_SMALL = 6; + public static final int WHISPER_AHEADS_MEDIUM_EN = 7; + public static final int WHISPER_AHEADS_MEDIUM = 8; + public static final int WHISPER_AHEADS_LARGE_V1 = 9; + public static final int WHISPER_AHEADS_LARGE_V2 = 10; + public static final int WHISPER_AHEADS_LARGE_V3 = 11; + public static final int WHISPER_AHEADS_LARGE_V3_TURBO = 12; + public static final int WHISPER_AHEADS_CUSTOM = 13; + public static final int WHISPER_AHEADS_N_TOP_MOST = 14; + public static final int WHISPER_AHEADS_COUNT = 15; +} diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperContext.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperContext.java index 0498eb4d..7ac124ed 100644 --- a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperContext.java +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperContext.java @@ -1,7 +1,9 @@ package io.github.ggerganov.whispercpp; +import com.sun.jna.NativeLong; import com.sun.jna.Structure; import com.sun.jna.ptr.PointerByReference; +import com.sun.jna.Pointer; import io.github.ggerganov.whispercpp.ggml.GgmlType; import io.github.ggerganov.whispercpp.WhisperModel; import io.github.ggerganov.whispercpp.params.WhisperContextParams; @@ -9,33 +11,26 @@ import io.github.ggerganov.whispercpp.params.WhisperContextParams; import java.util.List; public class WhisperContext extends Structure { - int t_load_us = 0; - int t_start_us = 0; + public NativeLong t_load_us; + public NativeLong t_start_us; /** weight type (FP32 / FP16 / QX) */ - GgmlType wtype = GgmlType.GGML_TYPE_F16; + public GgmlType wtype = GgmlType.GGML_TYPE_F16; /** intermediate type (FP32 or FP16) */ - GgmlType itype = GgmlType.GGML_TYPE_F16; + public GgmlType itype = GgmlType.GGML_TYPE_F16; -// WhisperModel model; - public PointerByReference model; -// whisper_vocab vocab; -// whisper_state * state = nullptr; - public PointerByReference vocab; - public PointerByReference state; + public WhisperContextParams.ByValue params; + + public Pointer model; + public Pointer vocab; + public Pointer state; /** populated by whisper_init_from_file_with_params() */ - String path_model; - WhisperContextParams params; + public Pointer path_model; -// public static class ByReference extends WhisperContext implements Structure.ByReference { -// } -// -// public static class ByValue extends WhisperContext implements Structure.ByValue { -// } -// -// @Override -// protected List getFieldOrder() { -// return List.of("t_load_us", "t_start_us", "wtype", "itype", "model", "vocab", "state", "path_model"); -// } + @Override + protected List getFieldOrder() { + return List.of("t_load_us", "t_start_us", "wtype", "itype", + "params", "model", "vocab", "state", "path_model"); + } } diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCpp.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCpp.java index 4c1594d5..621d8c63 100644 --- a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCpp.java +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCpp.java @@ -43,11 +43,11 @@ public class WhisperCpp implements AutoCloseable { * @param modelPath - absolute path, or just the name (eg: "base", "base-en" or "base.en") * @param params - params to use when initialising the context */ - public void initContext(String modelPath, WhisperContextParams params) throws FileNotFoundException { + public void initContext(String modelPath, WhisperContextParams.ByValue params) throws FileNotFoundException { initContextImpl(modelPath, params); } - private void initContextImpl(String modelPath, WhisperContextParams params) throws FileNotFoundException { + private void initContextImpl(String modelPath, WhisperContextParams.ByValue params) throws FileNotFoundException { if (ctx != null) { lib.whisper_free(ctx); } @@ -69,15 +69,13 @@ public class WhisperCpp implements AutoCloseable { /** * Provides default params which can be used with `whisper_init_from_file_with_params()` etc. - * Because this function allocates memory for the params, the caller must call either: - * - call `whisper_free_context_params()` - * - `Native.free(Pointer.nativeValue(pointer));` + * Returns a ByValue instance to ensure proper parameter passing to native code. */ - public WhisperContextParams getContextDefaultParams() { - paramsPointer = lib.whisper_context_default_params_by_ref(); - WhisperContextParams params = new WhisperContextParams(paramsPointer); - params.read(); - return params; + public WhisperContextParams.ByValue getContextDefaultParams() { + WhisperContextParams.ByValue valueParams = new WhisperContextParams.ByValue( + lib.whisper_context_default_params_by_ref()); + valueParams.read(); + return valueParams; } /** @@ -88,7 +86,7 @@ public class WhisperCpp implements AutoCloseable { * * @param strategy - GREEDY */ - public WhisperFullParams getFullDefaultParams(WhisperSamplingStrategy strategy) { + public WhisperFullParams.ByValue getFullDefaultParams(WhisperSamplingStrategy strategy) { Pointer pointer; // whisper_full_default_params_by_ref allocates memory which we need to delete, so only create max 1 pointer for each strategy. @@ -104,7 +102,7 @@ public class WhisperCpp implements AutoCloseable { pointer = beamParamsPointer; } - WhisperFullParams params = new WhisperFullParams(pointer); + WhisperFullParams.ByValue params = new WhisperFullParams.ByValue(pointer); params.read(); return params; } @@ -138,15 +136,21 @@ public class WhisperCpp implements AutoCloseable { } /** - * Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text. + * Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text. * Not thread safe for same context * Uses the specified decoding strategy to obtain the text. */ - public String fullTranscribe(WhisperFullParams whisperParams, float[] audioData) throws IOException { + public String fullTranscribe(WhisperFullParams.ByValue whisperParams, float[] audioData) throws IOException { if (ctx == null) { throw new IllegalStateException("Model not initialised"); } + /* + WhisperFullParams.ByValue valueParams = new WhisperFullParams.ByValue( + lib.whisper_full_default_params_by_ref(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH.ordinal())); + valueParams.read(); + */ + if (lib.whisper_full(ctx, whisperParams, audioData, audioData.length) != 0) { throw new IOException("Failed to process audio"); } @@ -163,12 +167,17 @@ public class WhisperCpp implements AutoCloseable { return str.toString().trim(); } + public List fullTranscribeWithTime(WhisperFullParams whisperParams, float[] audioData) throws IOException { if (ctx == null) { throw new IllegalStateException("Model not initialised"); } - if (lib.whisper_full(ctx, whisperParams, audioData, audioData.length) != 0) { + WhisperFullParams.ByValue valueParams = new WhisperFullParams.ByValue( + lib.whisper_full_default_params_by_ref(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH.ordinal())); + valueParams.read(); + + if (lib.whisper_full(ctx, valueParams, audioData, audioData.length) != 0) { throw new IOException("Failed to process audio"); } diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCppJnaLibrary.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCppJnaLibrary.java index 1a73cee1..1cd2449f 100644 --- a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCppJnaLibrary.java +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/WhisperCppJnaLibrary.java @@ -38,7 +38,7 @@ public interface WhisperCppJnaLibrary extends Library { * @param params Pointer to whisper_context_params * @return Whisper context on success, null on failure */ - Pointer whisper_init_from_file_with_params(String path_model, WhisperContextParams params); + Pointer whisper_init_from_file_with_params(String path_model, WhisperContextParams.ByValue params); /** * Allocate (almost) all memory needed for the model by loading from a buffer. @@ -180,12 +180,12 @@ public interface WhisperCppJnaLibrary extends Library { /** * @return the id of the specified language, returns -1 if not found. * Examples: - * "de" -> 2 - * "german" -> 2 + * "de" -> 2 + * "german" -> 2 */ int whisper_lang_id(String lang); - /** @return the short string of the specified language id (e.g. 2 -> "de"), returns nullptr if not found */ + /** @return the short string of the specified language id (e.g. 2 -> "de"), returns nullptr if not found */ String whisper_lang_str(int id); /** @@ -268,20 +268,21 @@ public interface WhisperCppJnaLibrary extends Library { void whisper_free_params(Pointer params); /** - * Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text + * Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text * Not thread safe for same context * Uses the specified decoding strategy to obtain the text. */ - int whisper_full(Pointer ctx, WhisperFullParams params, final float[] samples, int n_samples); + int whisper_full(Pointer ctx, WhisperFullParams.ByValue params, final float[] samples, int n_samples); - int whisper_full_with_state(Pointer ctx, Pointer state, WhisperFullParams params, final float[] samples, int n_samples); + public int whisper_full_with_state(Pointer ctx, Pointer state, WhisperFullParams.ByValue params, float[] samples, int n_samples); + //int whisper_full_with_state(Pointer ctx, Pointer state, WhisperFullParams params, final float[] samples, int n_samples); // Split the input audio in chunks and process each chunk separately using whisper_full_with_state() // Result is stored in the default state of the context // Not thread safe if executed in parallel on the same context. // It seems this approach can offer some speedup in some cases. // However, the transcription accuracy can be worse at the beginning and end of each chunk. - int whisper_full_parallel(Pointer ctx, WhisperFullParams params, final float[] samples, int n_samples, int n_processors); + int whisper_full_parallel(Pointer ctx, WhisperFullParams.ByValue params, final float[] samples, int n_samples, int n_processors); /** * Number of generated text segments. diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/GgmlAbortCallback.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/GgmlAbortCallback.java new file mode 100644 index 00000000..244e4191 --- /dev/null +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/callbacks/GgmlAbortCallback.java @@ -0,0 +1,17 @@ +package io.github.ggerganov.whispercpp.callbacks; + +import com.sun.jna.Callback; + +/** + * Callback for aborting GGML computation + * Maps to the C typedef: bool (*ggml_abort_callback)(void * data) + */ +public interface GgmlAbortCallback extends Callback { + /** + * Return true to abort the computation, false to continue + * + * @param data User data passed to the callback + * @return true to abort, false to continue + */ + boolean invoke(com.sun.jna.Pointer data); +} diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAhead.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAhead.java new file mode 100644 index 00000000..39691dcb --- /dev/null +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAhead.java @@ -0,0 +1,30 @@ +package io.github.ggerganov.whispercpp.params; +import com.sun.jna.*; +import java.util.Arrays; +import java.util.List; + +public class WhisperAhead extends Structure { + + public int n_text_layer; + + public int n_head; + + public WhisperAhead() { + super(); + } + + public WhisperAhead(int textLayer, int head) { + super(); + this.n_text_layer = textLayer; + this.n_head = head; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList("n_text_layer", "n_head"); + } + + public static class ByReference extends WhisperAhead implements Structure.ByReference {} + + public static class ByValue extends WhisperAhead implements Structure.ByValue {} +} diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAheads.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAheads.java new file mode 100644 index 00000000..bca5eb0a --- /dev/null +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperAheads.java @@ -0,0 +1,41 @@ +package io.github.ggerganov.whispercpp.params; +import com.sun.jna.*; +import java.util.Arrays; +import java.util.List; + +public class WhisperAheads extends Structure { + public NativeLong n_heads; + + public Pointer heads; + + public WhisperAheads() { + super(); + } + + /** + * Create alignment heads from an array of WhisperAhead objects + */ + public void setHeads(WhisperAhead[] aheadsArray) { + this.n_heads = new NativeLong(aheadsArray.length); + + int structSize = aheadsArray[0].size(); + Memory mem = new Memory(structSize * aheadsArray.length); + + for (int i = 0; i < aheadsArray.length; i++) { + aheadsArray[i].write(); + byte[] buffer = aheadsArray[i].getPointer().getByteArray(0, structSize); + mem.write(i * structSize, buffer, 0, buffer.length); + } + + this.heads = mem; + } + + @Override + protected List getFieldOrder() { + return Arrays.asList("n_heads", "heads"); + } + + public static class ByReference extends WhisperAheads implements Structure.ByReference {} + + public static class ByValue extends WhisperAheads implements Structure.ByValue {} +} diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperContextParams.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperContextParams.java index cf98d2c3..4bcdb6b0 100644 --- a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperContextParams.java +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperContextParams.java @@ -1,7 +1,5 @@ package io.github.ggerganov.whispercpp.params; - import com.sun.jna.*; - import java.util.Arrays; import java.util.List; @@ -11,21 +9,73 @@ import java.util.List; * whisper_context_default_params() */ public class WhisperContextParams extends Structure { - public WhisperContextParams(Pointer p) { super(p); } - /** Use GPU for inference Number (default = true) */ + public WhisperContextParams() { + super(); + } + + /** Use GPU for inference (default = true) */ public CBool use_gpu; - /** Use GPU for inference Number (default = true) */ + /** Use flash attention (default = false) */ + public CBool flash_attn; + + /** CUDA device to use (default = 0) */ + public int gpu_device; + + /** [EXPERIMENTAL] Enable token-level timestamps with DTW (default = false) */ + public CBool dtw_token_timestamps; + + /** [EXPERIMENTAL] Alignment heads preset for DTW */ + public int dtw_aheads_preset; + + /** Number of top layers to use for DTW when using WHISPER_AHEADS_N_TOP_MOST preset */ + public int dtw_n_top; + + public WhisperAheads.ByValue dtw_aheads; + + /** DTW memory size (internal use) */ + public NativeLong dtw_mem_size; + + /** Use GPU for inference */ public void useGpu(boolean enable) { use_gpu = enable ? CBool.TRUE : CBool.FALSE; } + /** Use flash attention */ + public void useFlashAttn(boolean enable) { + flash_attn = enable ? CBool.TRUE : CBool.FALSE; + } + + /** Enable DTW token-level timestamps */ + public void enableDtwTokenTimestamps(boolean enable) { + dtw_token_timestamps = enable ? CBool.TRUE : CBool.FALSE; + } + + /** Set DTW alignment heads preset */ + public void setDtwAheadsPreset(int preset) { + dtw_aheads_preset = preset; + } + @Override protected List getFieldOrder() { - return Arrays.asList("use_gpu"); + return Arrays.asList( + "use_gpu", + "flash_attn", + "gpu_device", + "dtw_token_timestamps", + "dtw_aheads_preset", + "dtw_n_top", + "dtw_aheads", + "dtw_mem_size" + ); + } + + public static class ByValue extends WhisperContextParams implements Structure.ByValue { + public ByValue() { super(); } + public ByValue(Pointer p) { super(p); } } } diff --git a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFullParams.java b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFullParams.java index 18c209fc..498ff126 100644 --- a/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFullParams.java +++ b/bindings/java/src/main/java/io/github/ggerganov/whispercpp/params/WhisperFullParams.java @@ -5,6 +5,7 @@ import io.github.ggerganov.whispercpp.callbacks.WhisperEncoderBeginCallback; import io.github.ggerganov.whispercpp.callbacks.WhisperLogitsFilterCallback; import io.github.ggerganov.whispercpp.callbacks.WhisperNewSegmentCallback; import io.github.ggerganov.whispercpp.callbacks.WhisperProgressCallback; +import io.github.ggerganov.whispercpp.callbacks.GgmlAbortCallback; import java.util.Arrays; import java.util.List; @@ -16,10 +17,12 @@ import java.util.List; */ public class WhisperFullParams extends Structure { + public WhisperFullParams() { + super(); + } + public WhisperFullParams(Pointer p) { super(p); -// super(p, ALIGN_MSVC); -// super(p, ALIGN_GNUC); } /** Sampling strategy for whisper_full() function. */ @@ -69,10 +72,10 @@ public class WhisperFullParams extends Structure { single_segment = single ? CBool.TRUE : CBool.FALSE; } - /** Flag to print special tokens (e.g., <SOT>, <EOT>, <BEG>, etc.). (default = false) */ + /** Flag to print special tokens (e.g., <SOT>, <EOT>, <BEG>, etc.). (default = false) */ public CBool print_special; - /** Flag to print special tokens (e.g., <SOT>, <EOT>, <BEG>, etc.). (default = false) */ + /** Flag to print special tokens (e.g., <SOT>, <EOT>, <BEG>, etc.). (default = false) */ public void printSpecial(boolean enable) { print_special = enable ? CBool.TRUE : CBool.FALSE; } @@ -129,6 +132,14 @@ public class WhisperFullParams extends Structure { /** Maximum tokens per segment (0, default = no limit) */ public int max_tokens; + /** [EXPERIMENTAL] Enable debug mode for extra info */ + public CBool debug_mode; + + /** Enable debug mode */ + public void enableDebugMode(boolean enable) { + debug_mode = enable ? CBool.TRUE : CBool.FALSE; + } + /** Overwrite the audio context size (0 = use default). */ public int audio_ctx; @@ -274,6 +285,16 @@ public class WhisperFullParams extends Structure { */ public Pointer encoder_begin_callback_user_data; + /** Callback used to abort GGML computation */ + public Pointer abort_callback; + + /** User data for the abort_callback */ + public Pointer abort_callback_user_data; + + public void setAbortCallback(GgmlAbortCallback callback) { + abort_callback = CallbackReference.getFunctionPointer(callback); + } + /** * Callback by each decoder to filter obtained logits. * WhisperLogitsFilterCallback @@ -310,17 +331,28 @@ public class WhisperFullParams extends Structure { @Override protected List getFieldOrder() { - return Arrays.asList("strategy", "n_threads", "n_max_text_ctx", "offset_ms", "duration_ms", "translate", - "no_context", "single_segment", "no_timestamps", - "print_special", "print_progress", "print_realtime", "print_timestamps", "token_timestamps", - "thold_pt", "thold_ptsum", "max_len", "split_on_word", "max_tokens", "audio_ctx", - "tdrz_enable", "suppress_regex", "initial_prompt", "prompt_tokens", "prompt_n_tokens", "language", "detect_language", - "suppress_blank", "suppress_nst", "temperature", "max_initial_ts", "length_penalty", - "temperature_inc", "entropy_thold", "logprob_thold", "no_speech_thold", "greedy", "beam_search", - "new_segment_callback", "new_segment_callback_user_data", + return Arrays.asList("strategy", "n_threads", "n_max_text_ctx", + "offset_ms", "duration_ms", "translate", "no_context", + "no_timestamps", "single_segment", "print_special", + "print_progress", "print_realtime", "print_timestamps", + "token_timestamps", "thold_pt", "thold_ptsum", "max_len", + "split_on_word", "max_tokens", "debug_mode", "audio_ctx", + "tdrz_enable", "suppress_regex", "initial_prompt", + "prompt_tokens", "prompt_n_tokens", "language", "detect_language", + "suppress_blank", "suppress_nst", "temperature", + "max_initial_ts", "length_penalty", "temperature_inc", + "entropy_thold", "logprob_thold", "no_speech_thold", "greedy", + "beam_search", "new_segment_callback", "new_segment_callback_user_data", "progress_callback", "progress_callback_user_data", "encoder_begin_callback", "encoder_begin_callback_user_data", + "abort_callback", "abort_callback_user_data", "logits_filter_callback", "logits_filter_callback_user_data", "grammar_rules", "n_grammar_rules", "i_start_rule", "grammar_penalty"); } + + public static class ByValue extends WhisperFullParams implements Structure.ByValue { + public ByValue() { super(); } + public ByValue(Pointer p) { super(p); } + } + } diff --git a/bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperCppTest.java b/bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperCppTest.java index 034726ad..9d63fff3 100644 --- a/bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperCppTest.java +++ b/bindings/java/src/test/java/io/github/ggerganov/whispercpp/WhisperCppTest.java @@ -76,7 +76,7 @@ class WhisperCppTest { float[] floats = new float[b.length / 2]; //WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_GREEDY); - WhisperFullParams params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH); + WhisperFullParams.ByValue params = whisper.getFullDefaultParams(WhisperSamplingStrategy.WHISPER_SAMPLING_BEAM_SEARCH); params.setProgressCallback((ctx, state, progress, user_data) -> System.out.println("progress: " + progress)); params.print_progress = CBool.FALSE; //params.initial_prompt = "and so my fellow Americans um, like";