forked from ggerganov/whisper.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci : add node addon test and optimize compilation configuration (gger…
…ganov#468) * addon: implement node addon call whisper through cpp * addon: modify the license to MIT * addon: remove iostream * addon: rename dir * addon: fix typo * addon: configure cmake to build when cmake-js is used * ci: add addon.node test ci * addon: remove build WHISPER_BUILD_TESTS * addon: update build command * addon: add test * addon: add test file * addon: adapt to compile on Windows * addon: fix typo * addon: reuse jfk.wav Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> * addon: reuse jfk.wav --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
- Loading branch information
Showing
7 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Examples Tests | ||
on: | ||
push: | ||
paths: | ||
- examples/addon.node/** | ||
- whisper.h | ||
pull_request: | ||
paths: | ||
- examples/addon.node/** | ||
- whisper.h | ||
|
||
jobs: | ||
addon_node-ubuntu-latest: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [ 16.x, 18.x ] | ||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install build-essential | ||
sudo apt-get install cmake | ||
sudo apt-get install libsdl2-dev | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
|
||
- name: Install package.json dependencies | ||
working-directory: ./examples/addon.node | ||
run: npm install | ||
|
||
- name: Compile addon.node | ||
run: npx cmake-js compile -T whisper-addon -B Release | ||
|
||
- name: Download test model | ||
run: | | ||
bash ./models/download-ggml-model.sh base.en | ||
- name: Test | ||
run: | | ||
cd examples/addon.node | ||
npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require('path'); | ||
const { whisper } = require(path.join(__dirname, '../../../build/Release/whisper-addon')); | ||
|
||
const whisperParamsMock = { | ||
language: 'en', | ||
model: path.join(__dirname, '../../../models/ggml-base.en.bin'), | ||
fname_inp: path.join(__dirname, '../../../samples/jfk.wav'), | ||
}; | ||
|
||
describe("Run whisper.node", () => { | ||
|
||
test("it should receive a non-empty value", () => { | ||
expect(whisper(whisperParamsMock).length).toBeGreaterThan(0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters