Committed by
GitHub
Publish node-addon-api npm package for linux arm64 (#841)
正在显示
7 个修改的文件
包含
228 行增加
和
13 行删除
| @@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
| 48 | "sherpa-onnx-darwin-arm64": "^SHERPA_ONNX_VERSION", | 48 | "sherpa-onnx-darwin-arm64": "^SHERPA_ONNX_VERSION", |
| 49 | "sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION", | 49 | "sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION", |
| 50 | "sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION", | 50 | "sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION", |
| 51 | + "sherpa-onnx-linux-arm64": "^SHERPA_ONNX_VERSION", | ||
| 51 | "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION" | 52 | "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION" |
| 52 | } | 53 | } |
| 53 | } | 54 | } |
| @@ -6,7 +6,9 @@ echo "sherpa_onnx_dir: $sherpa_onnx_dir" | @@ -6,7 +6,9 @@ echo "sherpa_onnx_dir: $sherpa_onnx_dir" | ||
| 6 | src_dir=$sherpa_onnx_dir/.github/scripts/node-addon | 6 | src_dir=$sherpa_onnx_dir/.github/scripts/node-addon |
| 7 | 7 | ||
| 8 | platform=$(node -p "require('os').platform()") | 8 | platform=$(node -p "require('os').platform()") |
| 9 | + | ||
| 9 | arch=$(node -p "require('os').arch()") | 10 | arch=$(node -p "require('os').arch()") |
| 11 | + | ||
| 10 | platform2=$platform | 12 | platform2=$platform |
| 11 | 13 | ||
| 12 | if [[ $platform == win32 ]]; then | 14 | if [[ $platform == win32 ]]; then |
| @@ -13,6 +13,7 @@ ls -lh node_modules | @@ -13,6 +13,7 @@ ls -lh node_modules | ||
| 13 | export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH | 13 | export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH |
| 14 | export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH | 14 | export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH |
| 15 | export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH | 15 | export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH |
| 16 | +export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-arm64:$LD_LIBRARY_PATH | ||
| 16 | 17 | ||
| 17 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | 18 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 |
| 18 | tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | 19 | tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 |
| 1 | +name: npm-addon-linux-aarch64 | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + workflow_dispatch: | ||
| 5 | + | ||
| 6 | +concurrency: | ||
| 7 | + group: npm-addon-linux-aarch64-${{ github.ref }} | ||
| 8 | + cancel-in-progress: true | ||
| 9 | + | ||
| 10 | +permissions: | ||
| 11 | + contents: read | ||
| 12 | + id-token: write | ||
| 13 | + | ||
| 14 | +jobs: | ||
| 15 | + npm-addon-linux-aarch64: | ||
| 16 | + runs-on: ${{ matrix.os }} | ||
| 17 | + strategy: | ||
| 18 | + fail-fast: false | ||
| 19 | + matrix: | ||
| 20 | + os: [ubuntu-latest] | ||
| 21 | + python-version: ["3.8"] | ||
| 22 | + | ||
| 23 | + steps: | ||
| 24 | + - uses: actions/checkout@v4 | ||
| 25 | + with: | ||
| 26 | + fetch-depth: 0 | ||
| 27 | + | ||
| 28 | + - name: Set up QEMU | ||
| 29 | + uses: docker/setup-qemu-action@v2 | ||
| 30 | + with: | ||
| 31 | + platforms: arm64 | ||
| 32 | + | ||
| 33 | + - name: Setup Python ${{ matrix.python-version }} | ||
| 34 | + uses: actions/setup-python@v5 | ||
| 35 | + with: | ||
| 36 | + python-version: ${{ matrix.python-version }} | ||
| 37 | + | ||
| 38 | + - name: Show .npmrc | ||
| 39 | + shell: bash | ||
| 40 | + run: | | ||
| 41 | + echo $PWD | ||
| 42 | + echo $HOME | ||
| 43 | + | ||
| 44 | + find $HOME -name .npmrc | ||
| 45 | + | ||
| 46 | + - uses: actions/setup-node@v4 | ||
| 47 | + with: | ||
| 48 | + registry-url: 'https://registry.npmjs.org' | ||
| 49 | + | ||
| 50 | + - name: Show .npmrc | ||
| 51 | + shell: bash | ||
| 52 | + run: | | ||
| 53 | + echo $PWD | ||
| 54 | + echo $HOME | ||
| 55 | + | ||
| 56 | + find $HOME -name .npmrc | ||
| 57 | + | ||
| 58 | + cat /home/runner/work/_temp/.npmrc | ||
| 59 | + cp -v /home/runner/work/_temp/.npmrc ./ | ||
| 60 | + | ||
| 61 | + - name: Build sherpa-onnx | ||
| 62 | + uses: addnab/docker-run-action@v3 | ||
| 63 | + with: | ||
| 64 | + image: quay.io/pypa/manylinux2014_aarch64 | ||
| 65 | + options: | | ||
| 66 | + --platform linux/arm64 | ||
| 67 | + --volume ${{ github.workspace }}/:/shared/ | ||
| 68 | + shell: bash | ||
| 69 | + run: | | ||
| 70 | + cp /shared/.npmrc ~/ | ||
| 71 | + | ||
| 72 | + cat ~/.npmrc | ||
| 73 | + | ||
| 74 | + echo $HOME | ||
| 75 | + uname -a | ||
| 76 | + cat /etc/*release | ||
| 77 | + gcc --version | ||
| 78 | + cmake --version | ||
| 79 | + | ||
| 80 | + curl -sL https://rpm.nodesource.com/setup_16.x | bash - | ||
| 81 | + yum install -y nodejs | ||
| 82 | + | ||
| 83 | + node --version | ||
| 84 | + | ||
| 85 | + cd /shared | ||
| 86 | + | ||
| 87 | + mkdir build | ||
| 88 | + cd build | ||
| 89 | + cmake \ | ||
| 90 | + -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 91 | + -DBUILD_SHARED_LIBS=ON \ | ||
| 92 | + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 93 | + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | ||
| 94 | + -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
| 95 | + .. | ||
| 96 | + | ||
| 97 | + make -j | ||
| 98 | + make install | ||
| 99 | + cd .. | ||
| 100 | + | ||
| 101 | + d=$PWD | ||
| 102 | + export SHERPA_ONNX_INSTALL_DIR=$d/build/install | ||
| 103 | + | ||
| 104 | + ls -lh /shared/build | ||
| 105 | + | ||
| 106 | + pushd scripts/node-addon-api/ | ||
| 107 | + npm i | ||
| 108 | + | ||
| 109 | + ./node_modules/.bin/cmake-js compile --log-level verbose | ||
| 110 | + popd | ||
| 111 | + | ||
| 112 | + owner=${{ github.repository_owner }} | ||
| 113 | + export owner | ||
| 114 | + | ||
| 115 | + echo "---" | ||
| 116 | + ls -lh build/install/lib/ | ||
| 117 | + sudo chown -R runner ./build | ||
| 118 | + echo "---" | ||
| 119 | + ls -lh build/install/lib/ | ||
| 120 | + echo "---" | ||
| 121 | + | ||
| 122 | + .github/scripts/node-addon/run.sh | ||
| 123 | + | ||
| 124 | + ls -lh ./sherpa-onnx-node | ||
| 125 | + | ||
| 126 | + export NODE_AUTH_TOKEN=${{ secrets.NPM_TOKEN }} | ||
| 127 | + | ||
| 128 | + cd ./sherpa-onnx-node | ||
| 129 | + cp -v /shared/.npmrc ./ | ||
| 130 | + npm install | ||
| 131 | + npm ci | ||
| 132 | + ls -lh | ||
| 133 | + # see https://docs.npmjs.com/generating-provenance-statements | ||
| 134 | + npm publish --provenance --access public |
| 1 | +name: test-node-addon-npm-aarch64 | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - master | ||
| 7 | + paths: | ||
| 8 | + - '.github/workflows/test-nodejs-addon-npm-aarch64.yaml' | ||
| 9 | + - 'CMakeLists.txt' | ||
| 10 | + - 'cmake/**' | ||
| 11 | + - 'sherpa-onnx/csrc/*' | ||
| 12 | + - 'sherpa-onnx/c-api/*' | ||
| 13 | + - 'scripts/node-addon-api/**' | ||
| 14 | + - 'scripts/node-addon-api/*.js' | ||
| 15 | + - 'nodejs-addon-examples/package.json' | ||
| 16 | + | ||
| 17 | + pull_request: | ||
| 18 | + branches: | ||
| 19 | + - master | ||
| 20 | + paths: | ||
| 21 | + - '.github/workflows/test-nodejs-addon-npm-aarch64.yaml' | ||
| 22 | + - 'CMakeLists.txt' | ||
| 23 | + - 'cmake/**' | ||
| 24 | + - 'sherpa-onnx/csrc/*' | ||
| 25 | + - 'sherpa-onnx/c-api/*' | ||
| 26 | + - 'scripts/node-addon-api/*.js' | ||
| 27 | + - 'nodejs-addon-examples/package.json' | ||
| 28 | + | ||
| 29 | + workflow_dispatch: | ||
| 30 | + | ||
| 31 | +concurrency: | ||
| 32 | + group: test-node-addon-npm-aarch64-${{ github.ref }} | ||
| 33 | + cancel-in-progress: true | ||
| 34 | + | ||
| 35 | +permissions: | ||
| 36 | + contents: read | ||
| 37 | + | ||
| 38 | +jobs: | ||
| 39 | + test-node-addon-npm-aarch64: | ||
| 40 | + name: ${{ matrix.os }} | ||
| 41 | + runs-on: ${{ matrix.os }} | ||
| 42 | + strategy: | ||
| 43 | + fail-fast: false | ||
| 44 | + matrix: | ||
| 45 | + os: [ubuntu-latest] | ||
| 46 | + | ||
| 47 | + steps: | ||
| 48 | + - uses: actions/checkout@v4 | ||
| 49 | + with: | ||
| 50 | + fetch-depth: 0 | ||
| 51 | + | ||
| 52 | + - name: Set up QEMU | ||
| 53 | + uses: docker/setup-qemu-action@v2 | ||
| 54 | + with: | ||
| 55 | + platforms: arm64 | ||
| 56 | + | ||
| 57 | + - name: Test sherpa-onnx | ||
| 58 | + uses: addnab/docker-run-action@v3 | ||
| 59 | + with: | ||
| 60 | + image: quay.io/pypa/manylinux2014_aarch64 | ||
| 61 | + options: | | ||
| 62 | + --platform linux/arm64 | ||
| 63 | + --volume ${{ github.workspace }}/:/shared/ | ||
| 64 | + shell: bash | ||
| 65 | + run: | | ||
| 66 | + git config --global --add safe.directory /shared | ||
| 67 | + | ||
| 68 | + echo $HOME | ||
| 69 | + uname -a | ||
| 70 | + cat /etc/*release | ||
| 71 | + cmake --version | ||
| 72 | + | ||
| 73 | + curl -sL https://rpm.nodesource.com/setup_16.x | bash - | ||
| 74 | + yum install -y nodejs | ||
| 75 | + | ||
| 76 | + node --version | ||
| 77 | + | ||
| 78 | + cd /shared | ||
| 79 | + | ||
| 80 | + .github/scripts/test-nodejs-addon-npm.sh |
| @@ -9,6 +9,7 @@ This repository supports running the following functions **locally** | @@ -9,6 +9,7 @@ This repository supports running the following functions **locally** | ||
| 9 | - Spoken language identification | 9 | - Spoken language identification |
| 10 | - Audio tagging | 10 | - Audio tagging |
| 11 | - VAD (e.g., [silero-vad](https://github.com/snakers4/silero-vad)) | 11 | - VAD (e.g., [silero-vad](https://github.com/snakers4/silero-vad)) |
| 12 | + - Keyword spotting | ||
| 12 | 13 | ||
| 13 | on the following platforms and operating systems: | 14 | on the following platforms and operating systems: |
| 14 | 15 | ||
| @@ -27,17 +28,11 @@ on the following platforms and operating systems: | @@ -27,17 +28,11 @@ on the following platforms and operating systems: | ||
| 27 | 28 | ||
| 28 | with the following APIs | 29 | with the following APIs |
| 29 | 30 | ||
| 30 | - - C++ | ||
| 31 | - - C | ||
| 32 | - - Python | ||
| 33 | - - Go | ||
| 34 | - - ``C#`` | ||
| 35 | - - Javascript | ||
| 36 | - - Java | ||
| 37 | - - Kotlin | 31 | + - C++, C, Python, Go, ``C#`` |
| 32 | + - Java, Kotlin, JavaScript | ||
| 38 | - Swift | 33 | - Swift |
| 39 | 34 | ||
| 40 | -# Links for pre-built Android APKs | 35 | +## Links for pre-built Android APKs |
| 41 | 36 | ||
| 42 | | Description | URL | 中国用户 | | 37 | | Description | URL | 中国用户 | |
| 43 | |--------------------------------|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| | 38 | |--------------------------------|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| |
| @@ -52,7 +47,7 @@ with the following APIs | @@ -52,7 +47,7 @@ with the following APIs | ||
| 52 | | Spoken language identification | [Address](https://k2-fsa.github.io/sherpa/onnx/spoken-language-identification/apk.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/spoken-language-identification/apk-cn.html) | | 47 | | Spoken language identification | [Address](https://k2-fsa.github.io/sherpa/onnx/spoken-language-identification/apk.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/spoken-language-identification/apk-cn.html) | |
| 53 | |Keyword spotting| [Address](https://k2-fsa.github.io/sherpa/onnx/kws/apk.html)| [点此](https://k2-fsa.github.io/sherpa/onnx/kws/apk-cn.html)| | 48 | |Keyword spotting| [Address](https://k2-fsa.github.io/sherpa/onnx/kws/apk.html)| [点此](https://k2-fsa.github.io/sherpa/onnx/kws/apk-cn.html)| |
| 54 | 49 | ||
| 55 | -# Links for pre-trained models | 50 | +## Links for pre-trained models |
| 56 | 51 | ||
| 57 | | Description | URL | | 52 | | Description | URL | |
| 58 | |--------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | 53 | |--------------------------------|--------------------------------------------------------------------------------------------------------------------------------| |
| @@ -65,12 +60,12 @@ with the following APIs | @@ -65,12 +60,12 @@ with the following APIs | ||
| 65 | | Spoken language identification (Language ID) | See multi-lingual Whisper ASR models from [Speech recognition](https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models) | | 60 | | Spoken language identification (Language ID) | See multi-lingual Whisper ASR models from [Speech recognition](https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models) | |
| 66 | | Punctuation| [Address](https://github.com/k2-fsa/sherpa-onnx/releases/tag/punctuation-models)| | 61 | | Punctuation| [Address](https://github.com/k2-fsa/sherpa-onnx/releases/tag/punctuation-models)| |
| 67 | 62 | ||
| 68 | -# Useful links | 63 | +## Useful links |
| 69 | 64 | ||
| 70 | - Documentation: https://k2-fsa.github.io/sherpa/onnx/ | 65 | - Documentation: https://k2-fsa.github.io/sherpa/onnx/ |
| 71 | - Bilibili 演示视频: https://search.bilibili.com/all?keyword=%E6%96%B0%E4%B8%80%E4%BB%A3Kaldi | 66 | - Bilibili 演示视频: https://search.bilibili.com/all?keyword=%E6%96%B0%E4%B8%80%E4%BB%A3Kaldi |
| 72 | 67 | ||
| 73 | -# How to reach us | 68 | +## How to reach us |
| 74 | 69 | ||
| 75 | Please see | 70 | Please see |
| 76 | https://k2-fsa.github.io/sherpa/social-groups.html | 71 | https://k2-fsa.github.io/sherpa/social-groups.html |
| @@ -22,8 +22,10 @@ export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRAR | @@ -22,8 +22,10 @@ export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRAR | ||
| 22 | 22 | ||
| 23 | # For Linux x64 | 23 | # For Linux x64 |
| 24 | export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH | 24 | export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH |
| 25 | -``` | ||
| 26 | 25 | ||
| 26 | +# For Linux arm64, e.g., Raspberry Pi 4 | ||
| 27 | +export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-arm64:$LD_LIBRARY_PATH | ||
| 28 | +``` | ||
| 27 | 29 | ||
| 28 | ## Streaming speech recognition with zipformer transducer | 30 | ## Streaming speech recognition with zipformer transducer |
| 29 | ```bash | 31 | ```bash |
-
请 注册 或 登录 后发表评论