Fix whisper test script for the latest onnxruntime. (#494)
This commit is contained in:
15
.github/workflows/export-whisper-to-onnx.yaml
vendored
15
.github/workflows/export-whisper-to-onnx.yaml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install torch==1.13.0 -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
||||
python3 -m pip install torch==1.13.0 torchaudio==0.13.0 -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
||||
python3 -m pip install openai-whisper==20230314 onnxruntime onnx
|
||||
|
||||
- name: export ${{ matrix.model }}
|
||||
@@ -108,6 +108,19 @@ jobs:
|
||||
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
||||
tag: asr-models
|
||||
|
||||
- name: Test ${{ matrix.model }}
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install kaldi-native-fbank
|
||||
git checkout .
|
||||
model=${{ matrix.model }}
|
||||
src=sherpa-onnx-whisper-$model
|
||||
python3 scripts/whisper/test.py \
|
||||
--encoder $src/$model-encoder.int8.onnx \
|
||||
--decoder $src/$model-decoder.int8.onnx \
|
||||
--tokens $src/$model-tokens.txt \
|
||||
$src/test_wavs/0.wav
|
||||
|
||||
- name: Publish ${{ matrix.model }} to huggingface
|
||||
shell: bash
|
||||
env:
|
||||
|
||||
@@ -74,11 +74,11 @@ git lfs pull --include "*.onnx"
|
||||
|
||||
# remove .git to save spaces
|
||||
rm -rf .git
|
||||
rm README.md
|
||||
rm -fv README.md
|
||||
rm -rf test_wavs
|
||||
rm .gitattributes
|
||||
|
||||
rm *.ort
|
||||
rm -fv *.ort
|
||||
rm tiny.en-encoder.onnx
|
||||
rm tiny.en-decoder.onnx
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ class OnnxModel:
|
||||
self.encoder = ort.InferenceSession(
|
||||
encoder,
|
||||
sess_options=self.session_opts,
|
||||
providers=["CPUExecutionProvider"],
|
||||
)
|
||||
|
||||
meta = self.encoder.get_modelmeta().custom_metadata_map
|
||||
@@ -113,6 +114,7 @@ class OnnxModel:
|
||||
self.decoder = ort.InferenceSession(
|
||||
decoder,
|
||||
sess_options=self.session_opts,
|
||||
providers=["CPUExecutionProvider"],
|
||||
)
|
||||
|
||||
def run_encoder(
|
||||
|
||||
Reference in New Issue
Block a user