|
| 1 | +name: export-peng-cheng-starling-to-onnx |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - export-peng-cheng-starling-2 |
| 7 | + |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: export-peng-cheng-starling-to-onnx-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + export-peng-cheng-starling-to-onnx: |
| 16 | + if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj' |
| 17 | + name: export peng cheng starling ${{ 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: Run |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + cd scripts/peng-cheng-starling |
| 42 | + ./run.sh |
| 43 | + python3 ./quantize_models.py |
| 44 | +
|
| 45 | + ls -lh |
| 46 | + rm encoder-epoch-75-avg-11-chunk-16-left-128.onnx |
| 47 | + rm joiner-epoch-75-avg-11-chunk-16-left-128.onnx |
| 48 | + echo "----" |
| 49 | + ls -lh |
| 50 | +
|
| 51 | +
|
| 52 | + - name: Collect results ${{ matrix.version }} |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + src=scripts/peng-cheng-starling |
| 56 | + d=sherpa-onnx-streaming-zipformer-ar_en_id_ja_ru_th_vi_zh-2025-02-10 |
| 57 | + mkdir $d |
| 58 | +
|
| 59 | + mv -v $src/*.onnx $d |
| 60 | + cp -v $src/README.md $d |
| 61 | + cp -v $src/bpe.model $d |
| 62 | + cp -av $src/test_wavs $d |
| 63 | +
|
| 64 | + ls -lh $d/ |
| 65 | + tar cjfv $d.tar.bz2 $d |
| 66 | +
|
| 67 | + ls -lh $d.tar.bz2 |
| 68 | +
|
| 69 | + - name: Publish to huggingface ${{ matrix.version }} |
| 70 | + env: |
| 71 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 72 | + uses: nick-fields/retry@v3 |
| 73 | + with: |
| 74 | + max_attempts: 20 |
| 75 | + timeout_seconds: 200 |
| 76 | + shell: bash |
| 77 | + command: | |
| 78 | + git config --global user.email "csukuangfj@gmail.com" |
| 79 | + git config --global user.name "Fangjun Kuang" |
| 80 | +
|
| 81 | + rm -rf huggingface |
| 82 | + export GIT_LFS_SKIP_SMUDGE=1 |
| 83 | + export GIT_CLONE_PROTECTION_ACTIVE=false |
| 84 | +
|
| 85 | + src=sherpa-onnx-streaming-zipformer-ar_en_id_ja_ru_th_vi_zh-2025-02-10 |
| 86 | +
|
| 87 | + git clone https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/$src huggingface |
| 88 | + cd huggingface |
| 89 | + rm -rf ./* |
| 90 | + git fetch |
| 91 | + git pull |
| 92 | +
|
| 93 | + cp -av ../$src/* ./ |
| 94 | +
|
| 95 | + git lfs track "*.onnx" |
| 96 | + git add . |
| 97 | +
|
| 98 | + ls -lh |
| 99 | +
|
| 100 | + git status |
| 101 | +
|
| 102 | + git commit -m "add models" |
| 103 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/$src main || true |
| 104 | +
|
| 105 | + - name: Release |
| 106 | + if: github.repository_owner == 'csukuangfj' |
| 107 | + uses: svenstaro/upload-release-action@v2 |
| 108 | + with: |
| 109 | + file_glob: true |
| 110 | + file: ./*.tar.bz2 |
| 111 | + overwrite: true |
| 112 | + repo_name: k2-fsa/sherpa-onnx |
| 113 | + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }} |
| 114 | + tag: asr-models |
| 115 | + |
| 116 | + - name: Release |
| 117 | + if: github.repository_owner == 'k2-fsa' |
| 118 | + uses: svenstaro/upload-release-action@v2 |
| 119 | + with: |
| 120 | + file_glob: true |
| 121 | + file: ./*.tar.bz2 |
| 122 | + overwrite: true |
| 123 | + tag: asr-models |
0 commit comments