Committed by
GitHub
Build wheels for rknn linux aarch64 (#1928)
正在显示
4 个修改的文件
包含
131 行增加
和
4 行删除
| 1 | +name: build-wheels-aarch64-rknn | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - wheel | ||
| 7 | + workflow_dispatch: | ||
| 8 | + | ||
| 9 | +concurrency: | ||
| 10 | + group: build-wheels-aarch64-rknn-${{ github.ref }} | ||
| 11 | + cancel-in-progress: true | ||
| 12 | + | ||
| 13 | +jobs: | ||
| 14 | + build_wheels_aarch64_rknn: | ||
| 15 | + runs-on: ${{ matrix.os }} | ||
| 16 | + name: ${{ matrix.os }} ${{ matrix.python-version }} | ||
| 17 | + strategy: | ||
| 18 | + fail-fast: false | ||
| 19 | + matrix: | ||
| 20 | + os: [ubuntu-22.04-arm] | ||
| 21 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | ||
| 22 | + | ||
| 23 | + steps: | ||
| 24 | + - uses: actions/checkout@v4 | ||
| 25 | + with: | ||
| 26 | + fetch-depth: 0 | ||
| 27 | + | ||
| 28 | + - name: Setup Python ${{ matrix.python-version }} | ||
| 29 | + uses: actions/setup-python@v5 | ||
| 30 | + with: | ||
| 31 | + python-version: ${{ matrix.python-version }} | ||
| 32 | + | ||
| 33 | + - name: Install Python dependencies | ||
| 34 | + shell: bash | ||
| 35 | + run: | | ||
| 36 | + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece setuptools wheel | ||
| 37 | + | ||
| 38 | + - name: ccache | ||
| 39 | + uses: hendrikmuhs/ccache-action@v1.2 | ||
| 40 | + with: | ||
| 41 | + key: ${{ matrix.os }}-rknn-linux-aarch64-wheel | ||
| 42 | + | ||
| 43 | + - name: Download rknn-toolkit2 | ||
| 44 | + shell: bash | ||
| 45 | + run: | | ||
| 46 | + git clone --depth 1 https://github.com/airockchip/rknn-toolkit2 | ||
| 47 | + | ||
| 48 | + - name: Build sherpa-onnx | ||
| 49 | + shell: bash | ||
| 50 | + run: | | ||
| 51 | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| 52 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 53 | + cmake --version | ||
| 54 | + | ||
| 55 | + echo "config: ${{ matrix.config }}" | ||
| 56 | + uname -a | ||
| 57 | + which gcc | ||
| 58 | + | ||
| 59 | + gcc --version | ||
| 60 | + g++ --version | ||
| 61 | + | ||
| 62 | + echo "pwd" | ||
| 63 | + | ||
| 64 | + ls -lh | ||
| 65 | + | ||
| 66 | + git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib | ||
| 67 | + pushd alsa-lib | ||
| 68 | + ./gitcompile | ||
| 69 | + popd | ||
| 70 | + | ||
| 71 | + export SHERPA_ONNX_RKNN_TOOLKIT2_PATH=$PWD/rknn-toolkit2 | ||
| 72 | + export SHERPA_ONNX_RKNN_TOOLKIT2_LIB_DIR=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/aarch64 | ||
| 73 | + export CPLUS_INCLUDE_PATH=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/include:$CPLUS_INCLUDE_PATH | ||
| 74 | + export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH | ||
| 75 | + export SHERPA_ONNX_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs | ||
| 76 | + | ||
| 77 | + export SHERPA_ONNX_CMAKE_ARGS="-DSHERPA_ONNX_ENABLE_RKNN=ON -DSHERPA_ONNX_ENABLE_ALSA=1" | ||
| 78 | + python3 setup.py bdist_wheel | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + - name: Display results | ||
| 82 | + shell: bash | ||
| 83 | + run: | | ||
| 84 | + ls -lh dist | ||
| 85 | + | ||
| 86 | + - name: Publish to huggingface | ||
| 87 | + env: | ||
| 88 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 89 | + uses: nick-fields/retry@v3 | ||
| 90 | + with: | ||
| 91 | + max_attempts: 20 | ||
| 92 | + timeout_seconds: 200 | ||
| 93 | + shell: bash | ||
| 94 | + command: | | ||
| 95 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 96 | + git config --global user.name "Fangjun Kuang" | ||
| 97 | + | ||
| 98 | + rm -rf huggingface | ||
| 99 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 100 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 101 | + | ||
| 102 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 103 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 104 | + | ||
| 105 | + d=rknn/$SHERPA_ONNX_VERSION/ | ||
| 106 | + | ||
| 107 | + git clone https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface | ||
| 108 | + cd huggingface | ||
| 109 | + git fetch | ||
| 110 | + git pull | ||
| 111 | + git merge -m "merge remote" --ff origin main | ||
| 112 | + | ||
| 113 | + mkdir -p $d | ||
| 114 | + | ||
| 115 | + cp -v ../dist/*.whl $d/ | ||
| 116 | + | ||
| 117 | + git status | ||
| 118 | + git add . | ||
| 119 | + git commit -m "add more wheels" | ||
| 120 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main | ||
| 121 | + | ||
| 122 | + - uses: actions/upload-artifact@v4 | ||
| 123 | + with: | ||
| 124 | + name: wheel-${{ matrix.python-version }} | ||
| 125 | + path: ./dist/*.whl |
| @@ -174,7 +174,8 @@ jobs: | @@ -174,7 +174,8 @@ jobs: | ||
| 174 | 174 | ||
| 175 | cp -a build/install/bin $dst/ | 175 | cp -a build/install/bin $dst/ |
| 176 | if [[ ${{ matrix.shared_lib }} == ON ]]; then | 176 | if [[ ${{ matrix.shared_lib }} == ON ]]; then |
| 177 | - cp -av build/install/lib $dst/ | 177 | + mkdir $dst/lib |
| 178 | + cp -av build/install/lib/*.so* $dst/lib/ | ||
| 178 | fi | 179 | fi |
| 179 | cp -a build/install/include $dst/ | 180 | cp -a build/install/include $dst/ |
| 180 | 181 |
| @@ -152,7 +152,8 @@ jobs: | @@ -152,7 +152,8 @@ jobs: | ||
| 152 | cp -a build/install/bin $dst/ | 152 | cp -a build/install/bin $dst/ |
| 153 | 153 | ||
| 154 | if [[ ${{ matrix.shared }} == ON ]]; then | 154 | if [[ ${{ matrix.shared }} == ON ]]; then |
| 155 | - cp -v build/install/lib/lib*.so $dst/ | 155 | + mkdir -p $dst/lib |
| 156 | + cp -v build/install/lib/lib*.so $dst/lib/ | ||
| 156 | fi | 157 | fi |
| 157 | 158 | ||
| 158 | ls -lh build/install/lib | 159 | ls -lh build/install/lib |
| @@ -218,7 +219,7 @@ jobs: | @@ -218,7 +219,7 @@ jobs: | ||
| 218 | file: sherpa-onnx-*linux-aarch64*.tar.bz2 | 219 | file: sherpa-onnx-*linux-aarch64*.tar.bz2 |
| 219 | 220 | ||
| 220 | - name: Release pre-compiled binaries and libs for rknn linux aarch64 | 221 | - name: Release pre-compiled binaries and libs for rknn linux aarch64 |
| 221 | - # if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') | 222 | + if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 222 | uses: svenstaro/upload-release-action@v2 | 223 | uses: svenstaro/upload-release-action@v2 |
| 223 | with: | 224 | with: |
| 224 | file_glob: true | 225 | file_glob: true |
| @@ -84,7 +84,7 @@ bool OnlineModelConfig::Validate() const { | @@ -84,7 +84,7 @@ bool OnlineModelConfig::Validate() const { | ||
| 84 | EndsWith(transducer.joiner, ".onnx"))) { | 84 | EndsWith(transducer.joiner, ".onnx"))) { |
| 85 | SHERPA_ONNX_LOGE( | 85 | SHERPA_ONNX_LOGE( |
| 86 | "--provider is rknn, but you pass onnx model " | 86 | "--provider is rknn, but you pass onnx model " |
| 87 | - "filenames. encoder: '%s', decoder: '%s', joiner: %'s'", | 87 | + "filenames. encoder: '%s', decoder: '%s', joiner: '%s'", |
| 88 | transducer.encoder.c_str(), transducer.decoder.c_str(), | 88 | transducer.encoder.c_str(), transducer.decoder.c_str(), |
| 89 | transducer.joiner.c_str()); | 89 | transducer.joiner.c_str()); |
| 90 | return false; | 90 | return false; |
-
请 注册 或 登录 后发表评论