Skip to content

Commit 2cdfc4e

Browse files
authored
whisper : add support for large v3 (ggml-org#1444)
* whisper : add support for large v3 * bench : fix build + fix go bindings * bench : fix n_mels * models : update readme
1 parent 9731110 commit 2cdfc4e

20 files changed

+70
-38
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,10 @@ samples:
417417
.PHONY: medium.en
418418
.PHONY: medium
419419
.PHONY: large-v1
420+
.PHONY: large-v2
420421
.PHONY: large
421422

422-
tiny.en tiny base.en base small.en small medium.en medium large-v1 large: main
423+
tiny.en tiny base.en base small.en small medium.en medium large-v1 large-v2 large: main
423424
bash ./models/download-ggml-model.sh $@
424425
@echo ""
425426
@echo "==============================================="

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ make small
234234
make medium.en
235235
make medium
236236
make large-v1
237+
make large-v2
237238
make large
238239
```
239240

@@ -245,7 +246,7 @@ make large
245246
| base | 142 MB | ~210 MB | `465707469ff3a37a2b9b8d8f89f2f99de7299dac` |
246247
| small | 466 MB | ~600 MB | `55356645c2b361a969dfd0ef2c5a50d530afd8d5` |
247248
| medium | 1.5 GB | ~1.7 GB | `fd9727b6e1217c2f614f9b698455c4ffd82463b4` |
248-
| large | 2.9 GB | ~3.3 GB | `0f4c8e34f21cf1a914c59d8b3ce882345ad349d6` |
249+
| large | 2.9 GB | ~3.3 GB | `ad82bf6a9043ceed055076d0fd39f5f186ff8062` |
249250

250251
## Quantization
251252

bindings/go/examples/go-model-download/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424

2525
var (
2626
// The models which will be downloaded, if no model is specified as an argument
27-
modelNames = []string{"ggml-tiny.en", "ggml-tiny", "ggml-base.en", "ggml-base", "ggml-small.en", "ggml-small", "ggml-medium.en", "ggml-medium", "ggml-large-v1", "ggml-large"}
27+
modelNames = []string{"ggml-tiny.en", "ggml-tiny", "ggml-base.en", "ggml-base", "ggml-small.en", "ggml-small", "ggml-medium.en", "ggml-medium", "ggml-large-v1", "ggml-large-v2", "ggml-large"}
2828
)
2929

3030
var (

bindings/go/whisper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ const (
8383
SampleRate = C.WHISPER_SAMPLE_RATE // Expected sample rate, samples per second
8484
SampleBits = uint16(unsafe.Sizeof(C.float(0))) * 8 // Sample size in bits
8585
NumFFT = C.WHISPER_N_FFT
86-
NumMEL = C.WHISPER_N_MEL
8786
HopLength = C.WHISPER_HOP_LENGTH
8887
ChunkSize = C.WHISPER_CHUNK_SIZE
8988
)

examples/bench.wasm/emscripten.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ void bench_main(size_t index) {
2323

2424
fprintf(stderr, "%s: running benchmark with %d threads - please wait...\n", __func__, n_threads);
2525

26-
if (int ret = whisper_set_mel(ctx, nullptr, 0, WHISPER_N_MEL)) {
26+
const int n_mels = whisper_model_n_mels(ctx);
27+
28+
if (int ret = whisper_set_mel(ctx, nullptr, 0, n_mels)) {
2729
fprintf(stderr, "error: failed to set mel: %d\n", ret);
2830
return;
2931
}

examples/bench/bench.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ int whisper_bench_full(const whisper_params & params) {
7373
return 2;
7474
}
7575

76-
if (int ret = whisper_set_mel(ctx, nullptr, 0, WHISPER_N_MEL)) {
76+
const int n_mels = whisper_model_n_mels(ctx);
77+
78+
if (int ret = whisper_set_mel(ctx, nullptr, 0, n_mels)) {
7779
fprintf(stderr, "error: failed to set mel: %d\n", ret);
7880
return 3;
7981
}

examples/livestream.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if [ -n "$3" ]; then
4848
fi
4949

5050
# Whisper models
51-
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large-v1" "large" )
51+
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large-v1" "large-v2" "large" )
5252

5353
# list available models
5454
function list_models {

examples/twitch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ help()
2121
echo "Usage: ./twitch.sh -s [step] -m [model] -t [threads] [url]"
2222
echo "options:"
2323
echo "-s Step in seconds (default is $step)."
24-
echo "-m Choose model, options are: 'tiny.en' 'tiny' 'base.en' 'base' 'small.en' 'small' 'medium.en' 'medium' 'large-v1' 'large' (default is '$model')."
24+
echo "-m Choose model, options are: 'tiny.en' 'tiny' 'base.en' 'base' 'small.en' 'small' 'medium.en' 'medium' 'large-v1' 'large-v2' 'large' (default is '$model')."
2525
echo "-t Number of threads to use."
2626
echo "-h Print this help page."
2727
echo

extra/convert-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large-v1" "large" )
3+
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large-v1" "large-v2" "large" )
44

55
for model in "${models[@]}"; do
66
python3 models/convert-pt-to-ggml.py ~/.cache/whisper/$model.pt ../whisper models/

models/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ https://huggingface.co/ggerganov/whisper.cpp/tree/main
5050
| medium | 1.5 GB | ~2.6 GB | `fd9727b6e1217c2f614f9b698455c4ffd82463b4` |
5151
| medium.en | 1.5 GB | ~2.6 GB | `8c30f0e44ce9560643ebd10bbe50cd20eafd3723` |
5252
| large-v1 | 2.9 GB | ~4.7 GB | `b1caaf735c4cc1429223d5a74f0f4d0b9b59a299` |
53-
| large | 2.9 GB | ~4.7 GB | `0f4c8e34f21cf1a914c59d8b3ce882345ad349d6` |
53+
| large-v2 | 2.9 GB | ~4.7 GB | `0f4c8e34f21cf1a914c59d8b3ce882345ad349d6` |
54+
| large | 2.9 GB | ~4.7 GB | `ad82bf6a9043ceed055076d0fd39f5f186ff8062` |
5455

5556
## Model files for testing purposes
5657

0 commit comments

Comments
 (0)