Skip to content

Commit

Permalink
whisper : fix support for larger graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Nov 3, 2023
1 parent 36f375b commit 0a7eba8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static void byteswap_tensor(ggml_tensor * tensor) {
//#define WHISPER_USE_FLASH_ATTN
//#define WHISPER_USE_FLASH_FF
#define WHISPER_MAX_DECODERS 16
#define WHISPER_MAX_NODES 4096

//
// ggml helpers
Expand Down Expand Up @@ -663,7 +664,7 @@ static void whisper_allocr_graph_init(struct whisper_allocr & allocr, std::funct
auto & meta = allocr.meta;
auto & data = allocr.data;

meta.resize(ggml_tensor_overhead()*GGML_DEFAULT_GRAPH_SIZE + ggml_graph_overhead());
meta.resize(ggml_tensor_overhead()*WHISPER_MAX_NODES + ggml_graph_overhead());

alloc = ggml_allocr_new_measure(tensor_alignment);

Expand Down Expand Up @@ -1616,7 +1617,7 @@ static struct ggml_cgraph * whisper_build_graph_encoder(

struct ggml_context * ctx0 = ggml_init(params);

ggml_cgraph * gf = ggml_new_graph(ctx0);
ggml_cgraph * gf = ggml_new_graph_custom(ctx0, WHISPER_MAX_NODES, false);

ggml_allocr * alloc = wstate.alloc_encode.alloc;

Expand Down Expand Up @@ -2034,7 +2035,7 @@ static struct ggml_cgraph * whisper_build_graph_decoder(

struct ggml_context * ctx0 = ggml_init(params);

ggml_cgraph * gf = ggml_new_graph(ctx0);
ggml_cgraph * gf = ggml_new_graph_custom(ctx0, WHISPER_MAX_NODES, false);

ggml_allocr * alloc = wstate.alloc_decode.alloc;

Expand Down

0 comments on commit 0a7eba8

Please sign in to comment.