mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add more logging to whispercpp
This commit is contained in:
parent
a4bf434ff8
commit
63016fd067
@ -26,6 +26,7 @@ static jlong WhisperGGML_open(JNIEnv *env, jclass clazz, jstring model_dir) {
|
||||
|
||||
auto *state = new WhisperModelState();
|
||||
|
||||
AKLOGI("Attempting to load model from file...");
|
||||
state->context = whisper_init_from_file_with_params(model_dir_str.c_str(), { .use_gpu = false });
|
||||
|
||||
if(!state->context){
|
||||
@ -43,6 +44,7 @@ static jlong WhisperGGML_openFromBuffer(JNIEnv *env, jclass clazz, jobject buffe
|
||||
|
||||
auto *state = new WhisperModelState();
|
||||
|
||||
AKLOGI("Attempting to load model from buffer...");
|
||||
state->context = whisper_init_from_buffer_with_params(buffer_address, buffer_capacity, { .use_gpu = false });
|
||||
|
||||
if(!state->context){
|
||||
@ -55,6 +57,8 @@ static jlong WhisperGGML_openFromBuffer(JNIEnv *env, jclass clazz, jobject buffe
|
||||
}
|
||||
|
||||
static jstring WhisperGGML_infer(JNIEnv *env, jobject instance, jlong handle, jfloatArray samples_array, jstring prompt, jobjectArray languages, jobjectArray bail_languages, jint decoding_mode, jboolean suppress_non_speech_tokens) {
|
||||
AKLOGI("Attempting to infer model...");
|
||||
|
||||
auto *state = reinterpret_cast<WhisperModelState *>(handle);
|
||||
state->cancel_flag = 0;
|
||||
|
||||
|
@ -126,8 +126,8 @@ WHISPER_ATTRIBUTE_FORMAT(2, 3)
|
||||
static void whisper_log_internal (ggml_log_level level, const char * format, ...);
|
||||
static void whisper_log_callback_default(ggml_log_level level, const char * text, void * user_data);
|
||||
|
||||
#define WHISPER_LOG_INFO(...) whisper_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
|
||||
#define WHISPER_LOG_WARN(...) whisper_log_internal(GGML_LOG_LEVEL_WARN , __VA_ARGS__)
|
||||
#define WHISPER_LOG_INFO(...) AKLOGI(__VA_ARGS__) // whisper_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
|
||||
#define WHISPER_LOG_WARN(...) AKLOGI(__VA_ARGS__) // whisper_log_internal(GGML_LOG_LEVEL_WARN , __VA_ARGS__)
|
||||
#define WHISPER_LOG_ERROR(...) AKLOGE(__VA_ARGS__) // whisper_log_internal(GGML_LOG_LEVEL_ERROR, __VA_ARGS__)
|
||||
|
||||
#define WHISPER_ASSERT(x) \
|
||||
@ -3339,11 +3339,13 @@ struct whisper_context * whisper_init_from_file_with_params(const char * path_mo
|
||||
struct whisper_context * whisper_init_from_buffer_with_params(void * buffer, size_t buffer_size, struct whisper_context_params params) {
|
||||
whisper_context * ctx = whisper_init_from_buffer_with_params_no_state(buffer, buffer_size, params);
|
||||
if (!ctx) {
|
||||
WHISPER_LOG_ERROR("%s: received null context", __func__);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ctx->state = whisper_init_state(ctx);
|
||||
if (!ctx->state) {
|
||||
WHISPER_LOG_ERROR("%s: received null state", __func__);
|
||||
whisper_free(ctx);
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user