Provide npm package for 32-bit Windows x86 (#1141)
This commit is contained in:
3
.github/scripts/node-addon/package.json
vendored
3
.github/scripts/node-addon/package.json
vendored
@@ -49,6 +49,7 @@
|
|||||||
"sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION",
|
"sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION",
|
||||||
"sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION",
|
"sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION",
|
||||||
"sherpa-onnx-linux-arm64": "^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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
.github/scripts/node-addon/run.sh
vendored
9
.github/scripts/node-addon/run.sh
vendored
@@ -9,16 +9,23 @@ platform=$(node -p "require('os').platform()")
|
|||||||
|
|
||||||
arch=$(node -p "require('os').arch()")
|
arch=$(node -p "require('os').arch()")
|
||||||
|
|
||||||
|
echo "platform: $platform"
|
||||||
|
echo "arch: $arch"
|
||||||
|
|
||||||
|
# ia32 for win x86
|
||||||
|
|
||||||
platform2=$platform
|
platform2=$platform
|
||||||
|
|
||||||
|
|
||||||
if [[ $platform == win32 ]]; then
|
if [[ $platform == win32 ]]; then
|
||||||
platform2=win
|
platform2=win
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"
|
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"
|
||||||
|
|
||||||
# SHERPA_ONNX_VERSION=1.0.28
|
# SHERPA_ONNX_VERSION=1.0.31
|
||||||
|
|
||||||
if [ -z $owner ]; then
|
if [ -z $owner ]; then
|
||||||
owner=k2-fsa
|
owner=k2-fsa
|
||||||
|
|||||||
138
.github/scripts/test-nodejs-addon-npm.sh
vendored
138
.github/scripts/test-nodejs-addon-npm.sh
vendored
@@ -6,6 +6,66 @@ d=nodejs-addon-examples
|
|||||||
echo "dir: $d"
|
echo "dir: $d"
|
||||||
cd $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----------"
|
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
|
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
|
node ./test_keyword_spotter_transducer.js
|
||||||
rm -rf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
|
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::<lambda_d603a8c74863bd6b58a1c7996295ed04>::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
|
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
|
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
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2
|
||||||
|
|
||||||
node ./test_punctuation.js
|
node ./test_punctuation.js
|
||||||
rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12
|
rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12
|
||||||
|
fi
|
||||||
|
|
||||||
echo "----------audio tagging----------"
|
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.fst
|
||||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav
|
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
|
if [[ $arch != "ia32" && $platform != "win32" ]]; then
|
||||||
|
node test_asr_streaming_transducer_itn.js
|
||||||
node test_asr_streaming_transducer.js
|
node test_asr_streaming_transducer.js
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
|
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
|
node ./test_asr_non_streaming_whisper.js
|
||||||
rm -rf sherpa-onnx-whisper-tiny.en
|
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
|
ls -lh
|
||||||
|
|||||||
6
.github/workflows/npm-addon-linux-x64.yaml
vendored
6
.github/workflows/npm-addon-linux-x64.yaml
vendored
@@ -108,6 +108,12 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ls -lh ./sherpa-onnx-node
|
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
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
6
.github/workflows/npm-addon-macos.yaml
vendored
6
.github/workflows/npm-addon-macos.yaml
vendored
@@ -102,6 +102,12 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ls -lh ./sherpa-onnx-node
|
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
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
11
.github/workflows/npm-addon-win-x64.yaml
vendored
11
.github/workflows/npm-addon-win-x64.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest]
|
os: [windows-2019]
|
||||||
python-version: ["3.8"]
|
python-version: ["3.8"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -54,6 +54,8 @@ jobs:
|
|||||||
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
||||||
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
|
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
|
||||||
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
||||||
|
-DBUILD_ESPEAK_NG_EXE=OFF \
|
||||||
|
-DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
|
||||||
..
|
..
|
||||||
|
|
||||||
ls -lh _deps/onnxruntime-src/lib/
|
ls -lh _deps/onnxruntime-src/lib/
|
||||||
@@ -65,6 +67,7 @@ jobs:
|
|||||||
echo "----------"
|
echo "----------"
|
||||||
|
|
||||||
cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib
|
cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib
|
||||||
|
cp -v _deps/onnxruntime-src/lib/*.dll ./install/lib
|
||||||
|
|
||||||
echo "----------"
|
echo "----------"
|
||||||
|
|
||||||
@@ -100,6 +103,12 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ls -lh ./sherpa-onnx-node
|
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
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
176
.github/workflows/npm-addon-win-x86.yaml
vendored
Normal file
176
.github/workflows/npm-addon-win-x86.yaml
vendored
Normal file
@@ -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
|
||||||
8
.github/workflows/npm-addon.yaml
vendored
8
.github/workflows/npm-addon.yaml
vendored
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"
|
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
|
src_dir=.github/scripts/node-addon
|
||||||
sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json
|
sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json
|
||||||
@@ -71,6 +71,12 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ls -lh ./sherpa-onnx-node
|
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
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
86
.github/workflows/test-nodejs-addon-npm-win-x86.yaml
vendored
Normal file
86
.github/workflows/test-nodejs-addon-npm-win-x86.yaml
vendored
Normal file
@@ -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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sherpa-onnx-node": "^1.10.16"
|
"sherpa-onnx-node": "^1.0.30"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ static Napi::Object AudioTaggingComputeWrapper(const Napi::CallbackInfo &info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Napi::Array ans = Napi::Array::New(env, k);
|
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);
|
Napi::Object obj = Napi::Object::New(env);
|
||||||
obj.Set(Napi::String::New(env, "name"),
|
obj.Set(Napi::String::New(env, "name"),
|
||||||
Napi::String::New(env, events[i]->name));
|
Napi::String::New(env, events[i]->name));
|
||||||
|
|||||||
@@ -749,7 +749,7 @@ static Napi::Array SpeakerEmbeddingManagerGetAllSpeakersWrapper(
|
|||||||
SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(manager);
|
SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(manager);
|
||||||
|
|
||||||
Napi::Array ans = Napi::Array::New(env, num_speakers);
|
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]);
|
ans[i] = Napi::String::New(env, all_speaker_names[i]);
|
||||||
}
|
}
|
||||||
SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(all_speaker_names);
|
SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(all_speaker_names);
|
||||||
|
|||||||
Reference in New Issue
Block a user