Skip to content

Commit d566358

Browse files
authored
tests : update VAD tests to use Silero V6.2.0 (#3534)
* tests : update VAD tests to use Silero V6.2.0 This commit updates the VAD tests to use the Silero V6.2.0 instead of V5.1.2. I'm was not sure if we needed to keep testing for both versions, but opted to just update to the latest version for simplicity. * wasm : use C++17 for emscripten builds This commit updates the CMakeLists.txt file to explicitly set the C++ standard to C++17 when building with Emscripten. The motivation for this change is that building with Emscripten will currently fail locally and on CI with the following error: ```console [ 75%] Building CXX object examples/CMakeFiles/common.dir/common-ggml.cpp.o In file included from /home/danbev/work/ai/whisper.cpp/examples/stream.wasm/emscripten.cpp:5: /home/danbev/work/utils/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:11:2: error: "embind requires -std=c++17 or newer" 11 | #error "embind requires -std=c++17 or newer" | ^ In file included from /home/danbev/work/ai/whisper.cpp/examples/whisper.wasm/emscripten.cpp:4: /home/danbev/work/utils/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:11:2: error: "embind requires -std=c++17 or newer" 11 | #error "embind requires -std=c++17 or newer" | ^ ```
1 parent 19ceec8 commit d566358

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ endif()
3434
if (EMSCRIPTEN)
3535
set(BUILD_SHARED_LIBS_DEFAULT OFF)
3636

37+
set(CMAKE_CXX_STANDARD 17)
38+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
39+
3740
option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON)
3841

3942
# TODO: without these, we get the following error:
-864 KB
Binary file not shown.
864 KB
Binary file not shown.

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ add_executable(${VAD_TEST} ${VAD_TEST}.cpp)
9494
target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../examples)
9595
target_link_libraries(${VAD_TEST} PRIVATE common)
9696
target_compile_definitions(${VAD_TEST} PRIVATE
97-
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin"
97+
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin"
9898
SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav")
9999
add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
100100
set_tests_properties(${VAD_TEST} PROPERTIES LABELS "unit")
@@ -106,7 +106,7 @@ target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../exa
106106
target_link_libraries(${VAD_TEST} PRIVATE common)
107107
target_compile_definitions(${VAD_TEST} PRIVATE
108108
WHISPER_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/ggml-base.en.bin"
109-
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin"
109+
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin"
110110
SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav")
111111
add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
112112
set_tests_properties(${VAD_TEST} PROPERTIES LABELS "base;en")

tests/test-vad-full.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ int main() {
4242
const int n_segments = whisper_full_n_segments(wctx);
4343
assert(n_segments == 1);
4444

45+
46+
printf("Segment text:\n%s", whisper_full_get_segment_text(wctx, 0));
4547
assert(strcmp(" And so my fellow Americans, ask not what your country can do for you,"
4648
" ask what you can do for your country.",
4749
whisper_full_get_segment_text(wctx, 0)) == 0);
48-
assert(whisper_full_get_segment_t0(wctx, 0) == 29);
49-
assert(whisper_full_get_segment_t1(wctx, 0) == 1049);
50+
assert(whisper_full_get_segment_t0(wctx, 0) == 32);
51+
assert(whisper_full_get_segment_t1(wctx, 0) == 1051);
5052

5153
whisper_free(wctx);
5254

tests/test-vad.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct whisper_vad_segments * test_detect_timestamps(
3636
struct whisper_vad_context * vctx,
3737
struct whisper_vad_params params) {
3838
struct whisper_vad_segments * timestamps = whisper_vad_segments_from_probs(vctx, params);
39-
assert(whisper_vad_segments_n_segments(timestamps) == 5);
39+
assert(whisper_vad_segments_n_segments(timestamps) == 4);
4040

4141
for (int i = 0; i < whisper_vad_segments_n_segments(timestamps); ++i) {
4242
printf("VAD segment %d: start = %.2f, end = %.2f\n", i,

0 commit comments

Comments
 (0)