Add VAD example for Dart API (#996)

This commit is contained in:
Fangjun Kuang
2024-06-14 10:37:16 +08:00
committed by GitHub
parent c214d8fb74
commit d08cc04567
33 changed files with 883 additions and 142 deletions

View File

@@ -48,7 +48,7 @@ jobs:
path: ./wheelhouse/*.whl
- name: Publish to huggingface
if: matrix.python-version == 'cp38'
if: matrix.python-version == 'cp39'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
@@ -82,7 +82,13 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages wheel twine setuptools
opts='--break-system-packages'
v=${{ matrix.python-version }}
if [[ $v == cp38 || $v == cp39 ]]; then
opts=''
fi
python3 -m pip install $opts --upgrade pip
python3 -m pip install $opts wheel twine setuptools
twine upload ./wheelhouse/*.whl

View File

@@ -50,7 +50,7 @@ jobs:
path: ./wheelhouse/*.whl
- name: Publish to huggingface
if: matrix.python-version == 'cp38'
if: matrix.python-version == 'cp39'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3

View File

@@ -65,7 +65,7 @@ jobs:
path: ./wheelhouse/*.whl
- name: Publish to huggingface
if: matrix.python-version == 'cp38'
if: matrix.python-version == 'cp39'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
@@ -99,7 +99,13 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages wheel twine setuptools
opts='--break-system-packages'
v=${{ matrix.python-version }}
if [[ $v == cp38 || $v == cp39 ]]; then
opts=''
fi
python3 -m pip install $opts --upgrade pip
python3 -m pip install $opts wheel twine setuptools
twine upload ./wheelhouse/*.whl

View File

@@ -152,6 +152,8 @@ jobs:
- name: Build flutter
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
d=$PWD
pushd sherpa-onnx/flutter
@@ -166,7 +168,7 @@ jobs:
tree ./sherpa_onnx.app
app=flutter_sherpa_onnx_macos_${{ matrix.arch }}.app
app=sherpa-onnx-osx-${{ matrix.arch }}-$SHERPA_ONNX_VERSION.app
mv sherpa_onnx.app $app
tar cjfv $app.tar.bz2 $app
ls -lh
@@ -178,13 +180,43 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: flutter-sherpa-onnx-app-macos-${{ matrix.arch }}
name: sherpa-onnx-osx-${{ matrix.arch }}
path: ./*.tar.bz2
- name: Release android libs
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
- name: Publish to huggingface
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
file_glob: true
overwrite: true
file: flutter*.tar.bz2
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
export GIT_CLONE_PROTECTION_ACTIVE=false
git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface
cd huggingface
git fetch
git pull
git merge -m "merge remote" --ff origin main
mkdir -p flutter
cp -v ../*.tar.bz2 ./flutter
git status
git lfs track "*.bz2"
git add .
git commit -m "add more files"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main
# - name: Release android libs
# 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*.tar.bz2

View File

@@ -142,7 +142,7 @@ jobs:
cd build/windows/x64/runner/
dst=flutter_sherpa_onnx_windows_x64
dst=sherpa-onnx-win-x64-$SHERPA_ONNX_VERSION
mv Release $dst
tar cjfv $dst.tar.bz2 ./$dst
@@ -155,13 +155,43 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: flutter-sherpa-onnx-windows-x64
name: sherpa-onnx-win-x64
path: ./*.tar.bz2
- name: Release android libs
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
- name: Publish to huggingface
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
file_glob: true
overwrite: true
file: flutter*.tar.bz2
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
export GIT_CLONE_PROTECTION_ACTIVE=false
git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface
cd huggingface
git fetch
git pull
git merge -m "merge remote" --ff origin main
mkdir -p flutter
cp -v ../*.tar.bz2 ./flutter
git status
git lfs track "*.bz2"
git add .
git commit -m "add more files"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main
# - name: Release android libs
# 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*.tar.bz2

60
.github/workflows/test-dart.yaml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: test-dart
on:
push:
branches:
- master
paths:
- '.github/workflows/test-dart.yaml'
- 'dart-api-examples/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/test-dart.yaml'
- 'dart-api-examples/**'
workflow_dispatch:
concurrency:
group: test-dart-${{ github.ref }}
cancel-in-progress: true
jobs:
dart:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest] #, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: latest
- name: Display flutter info
shell: bash
run: |
which flutter
which dart
flutter --version
dart --version
flutter doctor
- name: Run tests
shell: bash
run: |
cd dart-api-examples
pushd vad
./run.sh
popd