From: Daniel Bevenius Date: Sat, 6 Dec 2025 09:58:58 +0000 (+0100) Subject: tests : update VAD tests to use Silero V6.2.0 (#3534) X-Git-Tag: upstream/1.8.3~283 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=d566358a1d339b471dc113303d008441f2abcc39;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp 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" | ^ ``` --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 517f30bb..b60bb045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,9 @@ endif() if (EMSCRIPTEN) set(BUILD_SHARED_LIBS_DEFAULT OFF) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON) # TODO: without these, we get the following error: diff --git a/models/for-tests-silero-v5.1.2-ggml.bin b/models/for-tests-silero-v5.1.2-ggml.bin deleted file mode 100644 index c5ddfb53..00000000 Binary files a/models/for-tests-silero-v5.1.2-ggml.bin and /dev/null differ diff --git a/models/for-tests-silero-v6.2.0-ggml.bin b/models/for-tests-silero-v6.2.0-ggml.bin new file mode 100644 index 00000000..e08fad67 Binary files /dev/null and b/models/for-tests-silero-v6.2.0-ggml.bin differ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0363193a..09e77ea8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -94,7 +94,7 @@ add_executable(${VAD_TEST} ${VAD_TEST}.cpp) target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../examples) target_link_libraries(${VAD_TEST} PRIVATE common) target_compile_definitions(${VAD_TEST} PRIVATE - VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin" + VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin" SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav") add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST}) set_tests_properties(${VAD_TEST} PROPERTIES LABELS "unit") @@ -106,7 +106,7 @@ target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../exa target_link_libraries(${VAD_TEST} PRIVATE common) target_compile_definitions(${VAD_TEST} PRIVATE WHISPER_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/ggml-base.en.bin" - VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin" + VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin" SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav") add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST}) set_tests_properties(${VAD_TEST} PROPERTIES LABELS "base;en") diff --git a/tests/test-vad-full.cpp b/tests/test-vad-full.cpp index 3bba36b1..8295b06d 100644 --- a/tests/test-vad-full.cpp +++ b/tests/test-vad-full.cpp @@ -42,11 +42,13 @@ int main() { const int n_segments = whisper_full_n_segments(wctx); assert(n_segments == 1); + + printf("Segment text:\n%s", whisper_full_get_segment_text(wctx, 0)); assert(strcmp(" And so my fellow Americans, ask not what your country can do for you," " ask what you can do for your country.", whisper_full_get_segment_text(wctx, 0)) == 0); - assert(whisper_full_get_segment_t0(wctx, 0) == 29); - assert(whisper_full_get_segment_t1(wctx, 0) == 1049); + assert(whisper_full_get_segment_t0(wctx, 0) == 32); + assert(whisper_full_get_segment_t1(wctx, 0) == 1051); whisper_free(wctx); diff --git a/tests/test-vad.cpp b/tests/test-vad.cpp index 535721c8..0003ae3a 100644 --- a/tests/test-vad.cpp +++ b/tests/test-vad.cpp @@ -36,7 +36,7 @@ struct whisper_vad_segments * test_detect_timestamps( struct whisper_vad_context * vctx, struct whisper_vad_params params) { struct whisper_vad_segments * timestamps = whisper_vad_segments_from_probs(vctx, params); - assert(whisper_vad_segments_n_segments(timestamps) == 5); + assert(whisper_vad_segments_n_segments(timestamps) == 4); for (int i = 0; i < whisper_vad_segments_n_segments(timestamps); ++i) { printf("VAD segment %d: start = %.2f, end = %.2f\n", i,