Skip to content

Commit 2c717ea

Browse files
ggerganoviThalay
authored andcommitted
whisper : increase scratch buffers after recent change (ggml-org#671)
Should fix the error: ggml_new_tensor_impl: not enough space in the scratch memory
1 parent 15db7cc commit 2c717ea

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

whisper.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ static const std::map<std::string, std::pair<int, std::string>> g_lang = {
218218
{ "su", { 98, "sundanese", } },
219219
};
220220

221-
static const size_t MB = 1024*1024;
221+
static const size_t MB = 1ull*1024*1024;
222222

223223
static const std::map<e_model, size_t> MEM_REQ_SCRATCH0 = {
224-
{ MODEL_TINY, 12ull*MB },
225-
{ MODEL_BASE, 15ull*MB },
226-
{ MODEL_SMALL, 23ull*MB },
227-
{ MODEL_MEDIUM, 31ull*MB },
228-
{ MODEL_LARGE, 38ull*MB },
224+
{ MODEL_TINY, 14ull*MB },
225+
{ MODEL_BASE, 18ull*MB },
226+
{ MODEL_SMALL, 28ull*MB },
227+
{ MODEL_MEDIUM, 36ull*MB },
228+
{ MODEL_LARGE, 42ull*MB },
229229
};
230230

231231
static const std::map<e_model, size_t> MEM_REQ_SCRATCH1 = {
@@ -1743,10 +1743,10 @@ static bool whisper_encode_internal(
17431743

17441744
//printf("%s: used_mem = %f MB, %f MB, %f MB %f MB %f MB\n", __func__,
17451745
// ggml_used_mem(ctx0)/1024.0/1024.0,
1746-
// wctx.get_buf_max_mem(0)/1024.0/1024.0,
1747-
// wctx.get_buf_max_mem(1)/1024.0/1024.0,
1748-
// wctx.get_buf_max_mem(2)/1024.0/1024.0,
1749-
// wctx.get_buf_max_mem(3)/1024.0/1024.0);
1746+
// wstate.get_buf_max_mem(0)/1024.0/1024.0,
1747+
// wstate.get_buf_max_mem(1)/1024.0/1024.0,
1748+
// wstate.get_buf_max_mem(2)/1024.0/1024.0,
1749+
// wstate.get_buf_max_mem(3)/1024.0/1024.0);
17501750

17511751
ggml_free(ctx0);
17521752

@@ -2153,10 +2153,10 @@ static bool whisper_decode_internal(
21532153
if (N > 1) {
21542154
//printf("%s: used_mem = %f MB, %f MB, %f MB %f MB %f MB\n", __func__,
21552155
// ggml_used_mem(ctx0)/1024.0/1024.0,
2156-
// wctx.get_buf_max_mem(0)/1024.0/1024.0,
2157-
// wctx.get_buf_max_mem(1)/1024.0/1024.0,
2158-
// wctx.get_buf_max_mem(2)/1024.0/1024.0,
2159-
// wctx.get_buf_max_mem(3)/1024.0/1024.0);
2156+
// wstate.get_buf_max_mem(0)/1024.0/1024.0,
2157+
// wstate.get_buf_max_mem(1)/1024.0/1024.0,
2158+
// wstate.get_buf_max_mem(2)/1024.0/1024.0,
2159+
// wstate.get_buf_max_mem(3)/1024.0/1024.0);
21602160
}
21612161

21622162
ggml_free(ctx0);

0 commit comments

Comments
 (0)