Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node : fix compilation #2115

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: npm install

- name: Compile addon.node
run: npx cmake-js compile -T whisper-addon -B Release
run: npx cmake-js compile -T addon.node -B Release

- name: Download test model
run: |
Expand Down
2 changes: 1 addition & 1 deletion examples/addon.node/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(TARGET whisper-addon)
set(TARGET addon.node)

# Base settings
#==================================================================
Expand Down
4 changes: 2 additions & 2 deletions examples/addon.node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ npm install
Make sure it is in the project root directory and compiled with make-js.

```shell
npx cmake-js compile -T whisper-addon -B Release
npx cmake-js compile -T addon.node -B Release
```

For Electron addon and cmake-js options, you can see [cmake-js](https://github.com/cmake-js/cmake-js) and make very few configuration changes.

> Such as appointing special cmake path:
> ```shell
> npx cmake-js compile -c 'xxx/cmake' -T whisper-addon -B Release
> npx cmake-js compile -c 'xxx/cmake' -T addon.node -B Release
> ```

## Run
Expand Down
3 changes: 2 additions & 1 deletion examples/addon.node/__test__/whisper.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require("path");
const { whisper } = require(path.join(
__dirname,
"../../../build/Release/whisper-addon"
"../../../build/Release/addon.node"
));
const { promisify } = require("util");

Expand All @@ -12,6 +12,7 @@ const whisperParamsMock = {
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
use_gpu: true,
no_timestamps: false,
};

describe("Run whisper.node", () => {
Expand Down
3 changes: 2 additions & 1 deletion examples/addon.node/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require("path");
const { whisper } = require(path.join(
__dirname,
"../../build/Release/whisper-addon"
"../../build/Release/addon.node"
));
const { promisify } = require("util");

Expand All @@ -12,6 +12,7 @@ const whisperParams = {
model: path.join(__dirname, "../../models/ggml-base.en.bin"),
fname_inp: "../../samples/jfk.wav",
use_gpu: true,
no_timestamps: false,
};

const arguments = process.argv.slice(2);
Expand Down
2 changes: 1 addition & 1 deletion examples/addon.node/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "whisper-addon",
"name": "addon.node",
"version": "0.0.0",
"description": "",
"main": "index.js",
Expand Down