Add C++ runtime and Python APIs for Moonshine models (#1473)
This commit is contained in:
50
.github/scripts/test-offline-moonshine.sh
vendored
Executable file
50
.github/scripts/test-offline-moonshine.sh
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
log() {
|
||||
# This function is from espnet
|
||||
local fname=${BASH_SOURCE[1]##*/}
|
||||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
|
||||
}
|
||||
|
||||
export GIT_CLONE_PROTECTION_ACTIVE=false
|
||||
|
||||
echo "EXE is $EXE"
|
||||
echo "PATH: $PATH"
|
||||
|
||||
which $EXE
|
||||
|
||||
names=(
|
||||
tiny
|
||||
base
|
||||
)
|
||||
|
||||
for name in ${names[@]}; do
|
||||
log "------------------------------------------------------------"
|
||||
log "Run $name"
|
||||
log "------------------------------------------------------------"
|
||||
|
||||
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-$name.tar.bz2
|
||||
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-$name-en-int8.tar.bz2
|
||||
curl -SL -O $repo_url
|
||||
tar xvf sherpa-onnx-moonshine-$name-en-int8.tar.bz2
|
||||
rm sherpa-onnx-moonshine-$name-en-int8.tar.bz2
|
||||
repo=sherpa-onnx-moonshine-$name-en-int8
|
||||
log "Start testing ${repo_url}"
|
||||
|
||||
log "test int8 onnx"
|
||||
|
||||
time $EXE \
|
||||
--moonshine-preprocessor=$repo/preprocess.onnx \
|
||||
--moonshine-encoder=$repo/encode.int8.onnx \
|
||||
--moonshine-uncached-decoder=$repo/uncached_decode.int8.onnx \
|
||||
--moonshine-cached-decoder=$repo/cached_decode.int8.onnx \
|
||||
--tokens=$repo/tokens.txt \
|
||||
--num-threads=2 \
|
||||
$repo/test_wavs/0.wav \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
rm -rf $repo
|
||||
done
|
||||
10
.github/scripts/test-python.sh
vendored
10
.github/scripts/test-python.sh
vendored
@@ -8,6 +8,16 @@ log() {
|
||||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
|
||||
}
|
||||
|
||||
log "test offline Moonshine"
|
||||
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
|
||||
tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
|
||||
rm sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
|
||||
|
||||
python3 ./python-api-examples/offline-moonshine-decode-files.py
|
||||
|
||||
rm -rf sherpa-onnx-moonshine-tiny-en-int8
|
||||
|
||||
log "test offline speaker diarization"
|
||||
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-segmentation-models/sherpa-onnx-pyannote-segmentation-3-0.tar.bz2
|
||||
|
||||
13
.github/workflows/linux.yaml
vendored
13
.github/workflows/linux.yaml
vendored
@@ -149,6 +149,19 @@ jobs:
|
||||
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
|
||||
path: install/*
|
||||
|
||||
- name: Test offline Moonshine
|
||||
if: matrix.build_type != 'Debug'
|
||||
shell: bash
|
||||
run: |
|
||||
du -h -d1 .
|
||||
export PATH=$PWD/build/bin:$PATH
|
||||
export EXE=sherpa-onnx-offline
|
||||
|
||||
readelf -d build/bin/sherpa-onnx-offline
|
||||
|
||||
.github/scripts/test-offline-moonshine.sh
|
||||
du -h -d1 .
|
||||
|
||||
- name: Test offline CTC
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
11
.github/workflows/macos.yaml
vendored
11
.github/workflows/macos.yaml
vendored
@@ -121,6 +121,15 @@ jobs:
|
||||
otool -L build/bin/sherpa-onnx
|
||||
otool -l build/bin/sherpa-onnx
|
||||
|
||||
- name: Test offline Moonshine
|
||||
if: matrix.build_type != 'Debug'
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=$PWD/build/bin:$PATH
|
||||
export EXE=sherpa-onnx-offline
|
||||
|
||||
.github/scripts/test-offline-moonshine.sh
|
||||
|
||||
- name: Test C++ API
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -243,8 +252,6 @@ jobs:
|
||||
|
||||
.github/scripts/test-offline-whisper.sh
|
||||
|
||||
|
||||
|
||||
- name: Test online transducer
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
8
.github/workflows/windows-x64.yaml
vendored
8
.github/workflows/windows-x64.yaml
vendored
@@ -93,6 +93,14 @@ jobs:
|
||||
name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
|
||||
path: build/install/*
|
||||
|
||||
- name: Test offline Moonshine for windows x64
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=$PWD/build/bin/Release:$PATH
|
||||
export EXE=sherpa-onnx-offline.exe
|
||||
|
||||
.github/scripts/test-offline-moonshine.sh
|
||||
|
||||
- name: Test C++ API
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
8
.github/workflows/windows-x86.yaml
vendored
8
.github/workflows/windows-x86.yaml
vendored
@@ -93,6 +93,14 @@ jobs:
|
||||
name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
|
||||
path: build/install/*
|
||||
|
||||
- name: Test offline Moonshine for windows x86
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=$PWD/build/bin/Release:$PATH
|
||||
export EXE=sherpa-onnx-offline.exe
|
||||
|
||||
.github/scripts/test-offline-moonshine.sh
|
||||
|
||||
- name: Test C++ API
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user