Skip to content

Commit f92325f

Browse files
authored
Add Silero VAD version 4 (#353)
1 parent 661b4e7 commit f92325f

37 files changed

+1976
-116
lines changed

.github/scripts/test-vad.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
log() {
6+
# This function is from espnet
7+
local fname=${BASH_SOURCE[1]##*/}
8+
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
9+
}
10+
11+
echo "EXE is $EXE"
12+
echo "PATH: $PATH"
13+
14+
which $EXE
15+
16+
cd build
17+
18+
curl -SL -O https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/sherpa-ncnn-silero-vad.tar.bz2
19+
tar xvf sherpa-ncnn-silero-vad.tar.bz2
20+
rm sherpa-ncnn-silero-vad.tar.bz2
21+
ls -lh sherpa-ncnn-silero-vad
22+
23+
curl -SL -O https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/lei-jun-test.wav
24+
25+
$EXE
26+
27+
ls -lh *.wav
28+
rm -rfv sherpa-ncnn-*
29+
rm *.wav

.github/workflows/aarch64-linux-gnu.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ on:
2323
- 'sherpa-ncnn/csrc/*'
2424
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'
2525

26+
workflow_dispatch:
27+
2628
concurrency:
2729
group: aarch64-linux-gnu-${{ github.ref }}
2830
cancel-in-progress: true

.github/workflows/android.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ jobs:
5353
with:
5454
fetch-depth: 0
5555

56+
- name: ccache
57+
uses: hendrikmuhs/[email protected]
58+
with:
59+
key: ${{ matrix.os }}-android
60+
5661
- name: Display NDK HOME
5762
shell: bash
5863
run: |
@@ -62,6 +67,9 @@ jobs:
6267
- name: build android arm64-v8a
6368
shell: bash
6469
run: |
70+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
71+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
72+
6573
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
6674
./build-android-arm64-v8a.sh
6775
mkdir -p jniLibs/arm64-v8a/
@@ -70,6 +78,9 @@ jobs:
7078
- name: build android armv7-eabi
7179
shell: bash
7280
run: |
81+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
82+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
83+
7384
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
7485
./build-android-armv7-eabi.sh
7586
mkdir -p ./jniLibs/armeabi-v7a/
@@ -78,6 +89,9 @@ jobs:
7889
- name: build android x86_64
7990
shell: bash
8091
run: |
92+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
93+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
94+
8195
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
8296
./build-android-x86-64.sh
8397
mkdir -p ./jniLibs/x86_64
@@ -86,6 +100,9 @@ jobs:
86100
- name: build android x86
87101
shell: bash
88102
run: |
103+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
104+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
105+
89106
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
90107
./build-android-x86.sh
91108
mkdir -p ./jniLibs/x86
@@ -117,10 +134,11 @@ jobs:
117134
git config --global user.email "[email protected]"
118135
git config --global user.name "Fangjun Kuang"
119136
137+
export GIT_CLONE_PROTECTION_ACTIVE=false
120138
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-ncnn-libs huggingface
121139
122140
cd huggingface
123-
git lfs pull
141+
git pull
124142
125143
cp -v ../sherpa-ncnn-*-android.tar.bz2 ./
126144

.github/workflows/arm-linux-gnueabihf.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ on:
2323
- 'sherpa-ncnn/csrc/*'
2424
- 'toolchains/arm-linux-gnueabihf.toolchain.cmake'
2525

26+
workflow_dispatch:
27+
2628
concurrency:
2729
group: arm-linux-gnueabihf-${{ github.ref }}
2830
cancel-in-progress: true

.github/workflows/build-wasm-simd.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ env:
3636
${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}
3737

3838
concurrency:
39-
group: linux-${{ github.ref }}
39+
group: build-wasm-simd-${{ github.ref }}
4040
cancel-in-progress: true
4141

4242
jobs:

.github/workflows/jni.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
- 'sherpa-ncnn/jni/*'
2323
- '.github/scripts/test-jni.sh'
2424

25+
workflow_dispatch:
26+
2527
concurrency:
2628
group: jni-${{ github.ref }}
2729
cancel-in-progress: true
@@ -42,6 +44,11 @@ jobs:
4244
with:
4345
fetch-depth: 0
4446

47+
- name: ccache
48+
uses: hendrikmuhs/[email protected]
49+
with:
50+
key: ${{ matrix.os }}-jni
51+
4552
- name: Display kotlin version
4653
shell: bash
4754
run: |
@@ -56,4 +63,7 @@ jobs:
5663
- name: Run JNI test
5764
shell: bash
5865
run: |
66+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
67+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
68+
5969
.github/scripts/test-jni.sh

.github/workflows/linux.yaml

+27-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
paths:
88
- '.github/workflows/linux.yaml'
99
- '.github/scripts/run-test.sh'
10+
- '.github/scripts/test-vad.sh'
1011
- 'CMakeLists.txt'
1112
- 'cmake/**'
1213
- 'sherpa-ncnn/csrc/*'
@@ -16,11 +17,14 @@ on:
1617
paths:
1718
- '.github/workflows/linux.yaml'
1819
- '.github/scripts/run-test.sh'
20+
- '.github/scripts/test-vad.sh'
1921
- 'CMakeLists.txt'
2022
- 'cmake/**'
2123
- 'sherpa-ncnn/csrc/*'
2224
- 'sherpa-ncnn/csrc/*'
2325

26+
workflow_dispatch:
27+
2428
concurrency:
2529
group: linux-${{ github.ref }}
2630
cancel-in-progress: true
@@ -37,19 +41,31 @@ jobs:
3741
os: [ubuntu-latest]
3842

3943
steps:
40-
- uses: actions/checkout@v2
44+
- uses: actions/checkout@v4
4145
with:
4246
fetch-depth: 0
4347

48+
- name: ccache
49+
uses: hendrikmuhs/[email protected]
50+
with:
51+
key: ${{ matrix.os }}-linux
52+
4453
- name: Configure CMake
4554
shell: bash
4655
run: |
56+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
57+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
58+
cmake --version
59+
4760
mkdir build
4861
cd build
4962
cmake -D CMAKE_BUILD_TYPE=Release -DSHERPA_NCNN_ENABLE_FFMPEG_EXAMPLES=OFF ..
5063
5164
- name: Build sherpa-ncnn for ubuntu
5265
run: |
66+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
67+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
68+
5369
cd build
5470
make -j2
5571
@@ -59,6 +75,9 @@ jobs:
5975
ls -lh bin/sherpa-ncnn
6076
file bin/sherpa-ncnn
6177
78+
ls -lh bin/sherpa-ncnn-vad
79+
file bin/sherpa-ncnn-vad
80+
6281
ls -lh bin/sherpa-ncnn-microphone
6382
file bin/sherpa-ncnn-microphone
6483
@@ -71,6 +90,13 @@ jobs:
7190
name: sherpa-ncnn-pre-built-binaries-os-${{ matrix.os }}
7291
path: ./build/bin
7392

93+
- name: Test vad
94+
run: |
95+
export PATH=$PWD/build/bin:$PATH
96+
export EXE=sherpa-ncnn-vad
97+
98+
.github/scripts/test-vad.sh
99+
74100
- name: Test sherpa-ncnn
75101
run: |
76102
export PATH=$PWD/build/bin:$PATH

.github/workflows/macos.yaml

+28-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
paths:
88
- '.github/workflows/macos.yaml'
99
- '.github/scripts/run-test.sh'
10+
- '.github/scripts/test-vad.sh'
1011
- 'CMakeLists.txt'
1112
- 'cmake/**'
1213
- 'sherpa-ncnn/csrc/*'
@@ -16,10 +17,13 @@ on:
1617
paths:
1718
- '.github/workflows/macos.yaml'
1819
- '.github/scripts/run-test.sh'
20+
- '.github/scripts/test-vad.sh'
1921
- 'CMakeLists.txt'
2022
- 'cmake/**'
2123
- 'sherpa-ncnn/csrc/*'
2224

25+
workflow_dispatch:
26+
2327
concurrency:
2428
group: macos-${{ github.ref }}
2529
cancel-in-progress: true
@@ -33,22 +37,34 @@ jobs:
3337
strategy:
3438
fail-fast: false
3539
matrix:
36-
os: [macos-latest]
40+
os: [macos-latest, macos-13]
3741

3842
steps:
39-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v4
4044
with:
4145
fetch-depth: 0
4246

47+
- name: ccache
48+
uses: hendrikmuhs/[email protected]
49+
with:
50+
key: ${{ matrix.os }}-macos
51+
4352
- name: Configure CMake
4453
shell: bash
4554
run: |
55+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
56+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
57+
cmake --version
58+
4659
mkdir build
4760
cd build
4861
cmake -D CMAKE_BUILD_TYPE=Release ..
4962
5063
- name: Build sherpa-ncnn for macos
5164
run: |
65+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
66+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
67+
5268
cd build
5369
make -j2
5470
@@ -58,6 +74,9 @@ jobs:
5874
ls -lh bin/sherpa-ncnn
5975
file bin/sherpa-ncnn
6076
77+
ls -lh bin/sherpa-ncnn-vad
78+
file bin/sherpa-ncnn-vad
79+
6180
ls -lh bin/sherpa-ncnn-microphone
6281
file bin/sherpa-ncnn-microphone
6382
@@ -70,6 +89,13 @@ jobs:
7089
name: sherpa-ncnn-pre-built-binaries-os-${{ matrix.os }}
7190
path: ./build/bin
7291

92+
- name: Test vad
93+
run: |
94+
export PATH=$PWD/build/bin:$PATH
95+
export EXE=sherpa-ncnn-vad
96+
97+
.github/scripts/test-vad.sh
98+
7399
- name: Test sherpa-ncnn
74100
run: |
75101
export PATH=$PWD/build/bin:$PATH

.github/workflows/npm.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
with:
2626
fetch-depth: 0
2727

28+
- name: ccache
29+
uses: hendrikmuhs/[email protected]
30+
with:
31+
key: ${{ matrix.os }}-npm
32+
2833
- name: Install emsdk
2934
uses: mymindstorm/setup-emsdk@v14
3035

@@ -59,6 +64,9 @@ jobs:
5964
env:
6065
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6166
run: |
67+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
68+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
69+
6270
./build-wasm-simd-for-nodejs.sh
6371
6472
cp -v build-wasm-simd-for-nodejs/install/bin/wasm/sherpa-ncnn-wasm-main.js ./scripts/nodejs

.github/workflows/swift-api-test.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ on:
2424
- 'sherpa-ncnn/swift-api-examples/*'
2525
- 'build-swift-macos.sh'
2626

27+
workflow_dispatch:
28+
2729
concurrency:
2830
group: swift-api-test-${{ github.ref }}
2931
cancel-in-progress: true
@@ -44,7 +46,15 @@ jobs:
4446
with:
4547
fetch-depth: 0
4648

49+
- name: ccache
50+
uses: hendrikmuhs/[email protected]
51+
with:
52+
key: ${{ matrix.os }}-swift
53+
4754
- name: Run swift-api-test
4855
shell: bash
4956
run: |
57+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
58+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
59+
5060
.github/scripts/swift-api-test.sh

.github/workflows/test-dot-net.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ on:
1515
- '.github/workflows/test-dot-net'
1616
- 'dotnet-examples/**'
1717

18+
workflow_dispatch:
19+
1820
schedule:
1921
# minute (0-59)
2022
# hour (0-23)
@@ -25,7 +27,7 @@ on:
2527
- cron: "50 23 * * *"
2628

2729
concurrency:
28-
group: test-dot-net
30+
group: test-dot-net-${{ github.ref }}
2931
cancel-in-progress: true
3032

3133
permissions:
@@ -44,13 +46,8 @@ jobs:
4446
with:
4547
fetch-depth: 0
4648

47-
- name: Setup .NET Core 3.1
48-
uses: actions/setup-dotnet@v1
49-
with:
50-
dotnet-version: 3.1.x
51-
5249
- name: Setup .NET 6.0
53-
uses: actions/setup-dotnet@v1
50+
uses: actions/setup-dotnet@v4
5451
with:
5552
dotnet-version: 6.0.x
5653

0 commit comments

Comments
 (0)