Fangjun Kuang
Committed by GitHub

Export FireRedASR to sherpa-onnx. (#1865)

  1 +name: export-fire-red-asr-to-onnx
  2 +
  3 +on:
  4 + push:
  5 + branches:
  6 + - export-fire-red-asr
  7 +
  8 + workflow_dispatch:
  9 +
  10 +concurrency:
  11 + group: export-fire-red-asr-to-onnx-${{ github.ref }}
  12 + cancel-in-progress: true
  13 +
  14 +jobs:
  15 + export-fire-red-asr-to-onnx:
  16 + if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj'
  17 + name: export FireRedAsr ${{ matrix.version }}
  18 + runs-on: ${{ matrix.os }}
  19 + strategy:
  20 + fail-fast: false
  21 + matrix:
  22 + os: [ubuntu-latest]
  23 + python-version: ["3.10"]
  24 +
  25 + steps:
  26 + - uses: actions/checkout@v4
  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 + pip install "numpy<=1.26.4" onnx==1.16.0 onnxruntime==1.17.1
  37 +
  38 + - name: Download exported ONNX model from ModelScope
  39 + env:
  40 + MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
  41 + shell: bash
  42 + run: |
  43 + git clone https://oauth2:${MS_TOKEN}@www.modelscope.cn/csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.git ms
  44 + ls -lh ms
  45 +
  46 +
  47 + - name: Collect results
  48 + shell: bash
  49 + run: |
  50 + src=ms
  51 + d=sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
  52 + mkdir $d
  53 +
  54 + mv -v $src/*.onnx $d
  55 + cp -v $src/README.md $d
  56 + cp -v $src/tokens.txt $d
  57 + cp -av $src/test_wavs $d
  58 +
  59 + ls -lh $d/
  60 + tar cjfv $d.tar.bz2 $d
  61 +
  62 + ls -lh $d.tar.bz2
  63 + rm -rf ms
  64 +
  65 + - name: Publish to huggingface ${{ matrix.version }}
  66 + env:
  67 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  68 + uses: nick-fields/retry@v3
  69 + with:
  70 + max_attempts: 20
  71 + timeout_seconds: 200
  72 + shell: bash
  73 + command: |
  74 + git config --global user.email "csukuangfj@gmail.com"
  75 + git config --global user.name "Fangjun Kuang"
  76 +
  77 + rm -rf huggingface
  78 + export GIT_LFS_SKIP_SMUDGE=1
  79 + export GIT_CLONE_PROTECTION_ACTIVE=false
  80 +
  81 + src=sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
  82 +
  83 + git clone https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/$src huggingface
  84 + cd huggingface
  85 + rm -rf ./*
  86 + git fetch
  87 + git pull
  88 +
  89 + cp -av ../$src/* ./
  90 +
  91 + git lfs track "*.onnx"
  92 + git add .
  93 +
  94 + ls -lh
  95 +
  96 + git status
  97 +
  98 + git commit -m "add models"
  99 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/$src main || true
  100 +
  101 + - name: Release
  102 + if: github.repository_owner == 'csukuangfj'
  103 + uses: svenstaro/upload-release-action@v2
  104 + with:
  105 + file_glob: true
  106 + file: ./*.tar.bz2
  107 + overwrite: true
  108 + repo_name: k2-fsa/sherpa-onnx
  109 + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
  110 + tag: asr-models
  111 +
  112 + - name: Release
  113 + if: github.repository_owner == 'k2-fsa'
  114 + uses: svenstaro/upload-release-action@v2
  115 + with:
  116 + file_glob: true
  117 + file: ./*.tar.bz2
  118 + overwrite: true
  119 + tag: asr-models
@@ -138,7 +138,7 @@ jobs: @@ -138,7 +138,7 @@ jobs:
138 file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-*.exe 138 file: ./mfc-examples/${{ matrix.arch }}/Release/sherpa-onnx-non-streaming-*.exe
139 139
140 - name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }} 140 - name: Release pre-compiled binaries and libs for Windows ${{ matrix.arch }}
141 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 141 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
142 uses: svenstaro/upload-release-action@v2 142 uses: svenstaro/upload-release-action@v2
143 with: 143 with:
144 file_glob: true 144 file_glob: true