|
| 1 | +name: export-nemotron-3-5-asr-streaming-06b |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - export-nemotron-3-5-asr-streaming |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: export-nemotron-3-5-asr-streaming-to-onnx-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + export-nemotron-3-5-asr-streaming-0-6b-to-onnx: |
| 15 | + if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj' |
| 16 | + name: nemotron-3-5-asr-streaming-0-6b-to-onnx |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [macos-latest] |
| 22 | + python-version: ["3.10"] |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup Python ${{ matrix.python-version }} |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: ${{ matrix.python-version }} |
| 31 | + |
| 32 | + - name: Install NeMo |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + # nemotron-3.5-asr-streaming-0.6b requires EncDecRNNTBPEModelWithPrompt, |
| 36 | + # which is not in the stable nemo-toolkit release yet; the model card |
| 37 | + # instructs installing NeMo from main. |
| 38 | + BRANCH='main' |
| 39 | + pip install Cython packaging |
| 40 | + pip install "nemo_toolkit[asr] @ git+https://github.com/NVIDIA/NeMo.git@$BRANCH" |
| 41 | + pip install onnxruntime ipython sentencepiece |
| 42 | + pip install kaldi-native-fbank |
| 43 | + pip install soundfile librosa |
| 44 | +
|
| 45 | + - name: Run |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + cd scripts/nemo/nemotron-3.5-asr-streaming-0.6b |
| 49 | +
|
| 50 | + python3 ./export_onnx.py |
| 51 | +
|
| 52 | + ls -lh |
| 53 | + echo "---" |
| 54 | +
|
| 55 | + ls -lh */ |
| 56 | +
|
| 57 | + echo "---" |
| 58 | +
|
| 59 | + - name: Collect results |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + src=scripts/nemo/nemotron-3.5-asr-streaming-0.6b |
| 63 | +
|
| 64 | + for chunk in 80 160 560 1120; do |
| 65 | + d=sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-${chunk}ms-2026-06-11 |
| 66 | + mkdir -p $d |
| 67 | +
|
| 68 | + cp -av $src/$chunk/encoder.onnx $d/ |
| 69 | + cp -av $src/$chunk/encoder.data $d/ |
| 70 | + cp -av $src/$chunk/decoder.onnx $d/ |
| 71 | + cp -av $src/$chunk/joiner.onnx $d/ |
| 72 | + cp -av $src/tokens.txt $d/ |
| 73 | + cat >$d/README.md <<EOF |
| 74 | + # Introduction |
| 75 | + This model is from https://huggingface.co/nvidia/nemotron-3.5-asr-streaming-0.6b |
| 76 | +
|
| 77 | + The chunk size is ${chunk}ms for the exported ONNX model. |
| 78 | +
|
| 79 | + Use per-stream language strings such as "en", "ja", or "auto". |
| 80 | + EOF |
| 81 | +
|
| 82 | + ls -lh $d |
| 83 | +
|
| 84 | + d=sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-${chunk}ms-int8-2026-06-11 |
| 85 | + mkdir -p $d |
| 86 | +
|
| 87 | + cp -av $src/${chunk}/encoder.int8.onnx $d/ |
| 88 | + cp -av $src/${chunk}/decoder.int8.onnx $d/ |
| 89 | + cp -av $src/${chunk}/joiner.int8.onnx $d/ |
| 90 | + cp -av $src/tokens.txt $d/ |
| 91 | + cat >$d/README.md <<EOF |
| 92 | + # Introduction |
| 93 | + This model is from https://huggingface.co/nvidia/nemotron-3.5-asr-streaming-0.6b |
| 94 | +
|
| 95 | + The chunk size is ${chunk}ms for the exported ONNX model. |
| 96 | +
|
| 97 | + Use per-stream language strings such as "en", "ja", or "auto". |
| 98 | + EOF |
| 99 | +
|
| 100 | + ls -lh $d |
| 101 | + done |
| 102 | +
|
| 103 | + - name: Download test waves |
| 104 | + shell: bash |
| 105 | + run: | |
| 106 | + mkdir test_wavs |
| 107 | + pushd test_wavs |
| 108 | + curl -SL -O https://hf-mirror.com/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main/test_wavs/en.wav |
| 109 | + curl -SL -O https://hf-mirror.com/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/resolve/main/test_wavs/ja.wav |
| 110 | + popd |
| 111 | +
|
| 112 | + models=( |
| 113 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-80ms-int8-2026-06-11 |
| 114 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-160ms-int8-2026-06-11 |
| 115 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-560ms-int8-2026-06-11 |
| 116 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-1120ms-int8-2026-06-11 |
| 117 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-80ms-2026-06-11 |
| 118 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-160ms-2026-06-11 |
| 119 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-560ms-2026-06-11 |
| 120 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-1120ms-2026-06-11 |
| 121 | + ) |
| 122 | + for m in ${models[@]}; do |
| 123 | + cp -av test_wavs $m |
| 124 | + tar cjvf $m.tar.bz2 $m |
| 125 | + done |
| 126 | +
|
| 127 | + ls -lh *.tar.bz2 |
| 128 | +
|
| 129 | + - name: Release |
| 130 | + uses: svenstaro/upload-release-action@v2 |
| 131 | + with: |
| 132 | + file_glob: true |
| 133 | + file: sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-*-int8-2026-06-11.tar.bz2 |
| 134 | + overwrite: true |
| 135 | + repo_name: k2-fsa/sherpa-onnx |
| 136 | + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }} |
| 137 | + tag: asr-models |
| 138 | + |
| 139 | + - name: Publish to huggingface |
| 140 | + env: |
| 141 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 142 | + uses: nick-fields/retry@v3 |
| 143 | + with: |
| 144 | + max_attempts: 20 |
| 145 | + timeout_seconds: 200 |
| 146 | + shell: bash |
| 147 | + command: | |
| 148 | + git config --global user.email "csukuangfj@gmail.com" |
| 149 | + git config --global user.name "Fangjun Kuang" |
| 150 | +
|
| 151 | + models=( |
| 152 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-80ms-int8-2026-06-11 |
| 153 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-160ms-int8-2026-06-11 |
| 154 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-560ms-int8-2026-06-11 |
| 155 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-1120ms-int8-2026-06-11 |
| 156 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-80ms-2026-06-11 |
| 157 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-160ms-2026-06-11 |
| 158 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-560ms-2026-06-11 |
| 159 | + sherpa-onnx-nemotron-3.5-asr-streaming-0.6b-1120ms-2026-06-11 |
| 160 | + ) |
| 161 | +
|
| 162 | + for m in ${models[@]}; do |
| 163 | + if [ ! -d $m ]; then |
| 164 | + echo "skip $m" |
| 165 | + continue |
| 166 | + fi |
| 167 | +
|
| 168 | + rm -rf huggingface |
| 169 | + export GIT_LFS_SKIP_SMUDGE=1 |
| 170 | + export GIT_CLONE_PROTECTION_ACTIVE=false |
| 171 | + git clone https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m huggingface |
| 172 | + cp -av $m/* huggingface |
| 173 | + cd huggingface |
| 174 | + git lfs track "*.onnx" |
| 175 | + git lfs track "*.data" |
| 176 | + git lfs track "*.wav" |
| 177 | + git status |
| 178 | + git add . |
| 179 | + git status |
| 180 | + git commit -m "first commit" |
| 181 | + git push https://csukuangfj2:$HF_TOKEN@huggingface.co/csukuangfj2/$m main |
| 182 | + cd .. |
| 183 | + done |
| 184 | +
|
| 185 | + rm -rf huggingface |
0 commit comments