Skip to content

Commit 1b5439a

Browse files
authored
node : support no timestamps (ggml-org#2048)
* fix: node: do not compute timestamps if you do not need them * feat: add no_timestamps parameter to node addon
1 parent c7f95b7 commit 1b5439a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/addon.node/addon.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ int run(whisper_params &params, std::vector<std::vector<std::string>> &result) {
211211

212212
wparams.initial_prompt = params.prompt.c_str();
213213

214+
wparams.no_timestamps = params.no_timestamps;
215+
214216
whisper_print_user_data user_data = { &params, &pcmf32s };
215217

216218
// this callback is called on each new segment
@@ -298,11 +300,13 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
298300
std::string model = whisper_params.Get("model").As<Napi::String>();
299301
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
300302
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
303+
bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
301304

302305
params.language = language;
303306
params.model = model;
304307
params.fname_inp.emplace_back(input);
305308
params.use_gpu = use_gpu;
309+
params.no_timestamps = no_timestamps;
306310

307311
Napi::Function callback = info[1].As<Napi::Function>();
308312
Worker* worker = new Worker(callback, params);

0 commit comments

Comments
 (0)