Skip to content

Commit

Permalink
node : support no timestamps (ggerganov#2048)
Browse files Browse the repository at this point in the history
* fix: node: do not compute timestamps if you do not need them

* feat: add no_timestamps parameter to node addon
  • Loading branch information
pprobst committed Apr 15, 2024
1 parent af32b07 commit 2faea9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/addon.node/addon.cpp
Expand Up @@ -211,6 +211,8 @@ int run(whisper_params &params, std::vector<std::vector<std::string>> &result) {

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

wparams.no_timestamps = params.no_timestamps;

whisper_print_user_data user_data = { &params, &pcmf32s };

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

params.language = language;
params.model = model;
params.fname_inp.emplace_back(input);
params.use_gpu = use_gpu;
params.no_timestamps = no_timestamps;

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

0 comments on commit 2faea9f

Please sign in to comment.