Skip to content

Commit

Permalink
Fix publishing pre-built windows libraries (#1905)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Feb 21, 2025
1 parent 9c810ce commit ed922e6
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 144 deletions.
18 changes: 9 additions & 9 deletions .github/scripts/test-offline-tts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ done
rm -rf kokoro-en-v0_19

log "------------------------------------------------------------"
log "matcha-tts-fa_en-male"
log "matcha-tts-fa_en-musa"
log "------------------------------------------------------------"
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-male.tar.bz2
tar xvf matcha-tts-fa_en-male.tar.bz2
rm matcha-tts-fa_en-male.tar.bz2
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-musa.tar.bz2
tar xvf matcha-tts-fa_en-musa.tar.bz2
rm matcha-tts-fa_en-musa.tar.bz2

curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx

$EXE \
--matcha-acoustic-model=./matcha-tts-fa_en-male/model.onnx \
--matcha-acoustic-model=./matcha-tts-fa_en-musa/model.onnx \
--matcha-vocoder=./hifigan_v2.onnx \
--matcha-tokens=./matcha-tts-fa_en-male/tokens.txt \
--matcha-data-dir=./matcha-tts-fa_en-male/espeak-ng-data \
--output-filename=./tts/test-matcha-fa-en-male.wav \
--matcha-tokens=./matcha-tts-fa_en-musa/tokens.txt \
--matcha-data-dir=./matcha-tts-fa_en-musa/espeak-ng-data \
--output-filename=./tts/test-matcha-fa-en-musa.wav \
--num-threads=2 \
"How are you doing today? این یک نمونه ی تست فارسی است. This is a test."

rm -rf matcha-tts-fa_en-male
rm -rf matcha-tts-fa_en-musa
rm hifigan_v2.onnx
ls -lh tts/*.wav

Expand Down
143 changes: 77 additions & 66 deletions .github/workflows/windows-x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,83 @@ jobs:
name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
path: build/install/*

- name: Copy files
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
suffix=shared
else
suffix=static
fi
if [[ ${{ matrix.with_tts }} == ON ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/
cp -a build/install/lib $dst/
cp -a build/install/include $dst/
tar cjvf ${dst}.tar.bz2 $dst
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
cd huggingface
mkdir -p win64
cp -v ../sherpa-onnx-*.tar.bz2 ./win64
git status
git lfs track "*.bz2"
git add .
git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
- name: Release pre-compiled binaries and libs for Windows x64
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x64*.tar.bz2
repo_name: k2-fsa/sherpa-onnx
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
tag: v1.10.45

- name: Release pre-compiled binaries and libs for Windows x64
if: github.repository_owner == 'k2-fsa'&& github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x64*.tar.bz2

- name: Test offline Moonshine for windows x64
shell: bash
run: |
Expand Down Expand Up @@ -224,69 +301,3 @@ jobs:
export EXE=decode-file-c-api.exe
.github/scripts/test-online-transducer.sh
- name: Copy files
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
suffix=shared
else
suffix=static
fi
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/
cp -a build/install/lib $dst/
cp -a build/install/include $dst/
tar cjvf ${dst}.tar.bz2 $dst
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
cd huggingface
mkdir -p win64
cp -v ../sherpa-onnx-*.tar.bz2 ./win64
git status
git lfs track "*.bz2"
git add .
git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
- name: Release pre-compiled binaries and libs for Windows x64
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x64*.tar.bz2
149 changes: 80 additions & 69 deletions .github/workflows/windows-x86.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,86 @@ jobs:
name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
path: build/install/*

- name: Copy files
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
suffix=shared
else
suffix=static
fi
if [[ ${{ matrix.with_tts }} == ON ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/
cp -a build/install/lib $dst/
cp -a build/install/include $dst/
tar cjvf ${dst}.tar.bz2 $dst
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
cd huggingface
mkdir -p win32
cp -v ../sherpa-onnx-*.tar.bz2 ./win32
git status
git lfs track "*.bz2"
git add .
git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
- name: Release pre-compiled binaries and libs for Windows x86
if: github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x86*.tar.bz2
repo_name: k2-fsa/sherpa-onnx
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
tag: v1.10.45

- name: Release pre-compiled binaries and libs for Windows x86
if: github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x86*.tar.bz2

- name: Test offline Moonshine for windows x86
shell: bash
run: |
Expand Down Expand Up @@ -223,72 +303,3 @@ jobs:
export EXE=decode-file-c-api.exe
.github/scripts/test-online-transducer.sh
- name: Copy files
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
suffix=shared
else
suffix=static
fi
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/
cp -a build/install/lib $dst/
cp -a build/install/include $dst/
tar cjvf ${dst}.tar.bz2 $dst
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
cd huggingface
mkdir -p win32
cp -v ../sherpa-onnx-*.tar.bz2 ./win32
git status
git lfs track "*.bz2"
git add .
git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-libs main
- name: Release pre-compiled binaries and libs for Windows x86
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-win-x86*.tar.bz2
3 changes: 3 additions & 0 deletions sherpa-onnx/csrc/offline-whisper-greedy-search-decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ OfflineWhisperGreedySearchDecoder::Decode(Ort::Value cross_k,
std::get<5>(decoder_out).GetTensorMutableData<int64_t>();

*p_offset += 1;
if (*p_offset >= n_text_ctx - 1) {
break;
}

const auto &logits = std::get<0>(decoder_out);
const float *p_logits = logits.GetTensorData<float>();
Expand Down

0 comments on commit ed922e6

Please sign in to comment.