From 4845b9ed09543e3184ec966e57d9540743d48da4 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 11 Sep 2023 15:19:21 +0300 Subject: [PATCH] whisper.android : try to fix build --- .../whisper.android/app/src/main/jni/whisper/CMakeLists.txt | 3 ++- whisper.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/whisper.android/app/src/main/jni/whisper/CMakeLists.txt b/examples/whisper.android/app/src/main/jni/whisper/CMakeLists.txt index 55a47253..eac718ac 100644 --- a/examples/whisper.android/app/src/main/jni/whisper/CMakeLists.txt +++ b/examples/whisper.android/app/src/main/jni/whisper/CMakeLists.txt @@ -8,6 +8,7 @@ set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../) set( SOURCE_FILES ${WHISPER_LIB_DIR}/ggml.c + ${WHISPER_LIB_DIR}/ggml-alloc.c ${WHISPER_LIB_DIR}/whisper.cpp ${CMAKE_SOURCE_DIR}/jni.c ) @@ -20,7 +21,7 @@ function(build_library target_name) SHARED ${SOURCE_FILES} ) - + target_link_libraries(${target_name} ${LOG_LIB} android) if (${target_name} STREQUAL "whisper_v8fp16_va") diff --git a/whisper.cpp b/whisper.cpp index 10980cfd..1fe17245 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2843,6 +2843,7 @@ struct whisper_state * whisper_init_state(whisper_context * ctx) { ggml_cgraph * gf = whisper_build_graph_decoder(*ctx, *state, state->decoders[0], NULL, n_tokens, n_past); const size_t alloc_size = ggml_allocr_alloc_graph(alloc, gf) + tensor_alignment; + ggml_allocr_free(alloc); log("%s: compute buffer (decode) = %7.2f MB\n", __func__, (meta.size() + alloc_size) / 1024.0 / 1024.0);