whisper.cpp/examples/addon.node
Jhen-Jie Hong 0463028bc2
whisper : add context param to disable gpu (#1293)
* whisper : check state->ctx_metal not null

* whisper : add whisper_context_params { use_gpu }

* whisper : new API with params & deprecate old API

* examples : use no-gpu param && whisper_init_from_file_with_params

* whisper.objc : enable metal & disable on simulator

* whisper.swiftui, metal : enable metal & support load default.metallib

* whisper.android : use new API

* bindings : use new API

* addon.node : fix build & test

* bindings : updata java binding

* bindings : add missing whisper_context_default_params_by_ref WHISPER_API for java

* metal : use SWIFTPM_MODULE_BUNDLE for GGML_SWIFT and reuse library load

* metal : move bundle var into block

* metal : use SWIFT_PACKAGE instead of GGML_SWIFT

* style : minor updates

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-11-06 11:04:24 +02:00
..
__test__ whisper : add context param to disable gpu (#1293) 2023-11-06 11:04:24 +02:00
.gitignore addon.node : using whisper as a Node.js addon (#443) 2023-02-04 09:10:25 +02:00
addon.cpp whisper : add context param to disable gpu (#1293) 2023-11-06 11:04:24 +02:00
CMakeLists.txt examples : refactor in order to reuse code and reduce duplication (#482) 2023-02-15 19:28:10 +02:00
index.js whisper : add context param to disable gpu (#1293) 2023-11-06 11:04:24 +02:00
package.json ci : add node addon test and optimize compilation configuration (#468) 2023-02-05 15:02:08 +02:00
README.md ci : add node addon test and optimize compilation configuration (#468) 2023-02-05 15:02:08 +02:00

addon

This is an addon demo that can perform whisper model reasoning in node and electron environments, based on cmake-js. It can be used as a reference for using the whisper.cpp project in other node projects.

Install

npm install

Compile

Make sure it is in the project root directory and compiled with make-js.

npx cmake-js compile -T whisper-addon -B Release

For Electron addon and cmake-js options, you can see cmake-js and make very few configuration changes.

Such as appointing special cmake path:

npx cmake-js compile -c 'xxx/cmake' -T whisper-addon -B Release

Run

cd examples/addon.node

node index.js --language='language' --model='model-path' --fname_inp='file-path'

Because this is a simple Demo, only the above parameters are set in the node environment.

Other parameters can also be specified in the node environment.