Skip to content

Commit

Permalink
whisper : increase scratch buffers after recent change (ggerganov#671)
Browse files Browse the repository at this point in the history
Should fix the error:

ggml_new_tensor_impl: not enough space in the scratch memory
  • Loading branch information
ggerganov committed Mar 28, 2023
1 parent 51aee08 commit cc547cd
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ static const std::map<std::string, std::pair<int, std::string>> g_lang = {
{ "su", { 98, "sundanese", } },
};

static const size_t MB = 1024*1024;
static const size_t MB = 1ull*1024*1024;

static const std::map<e_model, size_t> 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<e_model, size_t> MEM_REQ_SCRATCH1 = {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cc547cd

Please sign in to comment.