Fangjun Kuang
Committed by GitHub

Fix publishing pre-built windows libraries (#1905)

@@ -44,24 +44,24 @@ done @@ -44,24 +44,24 @@ done
44 rm -rf kokoro-en-v0_19 44 rm -rf kokoro-en-v0_19
45 45
46 log "------------------------------------------------------------" 46 log "------------------------------------------------------------"
47 -log "matcha-tts-fa_en-male" 47 +log "matcha-tts-fa_en-musa"
48 log "------------------------------------------------------------" 48 log "------------------------------------------------------------"
49 -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-male.tar.bz2  
50 -tar xvf matcha-tts-fa_en-male.tar.bz2  
51 -rm matcha-tts-fa_en-male.tar.bz2 49 +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-musa.tar.bz2
  50 +tar xvf matcha-tts-fa_en-musa.tar.bz2
  51 +rm matcha-tts-fa_en-musa.tar.bz2
52 52
53 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx 53 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx
54 54
55 $EXE \ 55 $EXE \
56 - --matcha-acoustic-model=./matcha-tts-fa_en-male/model.onnx \ 56 + --matcha-acoustic-model=./matcha-tts-fa_en-musa/model.onnx \
57 --matcha-vocoder=./hifigan_v2.onnx \ 57 --matcha-vocoder=./hifigan_v2.onnx \
58 - --matcha-tokens=./matcha-tts-fa_en-male/tokens.txt \  
59 - --matcha-data-dir=./matcha-tts-fa_en-male/espeak-ng-data \  
60 - --output-filename=./tts/test-matcha-fa-en-male.wav \ 58 + --matcha-tokens=./matcha-tts-fa_en-musa/tokens.txt \
  59 + --matcha-data-dir=./matcha-tts-fa_en-musa/espeak-ng-data \
  60 + --output-filename=./tts/test-matcha-fa-en-musa.wav \
61 --num-threads=2 \ 61 --num-threads=2 \
62 "How are you doing today? این یک نمونه ی تست فارسی است. This is a test." 62 "How are you doing today? این یک نمونه ی تست فارسی است. This is a test."
63 63
64 -rm -rf matcha-tts-fa_en-male 64 +rm -rf matcha-tts-fa_en-musa
65 rm hifigan_v2.onnx 65 rm hifigan_v2.onnx
66 ls -lh tts/*.wav 66 ls -lh tts/*.wav
67 67
@@ -91,6 +91,83 @@ jobs: @@ -91,6 +91,83 @@ jobs:
91 name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }} 91 name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
92 path: build/install/* 92 path: build/install/*
93 93
  94 + - name: Copy files
  95 + shell: bash
  96 + run: |
  97 + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
  98 +
  99 + shared_lib=${{ matrix.shared_lib }}
  100 + if [[ $shared_lib == "ON" ]]; then
  101 + suffix=shared
  102 + else
  103 + suffix=static
  104 + fi
  105 +
  106 + if [[ ${{ matrix.with_tts }} == ON ]]; then
  107 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix
  108 + else
  109 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts
  110 + fi
  111 +
  112 + mkdir $dst
  113 +
  114 + cp -a build/install/bin $dst/
  115 + cp -a build/install/lib $dst/
  116 + cp -a build/install/include $dst/
  117 +
  118 + tar cjvf ${dst}.tar.bz2 $dst
  119 +
  120 + # https://huggingface.co/docs/hub/spaces-github-actions
  121 + - name: Publish to huggingface
  122 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
  123 + env:
  124 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  125 + uses: nick-fields/retry@v3
  126 + with:
  127 + max_attempts: 20
  128 + timeout_seconds: 200
  129 + shell: bash
  130 + command: |
  131 + git config --global user.email "csukuangfj@gmail.com"
  132 + git config --global user.name "Fangjun Kuang"
  133 +
  134 + rm -rf huggingface
  135 + export GIT_CLONE_PROTECTION_ACTIVE=false
  136 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  137 +
  138 + cd huggingface
  139 + mkdir -p win64
  140 +
  141 + cp -v ../sherpa-onnx-*.tar.bz2 ./win64
  142 +
  143 + git status
  144 + git lfs track "*.bz2"
  145 +
  146 + git add .
  147 +
  148 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  149 +
  150 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  151 +
  152 + - name: Release pre-compiled binaries and libs for Windows x64
  153 + if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
  154 + uses: svenstaro/upload-release-action@v2
  155 + with:
  156 + file_glob: true
  157 + overwrite: true
  158 + file: sherpa-onnx-*-win-x64*.tar.bz2
  159 + repo_name: k2-fsa/sherpa-onnx
  160 + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
  161 + tag: v1.10.45
  162 +
  163 + - name: Release pre-compiled binaries and libs for Windows x64
  164 + if: github.repository_owner == 'k2-fsa'&& github.event_name == 'push' && contains(github.ref, 'refs/tags/')
  165 + uses: svenstaro/upload-release-action@v2
  166 + with:
  167 + file_glob: true
  168 + overwrite: true
  169 + file: sherpa-onnx-*-win-x64*.tar.bz2
  170 +
94 - name: Test offline Moonshine for windows x64 171 - name: Test offline Moonshine for windows x64
95 shell: bash 172 shell: bash
96 run: | 173 run: |
@@ -224,69 +301,3 @@ jobs: @@ -224,69 +301,3 @@ jobs:
224 export EXE=decode-file-c-api.exe 301 export EXE=decode-file-c-api.exe
225 302
226 .github/scripts/test-online-transducer.sh 303 .github/scripts/test-online-transducer.sh
227 -  
228 - - name: Copy files  
229 - shell: bash  
230 - run: |  
231 - SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)  
232 -  
233 - shared_lib=${{ matrix.shared_lib }}  
234 - if [[ $shared_lib == "ON" ]]; then  
235 - suffix=shared  
236 - else  
237 - suffix=static  
238 - fi  
239 -  
240 - if [[ ${{ matrix.with_tts }} ]]; then  
241 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix  
242 - else  
243 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts  
244 - fi  
245 -  
246 - mkdir $dst  
247 -  
248 - cp -a build/install/bin $dst/  
249 - cp -a build/install/lib $dst/  
250 - cp -a build/install/include $dst/  
251 -  
252 - tar cjvf ${dst}.tar.bz2 $dst  
253 -  
254 - # https://huggingface.co/docs/hub/spaces-github-actions  
255 - - name: Publish to huggingface  
256 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')  
257 - env:  
258 - HF_TOKEN: ${{ secrets.HF_TOKEN }}  
259 - uses: nick-fields/retry@v3  
260 - with:  
261 - max_attempts: 20  
262 - timeout_seconds: 200  
263 - shell: bash  
264 - command: |  
265 - git config --global user.email "csukuangfj@gmail.com"  
266 - git config --global user.name "Fangjun Kuang"  
267 -  
268 - rm -rf huggingface  
269 - export GIT_CLONE_PROTECTION_ACTIVE=false  
270 - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface  
271 -  
272 - cd huggingface  
273 - mkdir -p win64  
274 -  
275 - cp -v ../sherpa-onnx-*.tar.bz2 ./win64  
276 -  
277 - git status  
278 - git lfs track "*.bz2"  
279 -  
280 - git add .  
281 -  
282 - git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"  
283 -  
284 - git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main  
285 -  
286 - - name: Release pre-compiled binaries and libs for Windows x64  
287 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')  
288 - uses: svenstaro/upload-release-action@v2  
289 - with:  
290 - file_glob: true  
291 - overwrite: true  
292 - file: sherpa-onnx-*-win-x64*.tar.bz2  
@@ -91,6 +91,86 @@ jobs: @@ -91,6 +91,86 @@ jobs:
91 name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }} 91 name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
92 path: build/install/* 92 path: build/install/*
93 93
  94 + - name: Copy files
  95 + shell: bash
  96 + run: |
  97 + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
  98 +
  99 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86
  100 +
  101 + shared_lib=${{ matrix.shared_lib }}
  102 +
  103 + if [[ $shared_lib == "ON" ]]; then
  104 + suffix=shared
  105 + else
  106 + suffix=static
  107 + fi
  108 +
  109 + if [[ ${{ matrix.with_tts }} == ON ]]; then
  110 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix
  111 + else
  112 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts
  113 + fi
  114 +
  115 + mkdir $dst
  116 +
  117 + cp -a build/install/bin $dst/
  118 + cp -a build/install/lib $dst/
  119 + cp -a build/install/include $dst/
  120 +
  121 + tar cjvf ${dst}.tar.bz2 $dst
  122 +
  123 + # https://huggingface.co/docs/hub/spaces-github-actions
  124 + - name: Publish to huggingface
  125 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
  126 + env:
  127 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  128 + uses: nick-fields/retry@v3
  129 + with:
  130 + max_attempts: 20
  131 + timeout_seconds: 200
  132 + shell: bash
  133 + command: |
  134 + git config --global user.email "csukuangfj@gmail.com"
  135 + git config --global user.name "Fangjun Kuang"
  136 +
  137 + rm -rf huggingface
  138 + export GIT_CLONE_PROTECTION_ACTIVE=false
  139 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  140 +
  141 + cd huggingface
  142 + mkdir -p win32
  143 +
  144 + cp -v ../sherpa-onnx-*.tar.bz2 ./win32
  145 +
  146 + git status
  147 + git lfs track "*.bz2"
  148 +
  149 + git add .
  150 +
  151 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  152 +
  153 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  154 +
  155 + - name: Release pre-compiled binaries and libs for Windows x86
  156 + if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
  157 + uses: svenstaro/upload-release-action@v2
  158 + with:
  159 + file_glob: true
  160 + overwrite: true
  161 + file: sherpa-onnx-*-win-x86*.tar.bz2
  162 + repo_name: k2-fsa/sherpa-onnx
  163 + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
  164 + tag: v1.10.45
  165 +
  166 + - name: Release pre-compiled binaries and libs for Windows x86
  167 + if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
  168 + uses: svenstaro/upload-release-action@v2
  169 + with:
  170 + file_glob: true
  171 + overwrite: true
  172 + file: sherpa-onnx-*-win-x86*.tar.bz2
  173 +
94 - name: Test offline Moonshine for windows x86 174 - name: Test offline Moonshine for windows x86
95 shell: bash 175 shell: bash
96 run: | 176 run: |
@@ -223,72 +303,3 @@ jobs: @@ -223,72 +303,3 @@ jobs:
223 export EXE=decode-file-c-api.exe 303 export EXE=decode-file-c-api.exe
224 304
225 .github/scripts/test-online-transducer.sh 305 .github/scripts/test-online-transducer.sh
226 -  
227 - - name: Copy files  
228 - shell: bash  
229 - run: |  
230 - SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)  
231 -  
232 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86  
233 -  
234 - shared_lib=${{ matrix.shared_lib }}  
235 -  
236 - if [[ $shared_lib == "ON" ]]; then  
237 - suffix=shared  
238 - else  
239 - suffix=static  
240 - fi  
241 -  
242 - if [[ ${{ matrix.with_tts }} ]]; then  
243 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix  
244 - else  
245 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts  
246 - fi  
247 -  
248 - mkdir $dst  
249 -  
250 - cp -a build/install/bin $dst/  
251 - cp -a build/install/lib $dst/  
252 - cp -a build/install/include $dst/  
253 -  
254 - tar cjvf ${dst}.tar.bz2 $dst  
255 -  
256 - # https://huggingface.co/docs/hub/spaces-github-actions  
257 - - name: Publish to huggingface  
258 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')  
259 - env:  
260 - HF_TOKEN: ${{ secrets.HF_TOKEN }}  
261 - uses: nick-fields/retry@v3  
262 - with:  
263 - max_attempts: 20  
264 - timeout_seconds: 200  
265 - shell: bash  
266 - command: |  
267 - git config --global user.email "csukuangfj@gmail.com"  
268 - git config --global user.name "Fangjun Kuang"  
269 -  
270 - rm -rf huggingface  
271 - export GIT_CLONE_PROTECTION_ACTIVE=false  
272 - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface  
273 -  
274 - cd huggingface  
275 - mkdir -p win32  
276 -  
277 - cp -v ../sherpa-onnx-*.tar.bz2 ./win32  
278 -  
279 - git status  
280 - git lfs track "*.bz2"  
281 -  
282 - git add .  
283 -  
284 - git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"  
285 -  
286 - git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main  
287 -  
288 - - name: Release pre-compiled binaries and libs for Windows x86  
289 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')  
290 - uses: svenstaro/upload-release-action@v2  
291 - with:  
292 - file_glob: true  
293 - overwrite: true  
294 - file: sherpa-onnx-*-win-x86*.tar.bz2  
@@ -124,6 +124,9 @@ OfflineWhisperGreedySearchDecoder::Decode(Ort::Value cross_k, @@ -124,6 +124,9 @@ OfflineWhisperGreedySearchDecoder::Decode(Ort::Value cross_k,
124 std::get<5>(decoder_out).GetTensorMutableData<int64_t>(); 124 std::get<5>(decoder_out).GetTensorMutableData<int64_t>();
125 125
126 *p_offset += 1; 126 *p_offset += 1;
  127 + if (*p_offset >= n_text_ctx - 1) {
  128 + break;
  129 + }
127 130
128 const auto &logits = std::get<0>(decoder_out); 131 const auto &logits = std::get<0>(decoder_out);
129 const float *p_logits = logits.GetTensorData<float>(); 132 const float *p_logits = logits.GetTensorData<float>();