Skip to content

Commit 6c8a003

Browse files
committed
whisper : add comment about the KV cache size
1 parent ae1bd69 commit 6c8a003

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

whisper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,8 +3040,9 @@ struct whisper_state * whisper_init_state(whisper_context * ctx) {
30403040

30413041
state->backend = whisper_backend_init(ctx->params);
30423042

3043-
// TODO: determine how large the cache should be
3044-
const int factor = 2;
3043+
// at this point, we don't know yet how many decoders will be used, so we overallocate 3x ctx
3044+
// in theory, there can be a case where this is not enough, but in practice it should always be enough
3045+
const int factor = 3;
30453046

30463047
if (!kv_cache_init(ctx->model.hparams, state->kv_self, ctx->backend, ctx->itype, factor*ctx->model.hparams.n_text_ctx)) {
30473048
WHISPER_LOG_ERROR("%s: kv_cache_init() failed for self-attention cache\n", __func__);

0 commit comments

Comments
 (0)