From 9e448d03bc99037e68183d64691294c38eb05845 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Wed, 17 Jul 2024 12:33:15 +0800 Subject: [PATCH] Provide npm package for 32-bit Windows x86 (#1141) --- .github/scripts/node-addon/package.json | 3 +- .github/scripts/node-addon/run.sh | 9 +- .github/scripts/test-nodejs-addon-npm.sh | 138 ++++++++------ .github/workflows/npm-addon-linux-x64.yaml | 6 + .github/workflows/npm-addon-macos.yaml | 6 + .github/workflows/npm-addon-win-x64.yaml | 11 +- .github/workflows/npm-addon-win-x86.yaml | 176 ++++++++++++++++++ .github/workflows/npm-addon.yaml | 8 +- .../test-nodejs-addon-npm-win-x86.yaml | 86 +++++++++ nodejs-addon-examples/package.json | 2 +- scripts/node-addon-api/src/audio-tagging.cc | 2 +- .../src/speaker-identification.cc | 2 +- 12 files changed, 383 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/npm-addon-win-x86.yaml create mode 100644 .github/workflows/test-nodejs-addon-npm-win-x86.yaml diff --git a/.github/scripts/node-addon/package.json b/.github/scripts/node-addon/package.json index 8980320de..0444552fc 100644 --- a/.github/scripts/node-addon/package.json +++ b/.github/scripts/node-addon/package.json @@ -49,6 +49,7 @@ "sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION", "sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION", "sherpa-onnx-linux-arm64": "^SHERPA_ONNX_VERSION", - "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION" + "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION", + "sherpa-onnx-win-ia32": "^SHERPA_ONNX_VERSION" } } diff --git a/.github/scripts/node-addon/run.sh b/.github/scripts/node-addon/run.sh index 0adf240f4..71c716040 100755 --- a/.github/scripts/node-addon/run.sh +++ b/.github/scripts/node-addon/run.sh @@ -9,16 +9,23 @@ platform=$(node -p "require('os').platform()") arch=$(node -p "require('os').arch()") +echo "platform: $platform" +echo "arch: $arch" + +# ia32 for win x86 + platform2=$platform + if [[ $platform == win32 ]]; then platform2=win fi + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" -# SHERPA_ONNX_VERSION=1.0.28 +# SHERPA_ONNX_VERSION=1.0.31 if [ -z $owner ]; then owner=k2-fsa diff --git a/.github/scripts/test-nodejs-addon-npm.sh b/.github/scripts/test-nodejs-addon-npm.sh index 853f282d4..6cced13bb 100755 --- a/.github/scripts/test-nodejs-addon-npm.sh +++ b/.github/scripts/test-nodejs-addon-npm.sh @@ -6,6 +6,66 @@ d=nodejs-addon-examples echo "dir: $d" cd $d +arch=$(node -p "require('os').arch()") +platform=$(node -p "require('os').platform()") +node_version=$(node -p "process.versions.node.split('.')[0]") + +echo "----------asr----------" + +if [[ $arch != "ia32" && $platform != "win32" ]]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 + tar xvf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 + rm sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 + + node ./test_asr_non_streaming_nemo_ctc.js + rm -rf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k + + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 + tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 + rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 + + node ./test_asr_non_streaming_paraformer.js + + rm -f itn* + + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav + + node ./test_asr_non_streaming_paraformer_itn.js + + rm -rf sherpa-onnx-paraformer-zh-2023-09-14 +fi + +echo "----------tts----------" + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_GB-cori-medium.tar.bz2 +tar xf vits-piper-en_GB-cori-medium.tar.bz2 +rm vits-piper-en_GB-cori-medium.tar.bz2 + +node ./test_tts_non_streaming_vits_piper_en.js +rm -rf vits-piper-en_GB-cori-medium + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-coqui-de-css10.tar.bz2 +tar xvf vits-coqui-de-css10.tar.bz2 +rm vits-coqui-de-css10.tar.bz2 + +node ./test_tts_non_streaming_vits_coqui_de.js +rm -rf vits-coqui-de-css10 + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2 +tar xvf sherpa-onnx-vits-zh-ll.tar.bz2 +rm sherpa-onnx-vits-zh-ll.tar.bz2 + +node ./test_tts_non_streaming_vits_zh_ll.js +rm -rf sherpa-onnx-vits-zh-ll + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 +tar xvf vits-icefall-zh-aishell3.tar.bz2 +rm vits-icefall-zh-aishell3.tar.bz2 + +node ./test_tts_non_streaming_vits_zh_aishell3.js +rm -rf vits-icefall-zh-aishell3 + echo "----------keyword spotting----------" curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 @@ -15,14 +75,23 @@ rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 node ./test_keyword_spotter_transducer.js rm -rf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 -echo "----------add punctuations----------" +if [[ $arch != "ia32" && $platform != "win32" && $node_version != 21 ]]; then + # The punctuation model is so large that it cause memory allocation failure on windows x86 + # 2024-07-17 03:24:34.2388391 [E:onnxruntime:, inference_session.cc:1981 + # onnxruntime::InferenceSession::Initialize::::operator ()] + # Exception during initialization: bad allocation + # Error: Process completed with exit code 127. + # + # Node 21 does not have such an issue + echo "----------add punctuations----------" -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 -tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 -rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 + tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 + rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 -node ./test_punctuation.js -rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 + node ./test_punctuation.js + rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 +fi echo "----------audio tagging----------" @@ -75,9 +144,10 @@ rm -f itn* curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav -node test_asr_streaming_transducer_itn.js - -node test_asr_streaming_transducer.js +if [[ $arch != "ia32" && $platform != "win32" ]]; then + node test_asr_streaming_transducer_itn.js + node test_asr_streaming_transducer.js +fi rm -rf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 @@ -114,56 +184,6 @@ rm sherpa-onnx-whisper-tiny.en.tar.bz2 node ./test_asr_non_streaming_whisper.js rm -rf sherpa-onnx-whisper-tiny.en -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 -tar xvf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 -rm sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 - -node ./test_asr_non_streaming_nemo_ctc.js -rm -rf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 -tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 -rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 - -node ./test_asr_non_streaming_paraformer.js - -rm -f itn* - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav - -node ./test_asr_non_streaming_paraformer_itn.js -rm -rf sherpa-onnx-paraformer-zh-2023-09-14 - -echo "----------tts----------" - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_GB-cori-medium.tar.bz2 -tar xvf vits-piper-en_GB-cori-medium.tar.bz2 -rm vits-piper-en_GB-cori-medium.tar.bz2 - -node ./test_tts_non_streaming_vits_piper_en.js -rm -rf vits-piper-en_GB-cori-medium - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-coqui-de-css10.tar.bz2 -tar xvf vits-coqui-de-css10.tar.bz2 -rm vits-coqui-de-css10.tar.bz2 - -node ./test_tts_non_streaming_vits_coqui_de.js -rm -rf vits-coqui-de-css10 - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2 -tar xvf sherpa-onnx-vits-zh-ll.tar.bz2 -rm sherpa-onnx-vits-zh-ll.tar.bz2 - -node ./test_tts_non_streaming_vits_zh_ll.js -rm -rf sherpa-onnx-vits-zh-ll - -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 -tar xvf vits-icefall-zh-aishell3.tar.bz2 -rm vits-icefall-zh-aishell3.tar.bz2 - -node ./test_tts_non_streaming_vits_zh_aishell3.js -rm -rf vits-icefall-zh-aishell3 ls -lh diff --git a/.github/workflows/npm-addon-linux-x64.yaml b/.github/workflows/npm-addon-linux-x64.yaml index b60853b04..3308c7c57 100644 --- a/.github/workflows/npm-addon-linux-x64.yaml +++ b/.github/workflows/npm-addon-linux-x64.yaml @@ -108,6 +108,12 @@ jobs: shell: bash run: | ls -lh ./sherpa-onnx-node + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node + + - uses: actions/upload-artifact@v4 + with: + name: sherpa-onnx-linux-x64 + path: ./sherpa-onnx-node.tar.bz2 - name: Publish shell: bash diff --git a/.github/workflows/npm-addon-macos.yaml b/.github/workflows/npm-addon-macos.yaml index eb3ded547..2cf6304e6 100644 --- a/.github/workflows/npm-addon-macos.yaml +++ b/.github/workflows/npm-addon-macos.yaml @@ -102,6 +102,12 @@ jobs: shell: bash run: | ls -lh ./sherpa-onnx-node + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node + + - uses: actions/upload-artifact@v4 + with: + name: sherpa-onnx-${{ matrix.os }} + path: ./sherpa-onnx-node.tar.bz2 - name: Publish shell: bash diff --git a/.github/workflows/npm-addon-win-x64.yaml b/.github/workflows/npm-addon-win-x64.yaml index 53c0cfd77..d9150b231 100644 --- a/.github/workflows/npm-addon-win-x64.yaml +++ b/.github/workflows/npm-addon-win-x64.yaml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest] + os: [windows-2019] python-version: ["3.8"] steps: @@ -54,6 +54,8 @@ jobs: -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ -DSHERPA_ONNX_ENABLE_BINARY=OFF \ + -DBUILD_ESPEAK_NG_EXE=OFF \ + -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \ .. ls -lh _deps/onnxruntime-src/lib/ @@ -65,6 +67,7 @@ jobs: echo "----------" cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib + cp -v _deps/onnxruntime-src/lib/*.dll ./install/lib echo "----------" @@ -100,6 +103,12 @@ jobs: shell: bash run: | ls -lh ./sherpa-onnx-node + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node + + - uses: actions/upload-artifact@v4 + with: + name: sherpa-onnx-win-x64 + path: ./sherpa-onnx-node.tar.bz2 - name: Publish shell: bash diff --git a/.github/workflows/npm-addon-win-x86.yaml b/.github/workflows/npm-addon-win-x86.yaml new file mode 100644 index 000000000..bf0983414 --- /dev/null +++ b/.github/workflows/npm-addon-win-x86.yaml @@ -0,0 +1,176 @@ +name: npm-addon-win-x86 + +on: + push: + branches: + - node-addon + workflow_dispatch: + +concurrency: + group: npm-addon-win-x86-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2019] + python-version: ["3.8"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + architecture: 'x86' + node-version: 16 + + - name: Display node version + shell: bash + run: | + node --version + + - name: Show node-addon + shell: bash + run: | + cd scripts/node-addon-api/ + + npm i || true + cat node_modules/node-addon-api/package.json + cd node_modules/ + tar cjf node-addon-api.tar.bz2 ./node-addon-api + + - uses: actions/upload-artifact@v4 + with: + name: node-addon-api + path: ./scripts/node-addon-api/node_modules/node-addon-api.tar.bz2 + + - name: Build sherpa-onnx + shell: bash + run: | + mkdir build + cd build + cmake \ + -A Win32 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=./install \ + -DBUILD_SHARED_LIBS=ON \ + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ + -DSHERPA_ONNX_ENABLE_BINARY=OFF \ + -DBUILD_ESPEAK_NG_EXE=OFF \ + -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \ + .. + + ls -lh _deps/onnxruntime-src/lib/ + + cmake --build . --config Release --target install -- -m:6 + + ls -lh install/lib + + echo "----------" + + cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib + cp -v _deps/onnxruntime-src/lib/*.dll ./install/lib + + echo "----------" + + ls -lh install/lib + + - name: Build sherpa-onnx node-addon + shell: bash + run: | + d=$PWD + export SHERPA_ONNX_INSTALL_DIR=$d/build/install + + cd scripts/node-addon-api/ + + npm i + + npm config set cmake_js_A "Win32" + ./node_modules/.bin/cmake-js compile -A Win32 --log-level verbose + + - name: Prepare for publish + shell: bash + run: | + owner=${{ github.repository_owner }} + export owner + + echo "---" + ls -lh build/install/lib/ + echo "---" + ls -lh build/install/lib/ + echo "---" + + .github/scripts/node-addon/run.sh + + - name: Display files to be published + shell: bash + run: | + ls -lh ./sherpa-onnx-node + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node + + - uses: actions/upload-artifact@v4 + with: + name: sherpa-onnx-win-ia32 + path: ./sherpa-onnx-node.tar.bz2 + + upload: + needs: [build] + name: upload + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + python-version: ["3.8"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + + - name: Display node version + shell: bash + run: | + node --version + + - name: Retrieve artifact + uses: actions/download-artifact@v4 + with: + name: sherpa-onnx-win-ia32 + path: /tmp/files/ + + - name: Unzip + shell: bash + run: | + cd /tmp/files + tar xvf sherpa-onnx-node.tar.bz2 + + - name: Publish + shell: bash + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN2 }} + token: ${{ secrets.NPM_TOKEN2 }} + run: | + cd /tmp/files/sherpa-onnx-node + npm publish --access public diff --git a/.github/workflows/npm-addon.yaml b/.github/workflows/npm-addon.yaml index 73e8c05e4..05c67591e 100644 --- a/.github/workflows/npm-addon.yaml +++ b/.github/workflows/npm-addon.yaml @@ -55,7 +55,7 @@ jobs: SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" - # SHERPA_ONNX_VERSION=1.0.28 + # SHERPA_ONNX_VERSION=1.0.30 src_dir=.github/scripts/node-addon sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json @@ -71,6 +71,12 @@ jobs: shell: bash run: | ls -lh ./sherpa-onnx-node + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node + + - uses: actions/upload-artifact@v4 + with: + name: sherpa-onnx-node + path: ./sherpa-onnx-node.tar.bz2 - name: Publish shell: bash diff --git a/.github/workflows/test-nodejs-addon-npm-win-x86.yaml b/.github/workflows/test-nodejs-addon-npm-win-x86.yaml new file mode 100644 index 000000000..98cba9dec --- /dev/null +++ b/.github/workflows/test-nodejs-addon-npm-win-x86.yaml @@ -0,0 +1,86 @@ +name: test-node-addon-npm-win-x86 + +on: + push: + branches: + - master + paths: + - '.github/workflows/test-nodejs-addon-npm-win-x86.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' + - 'scripts/node-addon-api/**' + - 'scripts/node-addon-api/*.js' + - 'nodejs-addon-examples/package.json' + - '.github/scripts/test-nodejs-addon-npm.sh' + + pull_request: + branches: + - master + paths: + - '.github/workflows/test-nodejs-addon-npm-win-x86.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' + - 'scripts/node-addon-api/*.js' + - 'nodejs-addon-examples/package.json' + - '.github/scripts/test-nodejs-addon-npm.sh' + + workflow_dispatch: + +concurrency: + group: test-node-addon-npm-win-x86-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + test-node-addon-npm-win-x86: + name: ${{ matrix.os }} node v${{ matrix.node-version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest] + node-version: ["16", "17", "18", "19", "21", "22"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: ${{ matrix.node-version }} + architecture: 'x86' + + - name: Display node version + shell: bash + run: | + node --version + + - name: Run tests + shell: bash + run: | + d=nodejs-addon-examples + echo "dir: $d" + cd $d + npm install --verbose + git status + ls -lh + ls -lh node_modules + + export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-arm64:$LD_LIBRARY_PATH + + cd ../ + + .github/scripts/test-nodejs-addon-npm.sh diff --git a/nodejs-addon-examples/package.json b/nodejs-addon-examples/package.json index dd7cfed09..8d525f142 100644 --- a/nodejs-addon-examples/package.json +++ b/nodejs-addon-examples/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "sherpa-onnx-node": "^1.10.16" + "sherpa-onnx-node": "^1.0.30" } } diff --git a/scripts/node-addon-api/src/audio-tagging.cc b/scripts/node-addon-api/src/audio-tagging.cc index 519fe162b..8679b8c2a 100644 --- a/scripts/node-addon-api/src/audio-tagging.cc +++ b/scripts/node-addon-api/src/audio-tagging.cc @@ -199,7 +199,7 @@ static Napi::Object AudioTaggingComputeWrapper(const Napi::CallbackInfo &info) { } Napi::Array ans = Napi::Array::New(env, k); - for (int32_t i = 0; i != k; ++i) { + for (uint32_t i = 0; i != k; ++i) { Napi::Object obj = Napi::Object::New(env); obj.Set(Napi::String::New(env, "name"), Napi::String::New(env, events[i]->name)); diff --git a/scripts/node-addon-api/src/speaker-identification.cc b/scripts/node-addon-api/src/speaker-identification.cc index 6a4b721d5..f589761aa 100644 --- a/scripts/node-addon-api/src/speaker-identification.cc +++ b/scripts/node-addon-api/src/speaker-identification.cc @@ -749,7 +749,7 @@ static Napi::Array SpeakerEmbeddingManagerGetAllSpeakersWrapper( SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(manager); Napi::Array ans = Napi::Array::New(env, num_speakers); - for (int32_t i = 0; i != num_speakers; ++i) { + for (uint32_t i = 0; i != num_speakers; ++i) { ans[i] = Napi::String::New(env, all_speaker_names[i]); } SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(all_speaker_names);