Skip to content

examples : add wer cli example #2990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

danbev
Copy link
Collaborator

@danbev danbev commented Apr 2, 2025

This commit add as suggestion for a Word Error Rate calculation example.

The motivation for this is that this could be used for WER testing. Usage:

$ ./build/bin/whisper-wer
Usage: ./build/bin/whisper-wer [options]
Options:
  -r, --reference PATH   Full path to reference transcriptions directory
  -a, --actual PATH      Full path to actual transcriptions directory
  --help                 Display this help message

Example usage:

$ ./build/bin/whisper-wer -r examples/wer/reference_transcriptions/ \
                          -a examples/wer/actual_transcriptions/
Word Error Rate for : jfk.wav.txt
  Reference words: 22
  Actual words: 22
  Substitutions: 1
  Deletions: 0
  Insertions: 0
  Total edits: 1
  WER: 0.045455

A more detailed description can be found in examples/wer/README.md.

A unit test is provided in tests/test-wer.cpp.

$ cmake --build build --target test-wer && \
  ctest -R test-wer --test-dir build --output-on-failure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol 😄

danbev added 3 commits April 3, 2025 06:39
This commit add as suggestion for a Word Error Rate calculation
example.

The motivation for this is that this could be used for WER testing.
Usage:
```console
$ ./build/bin/whisper-wer
Usage: ./build/bin/whisper-wer [options]
Options:
  -r, --reference PATH   Full path to reference transcriptions directory
  -a, --actual PATH      Full path to actual transcriptions directory
  --help                 Display this help message
```

Example usage:
```console
$ ./build/bin/whisper-wer -r examples/wer/reference_transcriptions/ \
                          -a examples/wer/actual_transcriptions/
Word Error Rate for : jfk.wav.txt
  Reference words: 22
  Actual words: 22
  Substitutions: 1
  Deletions: 0
  Insertions: 0
  Total edits: 1
  WER: 0.045455
```

A more detailed description can be found in examples/wer/README.md.

A unit test is provided in tests/test-wer.cpp.
```console
$ cmake --build build --target test-wer && \
  ctest -R test-wer --test-dir build --output-on-failure
```
This commit adds the C++17 standard to the CMakeLists.txt file.

The motivatiion for this is that ggml sets this and it would seem
alright to have the same standard in whisper too.
This commit adds pthread to the test-wer target for FreeBSD. This is
necessary to avoid the following error:
```console
[68%] Linking CXX executable ../bin/test-wer
ld: error: undefined reference due to --no-allow-shlib-undefined: pthread_create
>>> referenced by ../src/libwhisper.so.1.7.4
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [tests/CMakeFiles/test-wer.dir/build.make:106: bin/test-wer] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1421: tests/CMakeFiles/test-wer.dir/all] Error 2
```

Refs: https://github.com/ggerganov/whisper.cpp/actions/runs/14218829646/job/39841747819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants