Export speaker verification models from NeMo to ONNX (#526)

This commit is contained in:
Fangjun Kuang
2024-01-13 19:49:45 +08:00
committed by GitHub
parent afc81ec122
commit 68a525a024
10 changed files with 448 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e
set -ex
log() {
# This function is from espnet
@@ -21,18 +21,19 @@ model_dir=$d/wespeaker
mkdir -p $model_dir
pushd $model_dir
models=(
en_voxceleb_CAM++.onnx
en_voxceleb_CAM++_LM.onnx
en_voxceleb_resnet152_LM.onnx
en_voxceleb_resnet221_LM.onnx
en_voxceleb_resnet293_LM.onnx
en_voxceleb_resnet34.onnx
en_voxceleb_resnet34_LM.onnx
zh_cnceleb_resnet34.onnx
zh_cnceleb_resnet34_LM.onnx
wespeaker_en_voxceleb_CAM++.onnx
wespeaker_en_voxceleb_CAM++_LM.onnx
wespeaker_en_voxceleb_resnet152_LM.onnx
wespeaker_en_voxceleb_resnet221_LM.onnx
wespeaker_en_voxceleb_resnet293_LM.onnx
wespeaker_en_voxceleb_resnet34.onnx
wespeaker_en_voxceleb_resnet34_LM.onnx
wespeaker_zh_cnceleb_resnet34.onnx
wespeaker_zh_cnceleb_resnet34_LM.onnx
)
for m in ${models[@]}; do
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/wespeaker_en_voxceleb_CAM++_LM.onnx
done
ls -lh
popd
@@ -42,13 +43,13 @@ model_dir=$d/3dspeaker
mkdir -p $model_dir
pushd $model_dir
models=(
speech_campplus_sv_en_voxceleb_16k.onnx
speech_campplus_sv_zh-cn_16k-common.onnx
speech_eres2net_base_200k_sv_zh-cn_16k-common.onnx
speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx
speech_eres2net_large_sv_zh-cn_3dspeaker_16k.onnx
speech_eres2net_sv_en_voxceleb_16k.onnx
speech_eres2net_sv_zh-cn_16k-common.onnx
3dspeaker_speech_campplus_sv_en_voxceleb_16k.onnx
3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx
3dspeaker_speech_eres2net_base_200k_sv_zh-cn_16k-common.onnx
3dspeaker_speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx
3dspeaker_speech_eres2net_large_sv_zh-cn_3dspeaker_16k.onnx
3dspeaker_speech_eres2net_sv_en_voxceleb_16k.onnx
3dspeaker_speech_eres2net_sv_zh-cn_16k-common.onnx
)
for m in ${models[@]}; do
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m

View File

@@ -0,0 +1,45 @@
name: export-nemo-speaker-verification-to-onnx
on:
workflow_dispatch:
concurrency:
group: export-nemo-speaker-verification-to-onnx-${{ github.ref }}
cancel-in-progress: true
jobs:
export-nemo-speaker-verification-to-onnx:
if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj'
name: export nemo speaker verification models to ONNX
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run
shell: bash
run: |
cd scripts/nemo/speaker-verification
./run.sh
mv -v *.onnx ../../..
- name: Release
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
file: ./*.onnx
overwrite: true
repo_name: k2-fsa/sherpa-onnx
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
tag: speaker-recongition-models