@@ -39,6 +39,7 @@ struct whisper_params {
39
39
bool no_timestamps = false ;
40
40
bool no_prints = false ;
41
41
bool use_gpu = true ;
42
+ bool flash_attn = false ;
42
43
bool comma_in_time = true ;
43
44
44
45
std::string language = " en" ;
@@ -146,6 +147,7 @@ int run(whisper_params ¶ms, std::vector<std::vector<std::string>> &result) {
146
147
147
148
struct whisper_context_params cparams = whisper_context_default_params ();
148
149
cparams.use_gpu = params.use_gpu ;
150
+ cparams.flash_attn = params.flash_attn ;
149
151
struct whisper_context * ctx = whisper_init_from_file_with_params (params.model .c_str (), cparams);
150
152
151
153
if (ctx == nullptr ) {
@@ -326,6 +328,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
326
328
std::string model = whisper_params.Get (" model" ).As <Napi::String>();
327
329
std::string input = whisper_params.Get (" fname_inp" ).As <Napi::String>();
328
330
bool use_gpu = whisper_params.Get (" use_gpu" ).As <Napi::Boolean >();
331
+ bool flash_attn = whisper_params.Get (" flash_attn" ).As <Napi::Boolean >();
329
332
bool no_prints = whisper_params.Get (" no_prints" ).As <Napi::Boolean >();
330
333
bool no_timestamps = whisper_params.Get (" no_timestamps" ).As <Napi::Boolean >();
331
334
int32_t audio_ctx = whisper_params.Get (" audio_ctx" ).As <Napi::Number>();
@@ -346,6 +349,7 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
346
349
params.model = model;
347
350
params.fname_inp .emplace_back (input);
348
351
params.use_gpu = use_gpu;
352
+ params.flash_attn = flash_attn;
349
353
params.no_prints = no_prints;
350
354
params.no_timestamps = no_timestamps;
351
355
params.audio_ctx = audio_ctx;
0 commit comments