From cc547cdb380c8e5460f14724f5fd056853cd2a6c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 28 Mar 2023 10:36:16 +0300 Subject: [PATCH] whisper : increase scratch buffers after recent change (#671) Should fix the error: ggml_new_tensor_impl: not enough space in the scratch memory --- whisper.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/whisper.cpp b/whisper.cpp index ff862a0e6d4..1728debcc23 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -218,14 +218,14 @@ static const std::map> g_lang = { { "su", { 98, "sundanese", } }, }; -static const size_t MB = 1024*1024; +static const size_t MB = 1ull*1024*1024; static const std::map MEM_REQ_SCRATCH0 = { - { MODEL_TINY, 12ull*MB }, - { MODEL_BASE, 15ull*MB }, - { MODEL_SMALL, 23ull*MB }, - { MODEL_MEDIUM, 31ull*MB }, - { MODEL_LARGE, 38ull*MB }, + { MODEL_TINY, 14ull*MB }, + { MODEL_BASE, 18ull*MB }, + { MODEL_SMALL, 28ull*MB }, + { MODEL_MEDIUM, 36ull*MB }, + { MODEL_LARGE, 42ull*MB }, }; static const std::map MEM_REQ_SCRATCH1 = { @@ -1743,10 +1743,10 @@ static bool whisper_encode_internal( //printf("%s: used_mem = %f MB, %f MB, %f MB %f MB %f MB\n", __func__, // ggml_used_mem(ctx0)/1024.0/1024.0, - // wctx.get_buf_max_mem(0)/1024.0/1024.0, - // wctx.get_buf_max_mem(1)/1024.0/1024.0, - // wctx.get_buf_max_mem(2)/1024.0/1024.0, - // wctx.get_buf_max_mem(3)/1024.0/1024.0); + // wstate.get_buf_max_mem(0)/1024.0/1024.0, + // wstate.get_buf_max_mem(1)/1024.0/1024.0, + // wstate.get_buf_max_mem(2)/1024.0/1024.0, + // wstate.get_buf_max_mem(3)/1024.0/1024.0); ggml_free(ctx0); @@ -2153,10 +2153,10 @@ static bool whisper_decode_internal( if (N > 1) { //printf("%s: used_mem = %f MB, %f MB, %f MB %f MB %f MB\n", __func__, // ggml_used_mem(ctx0)/1024.0/1024.0, - // wctx.get_buf_max_mem(0)/1024.0/1024.0, - // wctx.get_buf_max_mem(1)/1024.0/1024.0, - // wctx.get_buf_max_mem(2)/1024.0/1024.0, - // wctx.get_buf_max_mem(3)/1024.0/1024.0); + // wstate.get_buf_max_mem(0)/1024.0/1024.0, + // wstate.get_buf_max_mem(1)/1024.0/1024.0, + // wstate.get_buf_max_mem(2)/1024.0/1024.0, + // wstate.get_buf_max_mem(3)/1024.0/1024.0); } ggml_free(ctx0);