Skip to content

Commit 7155163

Browse files
committed
cont
1 parent 481ad39 commit 7155163

File tree

12 files changed

+44
-39
lines changed

12 files changed

+44
-39
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ On Apple Silicon, the inference runs fully on the GPU via Metal:
5353

5454
https://github.com/ggerganov/whisper.cpp/assets/1991296/c82e8f86-60dc-49f2-b048-d2fdbd6b5225
5555

56-
Or you can even run it straight in the browser: [talk.wasm](examples/talk.wasm)
57-
5856
## Quick start
5957

6058
First clone the repository:
@@ -546,7 +544,7 @@ https://user-images.githubusercontent.com/1991296/223206245-2d36d903-cf8e-4f09-8
546544
## Benchmarks
547545

548546
In order to have an objective comparison of the performance of the inference across different system configurations,
549-
use the [bench](examples/bench) tool. The tool simply runs the Encoder part of the model and prints how much time it
547+
use the [whisper-bench](examples/bench) tool. The tool simply runs the Encoder part of the model and prints how much time it
550548
took to execute it. The results are summarized in the following Github issue:
551549

552550
[Benchmark results](https://github.com/ggerganov/whisper.cpp/issues/89)
@@ -609,12 +607,11 @@ Some of the examples are even ported to run in the browser using WebAssembly. Ch
609607

610608
| Example | Web | Description |
611609
| --------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
612-
| [cli](examples/cli) | [whisper.wasm](examples/whisper.wasm) | Tool for translating and transcribing audio using Whisper |
613-
| [bench](examples/bench) | [bench.wasm](examples/bench.wasm) | Benchmark the performance of Whisper on your machine |
614-
| [stream](examples/stream) | [stream.wasm](examples/stream.wasm) | Real-time transcription of raw microphone capture |
615-
| [command](examples/command) | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic |
610+
| [whisper-cli](examples/cli) | [whisper.wasm](examples/whisper.wasm) | Tool for translating and transcribing audio using Whisper |
611+
| [whisper-bench](examples/bench) | [bench.wasm](examples/bench.wasm) | Benchmark the performance of Whisper on your machine |
612+
| [whisper-stream](examples/stream) | [stream.wasm](examples/stream.wasm) | Real-time transcription of raw microphone capture |
613+
| [whisper-command](examples/command) | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic |
616614
| [wchess](examples/wchess) | [wchess.wasm](examples/wchess) | Voice-controlled chess |
617-
| [talk](examples/talk) | [talk.wasm](examples/talk.wasm) | Talk with a GPT-2 bot |
618615
| [talk-llama](examples/talk-llama) | | Talk with a LLaMA bot |
619616
| [whisper.objc](examples/whisper.objc) | | iOS mobile application using whisper.cpp |
620617
| [whisper.swiftui](examples/whisper.swiftui) | | SwiftUI iOS / macOS application using whisper.cpp |

examples/bench/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
set(TARGET bench)
1+
set(TARGET whisper-bench)
22
add_executable(${TARGET} bench.cpp)
33

44
include(DefaultTargetOptions)
55

66
target_link_libraries(${TARGET} PRIVATE whisper ${CMAKE_THREAD_LIBS_INIT})
7+
8+
install(TARGETS ${TARGET} RUNTIME)

examples/bench/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# bench
1+
# whisper.cpp/examples/bench
22

33
A very basic tool for benchmarking the inference performance on your device. The tool simply runs the Encoder part of
44
the transformer on some random audio data and records the execution time. This way we can have an objective comparison
@@ -7,11 +7,8 @@ of the performance of the model for various setups.
77
Benchmark results are tracked in the following Github issue: https://github.com/ggerganov/whisper.cpp/issues/89
88

99
```bash
10-
# build the bench tool
11-
$ make bench
12-
13-
# run it on the small.en model using 4 threads
14-
$ ./bench -m ./models/ggml-small.en.bin -t 4
10+
# run the bench too on the small.en model using 4 threads
11+
$ ./build/bin/whisper-bench -m ./models/ggml-small.en.bin -t 4
1512

1613
whisper_model_load: loading model from './models/ggml-small.en.bin'
1714
whisper_model_load: n_vocab = 51864

examples/command/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
if (WHISPER_SDL2)
2-
# command
3-
set(TARGET command)
2+
set(TARGET whisper-command)
43
add_executable(${TARGET} command.cpp)
54

65
include(DefaultTargetOptions)
76

87
target_link_libraries(${TARGET} PRIVATE common common-sdl whisper ${CMAKE_THREAD_LIBS_INIT})
8+
9+
install(TARGETS ${TARGET} RUNTIME)
910
endif ()

examples/command/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# command
1+
# whisper.cpp/examples/command
22

33
This is a basic Voice Assistant example that accepts voice commands from the microphone.
44
More info is available in [issue #171](https://github.com/ggerganov/whisper.cpp/issues/171).
55

66
```bash
77
# Run with default arguments and small model
8-
./command -m ./models/ggml-small.en.bin -t 8
8+
./whisper-command -m ./models/ggml-small.en.bin -t 8
99

1010
# On Raspberry Pi, use tiny or base models + "-ac 768" for better performance
11-
./command -m ./models/ggml-tiny.en.bin -ac 768 -t 3 -c 0
11+
./whisper-command -m ./models/ggml-tiny.en.bin -ac 768 -t 3 -c 0
1212
```
1313

1414
https://user-images.githubusercontent.com/1991296/204038393-2f846eae-c255-4099-a76d-5735c25c49da.mp4
@@ -23,18 +23,18 @@ Initial tests show that this approach might be extremely efficient in terms of p
2323

2424
```bash
2525
# Run in guided mode, the list of allowed commands is in commands.txt
26-
./command -m ./models/ggml-base.en.bin -cmd ./examples/command/commands.txt
26+
./whisper-command -m ./models/ggml-base.en.bin -cmd ./examples/command/commands.txt
2727

2828
# On Raspberry Pi, in guided mode you can use "-ac 128" for extra performance
29-
./command -m ./models/ggml-tiny.en.bin -cmd ./examples/command/commands.txt -ac 128 -t 3 -c 0
29+
./whisper-command -m ./models/ggml-tiny.en.bin -cmd ./examples/command/commands.txt -ac 128 -t 3 -c 0
3030
```
3131

3232
https://user-images.githubusercontent.com/1991296/207435352-8fc4ed3f-bde5-4555-9b8b-aeeb76bee969.mp4
3333

3434

3535
## Building
3636

37-
The `command` tool depends on SDL2 library to capture audio from the microphone. You can build it like this:
37+
The `whisper-command` tool depends on SDL2 library to capture audio from the microphone. You can build it like this:
3838

3939
```bash
4040
# Install SDL2
@@ -47,5 +47,6 @@ sudo dnf install SDL2 SDL2-devel
4747
# Install SDL2 on Mac OS
4848
brew install sdl2
4949

50-
make command
50+
cmake -B build -DWHISPER_SDL2=ON
51+
cmake --build build --config Release
5152
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
add_executable(main ./deprecation-warning.cpp)
22
target_compile_features(main PRIVATE cxx_std_11)
3+
4+
add_executable(bench ./deprecation-warning.cpp)
5+
target_compile_features(bench PRIVATE cxx_std_11)
6+
7+
add_executable(stream ./deprecation-warning.cpp)
8+
target_compile_features(stream PRIVATE cxx_std_11)

examples/stream/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
if (WHISPER_SDL2)
2-
# stream
3-
set(TARGET stream)
2+
set(TARGET whisper-stream)
43
add_executable(${TARGET} stream.cpp)
54

65
include(DefaultTargetOptions)
76

87
target_link_libraries(${TARGET} PRIVATE common common-sdl whisper ${CMAKE_THREAD_LIBS_INIT})
8+
9+
install(TARGETS ${TARGET} RUNTIME)
910
endif ()

examples/stream/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# stream
1+
# whisper.cpp/examples/stream
22

33
This is a naive example of performing real-time inference on audio from your microphone.
4-
The `stream` tool samples the audio every half a second and runs the transcription continously.
4+
The `whisper-stream` tool samples the audio every half a second and runs the transcription continously.
55
More info is available in [issue #10](https://github.com/ggerganov/whisper.cpp/issues/10).
66

77
```bash
8-
./build/bin/stream -m ./models/ggml-base.en.bin -t 8 --step 500 --length 5000
8+
./build/bin/whisper-stream -m ./models/ggml-base.en.bin -t 8 --step 500 --length 5000
99
```
1010

1111
https://user-images.githubusercontent.com/1991296/194935793-76afede7-cfa8-48d8-a80f-28ba83be7d09.mp4
@@ -15,7 +15,7 @@ https://user-images.githubusercontent.com/1991296/194935793-76afede7-cfa8-48d8-a
1515
Setting the `--step` argument to `0` enables the sliding window mode:
1616

1717
```bash
18-
./build/bin/stream -m ./models/ggml-base.en.bin -t 6 --step 0 --length 30000 -vth 0.6
18+
./build/bin/whisper-stream -m ./models/ggml-base.en.bin -t 6 --step 0 --length 30000 -vth 0.6
1919
```
2020

2121
In this mode, the tool will transcribe only after some speech activity is detected. A very
@@ -27,7 +27,7 @@ a transcription block that is suitable for parsing.
2727

2828
## Building
2929

30-
The `stream` tool depends on SDL2 library to capture audio from the microphone. You can build it like this:
30+
The `whisper-stream` tool depends on SDL2 library to capture audio from the microphone. You can build it like this:
3131

3232
```bash
3333
# Install SDL2
@@ -43,7 +43,7 @@ brew install sdl2
4343
cmake -B build -DWHISPER_SDL2=ON
4444
cmake --build build --config Release
4545

46-
./build/bin/stream
46+
./build/bin/whisper-stream
4747
```
4848

4949
## Web version

scripts/bench-all.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ if [ "$encoder_only" -eq 0 ]; then
3838
printf "Running memcpy benchmark\n"
3939
printf "\n"
4040

41-
./build/bin/bench -w 1 -t $n_threads 2>&1
41+
./build/bin/whisper-bench -w 1 -t $n_threads 2>&1
4242

4343
printf "\n"
4444
printf "Running ggml_mul_mat benchmark with $n_threads threads\n"
4545
printf "\n"
4646

47-
./build/bin/bench -w 2 -t $n_threads 2>&1
47+
./build/bin/whisper-bench -w 2 -t $n_threads 2>&1
4848

4949
printf "\n"
5050
printf "Running benchmark for all models\n"
@@ -64,7 +64,7 @@ printf "| %6s | %6s | %16s | %13s | %3s | %3s | %7s | %7s | %7s | %7s | %7s |\n"
6464
for model in "${models[@]}"; do
6565
# actual run
6666
# store stderr output in a variable in order to parse it later
67-
output=$(./build/bin/bench -m ./models/ggml-$model.bin -t $n_threads $fattn 2>&1)
67+
output=$(./build/bin/whisper-bench -m ./models/ggml-$model.bin -t $n_threads $fattn 2>&1)
6868
ret=$?
6969

7070
# parse the output:

scripts/bench-wts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ echo "Input file duration: ${DURATION}s"
2222

2323
for model in $models; do
2424
echo "Running $model"
25-
COMMAND="./main -m models/ggml-$model.bin -owts -f $1 -of $1.$model"
25+
COMMAND="./build/bin/whisper-cli -m models/ggml-$model.bin -owts -f $1 -of $1.$model"
2626

2727
if [ ! -z "$2" ]; then
2828
COMMAND="$COMMAND -fp $2"

0 commit comments

Comments
 (0)