-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64efbd8
commit 45b9d4a
Showing
39 changed files
with
1,835 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: export-whisper-to-onnx | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: release-whisper-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release-whisper-models: | ||
if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj' | ||
name: ${{ matrix.model }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest] | ||
model: ["tiny.en", "base.en", "small.en", "medium.en"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
python3 -m pip install openai-whisper torch onnxruntime onnx | ||
- name: export ${{ matrix.model }} | ||
shell: bash | ||
run: | | ||
cd scripts/whisper | ||
python3 ./export-onnx.py --model ${{ matrix.model }} | ||
python3 -m onnxruntime.tools.convert_onnx_models_to_ort --optimization_style=Fixed ./ | ||
ls -lh | ||
ls -lh ~/.cache/whisper | ||
- name: Publish ${{ matrix.model }} to huggingface | ||
shell: bash | ||
env: | ||
HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
run: | | ||
cd scripts/whisper | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Fangjun Kuang" | ||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-${{ matrix.model }} huggingface | ||
cp *.onnx ./huggingface | ||
cp *.ort ./huggingface | ||
cp *tokens.txt ./huggingface | ||
cd huggingface | ||
git status | ||
ls -lh | ||
git lfs track "*.onnx" | ||
git lfs track "*.ort" | ||
git add . | ||
git commit -m "upload ${{ matrix.model }}" | ||
git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-whisper-${{ matrix.model }} main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.onnx | ||
*.config | ||
*.ort | ||
*-tokens.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Introduction | ||
|
||
This folder contains code showing how to convert [Whisper][whisper] to onnx | ||
and use onnxruntime to replace PyTorch for speech recognition. | ||
|
||
You can use [sherpa-onnx][sherpa-onnx] to run the converted model. | ||
|
||
[whisper]: https://github.com/openai/whisper | ||
[sherpa-onnx]: https://github.com/k2-fsa/sherpa-onnx |
Oops, something went wrong.