public interface WhisperCppJnaLibrary
extends com.sun.jna.Library
| 限定符和类型 | 字段和说明 |
|---|---|
static WhisperCppJnaLibrary |
instance |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
whisper_bench_ggml_mul_mat_str(int nThreads)
Benchmark function for ggml_mul_mat as a string.
|
int |
whisper_bench_ggml_mul_mat(int nThreads)
Benchmark function for ggml_mul_mat.
|
String |
whisper_bench_memcpy_str(int nThreads)
Benchmark function for memcpy as a string.
|
int |
whisper_bench_memcpy(int nThreads)
Benchmark function for memcpy.
|
int |
whisper_decode_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
com.sun.jna.Pointer tokens,
int n_tokens,
int n_past,
int n_threads) |
int |
whisper_decode(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer tokens,
int n_tokens,
int n_past,
int n_threads)
Run the Whisper decoder to obtain the logits and probabilities for the next token.
|
int |
whisper_encode_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
int offset,
int n_threads) |
int |
whisper_encode(com.sun.jna.Pointer ctx,
int offset,
int n_threads)
Run the Whisper encoder on the log mel spectrogram stored inside the default state in the provided whisper context.
|
void |
whisper_free_params(com.sun.jna.Pointer params) |
void |
whisper_free_state(com.sun.jna.Pointer state)
Free all allocated memory associated with the Whisper state.
|
void |
whisper_free(com.sun.jna.Pointer ctx)
Free all allocated memory associated with the Whisper context.
|
com.sun.jna.Pointer |
whisper_full_default_params_by_ref(int strategy)
Provides default params which can be used with `whisper_full()` etc.
|
long |
whisper_full_get_segment_t0_from_state(com.sun.jna.Pointer state,
int i_segment)
Get the start time of the specified segment from the state.
|
long |
whisper_full_get_segment_t0(com.sun.jna.Pointer ctx,
int i_segment)
Get the start time of the specified segment.
|
long |
whisper_full_get_segment_t1_from_state(com.sun.jna.Pointer state,
int i_segment)
Get the end time of the specified segment from the state.
|
long |
whisper_full_get_segment_t1(com.sun.jna.Pointer ctx,
int i_segment)
Get the end time of the specified segment.
|
String |
whisper_full_get_segment_text_from_state(com.sun.jna.Pointer state,
int i_segment)
Get the text of the specified segment from the state.
|
String |
whisper_full_get_segment_text(com.sun.jna.Pointer ctx,
int i_segment)
Get the text of the specified segment.
|
WhisperTokenData |
whisper_full_get_token_data_from_state(com.sun.jna.Pointer state,
int i_segment,
int i_token)
Get token data for the specified token in the specified segment from the state.
|
WhisperTokenData |
whisper_full_get_token_data(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
Get token data for the specified token in the specified segment.
|
int |
whisper_full_get_token_id_from_state(com.sun.jna.Pointer state,
int i_segment,
int i_token)
Get the token ID of the specified token in the specified segment from the state.
|
int |
whisper_full_get_token_id(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
Get the token ID of the specified token in the specified segment.
|
float |
whisper_full_get_token_p_from_state(com.sun.jna.Pointer state,
int i_segment,
int i_token)
Get the probability of the specified token in the specified segment from the state.
|
float |
whisper_full_get_token_p(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
Get the probability of the specified token in the specified segment.
|
String |
whisper_full_get_token_text_from_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
int i_segment,
int i_token)
Get the token text of the specified token in the specified segment from the state.
|
String |
whisper_full_get_token_text(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
Get the token text of the specified token in the specified segment.
|
int |
whisper_full_lang_id_from_state(com.sun.jna.Pointer state)
Language id associated with the provided state
|
int |
whisper_full_lang_id(com.sun.jna.Pointer ctx)
Language id associated with the context's default state.
|
int |
whisper_full_n_segments_from_state(com.sun.jna.Pointer state) |
int |
whisper_full_n_segments(com.sun.jna.Pointer ctx)
Number of generated text segments.
|
int |
whisper_full_n_tokens_from_state(com.sun.jna.Pointer state,
int i_segment)
Get the number of tokens in the specified segment from the state.
|
int |
whisper_full_n_tokens(com.sun.jna.Pointer ctx,
int i_segment)
Get the number of tokens in the specified segment.
|
int |
whisper_full_parallel(com.sun.jna.Pointer ctx,
WhisperFullParams params,
float[] samples,
int n_samples,
int n_processors) |
int |
whisper_full_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
WhisperFullParams params,
float[] samples,
int n_samples) |
int |
whisper_full(com.sun.jna.Pointer ctx,
WhisperFullParams params,
float[] samples,
int n_samples)
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.
|
float[] |
whisper_get_logits_from_state(com.sun.jna.Pointer state) |
float[] |
whisper_get_logits(com.sun.jna.Pointer ctx)
Token logits obtained from the last call to whisper_decode().
|
com.sun.jna.Pointer |
whisper_init_from_buffer_no_state(com.sun.jna.Pointer buffer,
int buffer_size)
Allocate (almost) all memory needed for the model by loading from a buffer without allocating the state.
|
com.sun.jna.Pointer |
whisper_init_from_buffer(com.sun.jna.Pointer buffer,
int buffer_size)
Allocate (almost) all memory needed for the model by loading from a buffer.
|
com.sun.jna.Pointer |
whisper_init_from_file_no_state(String path_model)
Allocate (almost) all memory needed for the model by loading from a file without allocating the state.
|
com.sun.jna.Pointer |
whisper_init_from_file(String path_model)
Allocate (almost) all memory needed for the model by loading from a file.
|
com.sun.jna.Pointer |
whisper_init_no_state(WhisperModelLoader loader)
Allocate (almost) all memory needed for the model using a model loader without allocating the state.
|
com.sun.jna.Pointer |
whisper_init_state(com.sun.jna.Pointer ctx)
Allocate memory for the Whisper state.
|
com.sun.jna.Pointer |
whisper_init(WhisperModelLoader loader)
Allocate (almost) all memory needed for the model using a model loader.
|
int |
whisper_is_multilingual(com.sun.jna.Pointer ctx) |
int |
whisper_lang_auto_detect_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
int offset_ms,
int n_threads,
float[] lang_probs) |
int |
whisper_lang_auto_detect(com.sun.jna.Pointer ctx,
int offset_ms,
int n_threads,
float[] lang_probs)
Use mel data at offset_ms to try and auto-detect the spoken language.
|
int |
whisper_lang_id(String lang) |
int |
whisper_lang_max_id()
Largest language id (i.e. number of available languages - 1)
|
String |
whisper_lang_str(int id) |
int |
whisper_model_ftype(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_audio_ctx(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_audio_head(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_audio_layer(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_audio_state(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_mels(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_text_ctx(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_text_head(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_text_layer(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_text_state(com.sun.jna.Pointer ctx) |
int |
whisper_model_n_vocab(com.sun.jna.Pointer ctx) |
String |
whisper_model_type_readable(com.sun.jna.Pointer ctx) |
int |
whisper_model_type(com.sun.jna.Pointer ctx) |
int |
whisper_n_audio_ctx(com.sun.jna.Pointer ctx) |
int |
whisper_n_len_from_state(com.sun.jna.Pointer state) |
int |
whisper_n_len(com.sun.jna.Pointer ctx) |
int |
whisper_n_text_ctx(com.sun.jna.Pointer ctx) |
int |
whisper_n_vocab(com.sun.jna.Pointer ctx) |
int |
whisper_pcm_to_mel_phase_vocoder_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] samples,
int n_samples,
int n_threads) |
int |
whisper_pcm_to_mel_phase_vocoder(com.sun.jna.Pointer ctx,
float[] samples,
int n_samples,
int n_threads)
Convert RAW PCM audio to log mel spectrogram but applies a Phase Vocoder to speed up the audio x2.
|
int |
whisper_pcm_to_mel_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] samples,
int n_samples,
int n_threads) |
int |
whisper_pcm_to_mel(com.sun.jna.Pointer ctx,
float[] samples,
int n_samples,
int n_threads)
Convert RAW PCM audio to log mel spectrogram.
|
String |
whisper_print_system_info() |
void |
whisper_print_timings(com.sun.jna.Pointer ctx) |
void |
whisper_reset_timings(com.sun.jna.Pointer ctx) |
int |
whisper_set_mel_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] data,
int n_len,
int n_mel) |
int |
whisper_set_mel(com.sun.jna.Pointer ctx,
float[] data,
int n_len,
int n_mel)
This can be used to set a custom log mel spectrogram inside the default state of the provided whisper context.
|
int |
whisper_token_beg(com.sun.jna.Pointer ctx) |
int |
whisper_token_eot(com.sun.jna.Pointer ctx) |
int |
whisper_token_lang(com.sun.jna.Pointer ctx,
int lang_id) |
int |
whisper_token_not(com.sun.jna.Pointer ctx) |
int |
whisper_token_prev(com.sun.jna.Pointer ctx) |
int |
whisper_token_solm(com.sun.jna.Pointer ctx) |
int |
whisper_token_sot(com.sun.jna.Pointer ctx) |
String |
whisper_token_to_str(com.sun.jna.Pointer ctx,
int token) |
int |
whisper_token_transcribe(com.sun.jna.Pointer ctx) |
int |
whisper_token_translate(com.sun.jna.Pointer ctx) |
int |
whisper_tokenize(com.sun.jna.Pointer ctx,
String text,
com.sun.jna.Pointer tokens,
int n_max_tokens)
Convert the provided text into tokens.
|
static final WhisperCppJnaLibrary instance
String whisper_print_system_info()
com.sun.jna.Pointer whisper_init_from_file(String path_model)
path_model - Path to the model filecom.sun.jna.Pointer whisper_init_from_buffer(com.sun.jna.Pointer buffer,
int buffer_size)
buffer - Model bufferbuffer_size - Size of the model buffercom.sun.jna.Pointer whisper_init(WhisperModelLoader loader)
loader - Model loadercom.sun.jna.Pointer whisper_init_from_file_no_state(String path_model)
path_model - Path to the model filecom.sun.jna.Pointer whisper_init_from_buffer_no_state(com.sun.jna.Pointer buffer,
int buffer_size)
buffer - Model bufferbuffer_size - Size of the model buffercom.sun.jna.Pointer whisper_init_no_state(WhisperModelLoader loader)
loader - Model loadercom.sun.jna.Pointer whisper_init_state(com.sun.jna.Pointer ctx)
ctx - Whisper contextvoid whisper_free(com.sun.jna.Pointer ctx)
ctx - Whisper contextvoid whisper_free_state(com.sun.jna.Pointer state)
state - Whisper stateint whisper_pcm_to_mel(com.sun.jna.Pointer ctx,
float[] samples,
int n_samples,
int n_threads)
ctx - - Pointer to a WhisperContextint whisper_pcm_to_mel_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] samples,
int n_samples,
int n_threads)
ctx - Pointer to a WhisperContextstate - Pointer to WhisperStaten_samples - n_threads - int whisper_set_mel(com.sun.jna.Pointer ctx,
float[] data,
int n_len,
int n_mel)
int whisper_set_mel_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] data,
int n_len,
int n_mel)
int whisper_encode(com.sun.jna.Pointer ctx,
int offset,
int n_threads)
int whisper_encode_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
int offset,
int n_threads)
int whisper_decode(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer tokens,
int n_tokens,
int n_past,
int n_threads)
int whisper_decode_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
com.sun.jna.Pointer tokens,
int n_tokens,
int n_past,
int n_threads)
ctx - state - tokens - Pointer to int tokensn_tokens - n_past - n_threads - int whisper_tokenize(com.sun.jna.Pointer ctx,
String text,
com.sun.jna.Pointer tokens,
int n_max_tokens)
int whisper_lang_max_id()
int whisper_lang_id(String lang)
String whisper_lang_str(int id)
int whisper_lang_auto_detect(com.sun.jna.Pointer ctx,
int offset_ms,
int n_threads,
float[] lang_probs)
int whisper_lang_auto_detect_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
int offset_ms,
int n_threads,
float[] lang_probs)
int whisper_n_len(com.sun.jna.Pointer ctx)
int whisper_n_len_from_state(com.sun.jna.Pointer state)
int whisper_n_vocab(com.sun.jna.Pointer ctx)
int whisper_n_text_ctx(com.sun.jna.Pointer ctx)
int whisper_n_audio_ctx(com.sun.jna.Pointer ctx)
int whisper_is_multilingual(com.sun.jna.Pointer ctx)
int whisper_model_n_vocab(com.sun.jna.Pointer ctx)
int whisper_model_n_audio_ctx(com.sun.jna.Pointer ctx)
int whisper_model_n_audio_state(com.sun.jna.Pointer ctx)
int whisper_model_n_audio_head(com.sun.jna.Pointer ctx)
int whisper_model_n_audio_layer(com.sun.jna.Pointer ctx)
int whisper_model_n_text_ctx(com.sun.jna.Pointer ctx)
int whisper_model_n_text_state(com.sun.jna.Pointer ctx)
int whisper_model_n_text_head(com.sun.jna.Pointer ctx)
int whisper_model_n_text_layer(com.sun.jna.Pointer ctx)
int whisper_model_n_mels(com.sun.jna.Pointer ctx)
int whisper_model_ftype(com.sun.jna.Pointer ctx)
int whisper_model_type(com.sun.jna.Pointer ctx)
float[] whisper_get_logits(com.sun.jna.Pointer ctx)
float[] whisper_get_logits_from_state(com.sun.jna.Pointer state)
String whisper_token_to_str(com.sun.jna.Pointer ctx, int token)
String whisper_model_type_readable(com.sun.jna.Pointer ctx)
int whisper_token_eot(com.sun.jna.Pointer ctx)
int whisper_token_sot(com.sun.jna.Pointer ctx)
int whisper_token_prev(com.sun.jna.Pointer ctx)
int whisper_token_solm(com.sun.jna.Pointer ctx)
int whisper_token_not(com.sun.jna.Pointer ctx)
int whisper_token_beg(com.sun.jna.Pointer ctx)
int whisper_token_lang(com.sun.jna.Pointer ctx,
int lang_id)
int whisper_token_translate(com.sun.jna.Pointer ctx)
int whisper_token_transcribe(com.sun.jna.Pointer ctx)
void whisper_print_timings(com.sun.jna.Pointer ctx)
void whisper_reset_timings(com.sun.jna.Pointer ctx)
com.sun.jna.Pointer whisper_full_default_params_by_ref(int strategy)
strategy - - WhisperSamplingStrategy.valuevoid whisper_free_params(com.sun.jna.Pointer params)
int whisper_full(com.sun.jna.Pointer ctx,
WhisperFullParams params,
float[] samples,
int n_samples)
int whisper_full_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
WhisperFullParams params,
float[] samples,
int n_samples)
int whisper_full_parallel(com.sun.jna.Pointer ctx,
WhisperFullParams params,
float[] samples,
int n_samples,
int n_processors)
int whisper_full_n_segments(com.sun.jna.Pointer ctx)
ctx - Pointer to WhisperContextint whisper_full_n_segments_from_state(com.sun.jna.Pointer state)
state - Pointer to WhisperStateint whisper_full_lang_id(com.sun.jna.Pointer ctx)
ctx - Pointer to WhisperContextint whisper_full_lang_id_from_state(com.sun.jna.Pointer state)
int whisper_pcm_to_mel_phase_vocoder(com.sun.jna.Pointer ctx,
float[] samples,
int n_samples,
int n_threads)
int whisper_pcm_to_mel_phase_vocoder_with_state(com.sun.jna.Pointer ctx,
com.sun.jna.Pointer state,
float[] samples,
int n_samples,
int n_threads)
long whisper_full_get_segment_t0(com.sun.jna.Pointer ctx,
int i_segment)
long whisper_full_get_segment_t0_from_state(com.sun.jna.Pointer state,
int i_segment)
long whisper_full_get_segment_t1(com.sun.jna.Pointer ctx,
int i_segment)
long whisper_full_get_segment_t1_from_state(com.sun.jna.Pointer state,
int i_segment)
String whisper_full_get_segment_text(com.sun.jna.Pointer ctx, int i_segment)
String whisper_full_get_segment_text_from_state(com.sun.jna.Pointer state, int i_segment)
int whisper_full_n_tokens(com.sun.jna.Pointer ctx,
int i_segment)
int whisper_full_n_tokens_from_state(com.sun.jna.Pointer state,
int i_segment)
String whisper_full_get_token_text(com.sun.jna.Pointer ctx, int i_segment, int i_token)
String whisper_full_get_token_text_from_state(com.sun.jna.Pointer ctx, com.sun.jna.Pointer state, int i_segment, int i_token)
int whisper_full_get_token_id(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
int whisper_full_get_token_id_from_state(com.sun.jna.Pointer state,
int i_segment,
int i_token)
WhisperTokenData whisper_full_get_token_data(com.sun.jna.Pointer ctx, int i_segment, int i_token)
WhisperTokenData whisper_full_get_token_data_from_state(com.sun.jna.Pointer state, int i_segment, int i_token)
float whisper_full_get_token_p(com.sun.jna.Pointer ctx,
int i_segment,
int i_token)
float whisper_full_get_token_p_from_state(com.sun.jna.Pointer state,
int i_segment,
int i_token)
int whisper_bench_memcpy(int nThreads)
nThreads - Number of threads to use for the benchmark.String whisper_bench_memcpy_str(int nThreads)
nThreads - Number of threads to use for the benchmark.int whisper_bench_ggml_mul_mat(int nThreads)
nThreads - Number of threads to use for the benchmark.String whisper_bench_ggml_mul_mat_str(int nThreads)
nThreads - Number of threads to use for the benchmark.Copyright © 2023. All rights reserved.