mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-07-23 11:10:57 -05:00
docs : make model options / model install methods clearer (#1806)
* Make models more "discoverable" * Clean up code block language identifiers * make 3 options clearer * undo Prettier formatter change * docs: `$` shell prompt, consistently * docs: minor changes
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
## Whisper model files in custom ggml format
|
||||
## Whisper model files in custom `ggml` format
|
||||
|
||||
The [original Whisper PyTorch models provided by OpenAI](https://github.com/openai/whisper/blob/main/whisper/__init__.py#L17-L27)
|
||||
The [original Whisper PyTorch models provided by OpenAI](https://github.com/openai/whisper/blob/main/whisper/__init__.py#L17-L30)
|
||||
are converted to custom `ggml` format in order to be able to load them in C/C++.
|
||||
Conversion is performed using the [convert-pt-to-ggml.py](convert-pt-to-ggml.py) script.
|
||||
|
||||
You can either obtain the original models and generate the `ggml` files yourself using the conversion script,
|
||||
or you can use the [download-ggml-model.sh](download-ggml-model.sh) script to download the already converted models.
|
||||
Currently, they are hosted on the following locations:
|
||||
There are three ways to obtain `ggml` models:
|
||||
|
||||
- https://huggingface.co/ggerganov/whisper.cpp
|
||||
- https://ggml.ggerganov.com
|
||||
### 1. Use [download-ggml-model.sh](download-ggml-model.sh) to download pre-converted models
|
||||
|
||||
Sample download:
|
||||
Example download:
|
||||
|
||||
```java
|
||||
```text
|
||||
$ ./download-ggml-model.sh base.en
|
||||
Downloading ggml model base.en ...
|
||||
models/ggml-base.en.bin 100%[=============================================>] 141.11M 5.41MB/s in 22s
|
||||
@@ -23,35 +20,46 @@ You can now use it like this:
|
||||
$ ./main -m models/ggml-base.en.bin -f samples/jfk.wav
|
||||
```
|
||||
|
||||
To convert the files yourself, use the convert-pt-to-ggml.py script. Here is an example usage.
|
||||
The original PyTorch files are assumed to have been downloaded into ~/.cache/whisper
|
||||
Change `~/path/to/repo/whisper/` to the location for your copy of the Whisper source:
|
||||
```
|
||||
### 2. Manually download pre-converted models
|
||||
|
||||
`ggml` models are available from the following locations:
|
||||
|
||||
- https://huggingface.co/ggerganov/whisper.cpp/tree/main
|
||||
- https://ggml.ggerganov.com
|
||||
|
||||
### 3. Convert with [convert-pt-to-ggml.py](convert-pt-to-ggml.py)
|
||||
|
||||
Download one of the [models provided by OpenAI](https://github.com/openai/whisper/blob/main/whisper/__init__.py#L17-L30) and generate the `ggml` files using the [convert-pt-to-ggml.py](convert-pt-to-ggml.py) script.
|
||||
|
||||
Example conversion, assuming the original PyTorch files have been downloaded into `~/.cache/whisper`. Change `~/path/to/repo/whisper/` to the location for your copy of the Whisper source:
|
||||
|
||||
```bash
|
||||
mkdir models/whisper-medium
|
||||
python models/convert-pt-to-ggml.py ~/.cache/whisper/medium.pt ~/path/to/repo/whisper/ ./models/whisper-medium
|
||||
mv ./models/whisper-medium/ggml-model.bin models/ggml-medium.bin
|
||||
rmdir models/whisper-medium
|
||||
```
|
||||
|
||||
A third option to obtain the model files is to download them from Hugging Face:
|
||||
|
||||
https://huggingface.co/ggerganov/whisper.cpp/tree/main
|
||||
|
||||
## Available models
|
||||
|
||||
| Model | Disk | SHA |
|
||||
| --- | --- | --- |
|
||||
| tiny | 75 MiB | `bd577a113a864445d4c299885e0cb97d4ba92b5f` |
|
||||
| tiny.en | 75 MiB | `c78c86eb1a8faa21b369bcd33207cc90d64ae9df` |
|
||||
| base | 142 MiB | `465707469ff3a37a2b9b8d8f89f2f99de7299dac` |
|
||||
| base.en | 142 MiB | `137c40403d78fd54d454da0f9bd998f78703390c` |
|
||||
| small | 466 MiB | `55356645c2b361a969dfd0ef2c5a50d530afd8d5` |
|
||||
| small.en | 466 MiB | `db8a495a91d927739e50b3fc1cc4c6b8f6c2d022` |
|
||||
| medium | 1.5 GiB | `fd9727b6e1217c2f614f9b698455c4ffd82463b4` |
|
||||
| medium.en | 1.5 GiB | `8c30f0e44ce9560643ebd10bbe50cd20eafd3723` |
|
||||
| large-v1 | 2.9 GiB | `b1caaf735c4cc1429223d5a74f0f4d0b9b59a299` |
|
||||
| large-v2 | 2.9 GiB | `0f4c8e34f21cf1a914c59d8b3ce882345ad349d6` |
|
||||
| large-v3 | 2.9 GiB | `ad82bf6a9043ceed055076d0fd39f5f186ff8062` |
|
||||
| Model | Disk | SHA |
|
||||
| ------------- | ------- | ------------------------------------------ |
|
||||
| tiny | 75 MiB | `bd577a113a864445d4c299885e0cb97d4ba92b5f` |
|
||||
| tiny.en | 75 MiB | `c78c86eb1a8faa21b369bcd33207cc90d64ae9df` |
|
||||
| base | 142 MiB | `465707469ff3a37a2b9b8d8f89f2f99de7299dac` |
|
||||
| base.en | 142 MiB | `137c40403d78fd54d454da0f9bd998f78703390c` |
|
||||
| small | 466 MiB | `55356645c2b361a969dfd0ef2c5a50d530afd8d5` |
|
||||
| small.en | 466 MiB | `db8a495a91d927739e50b3fc1cc4c6b8f6c2d022` |
|
||||
| small.en-tdrz | 465 MiB | `b6c6e7e89af1a35c08e6de56b66ca6a02a2fdfa1` |
|
||||
| medium | 1.5 GiB | `fd9727b6e1217c2f614f9b698455c4ffd82463b4` |
|
||||
| medium.en | 1.5 GiB | `8c30f0e44ce9560643ebd10bbe50cd20eafd3723` |
|
||||
| large-v1 | 2.9 GiB | `b1caaf735c4cc1429223d5a74f0f4d0b9b59a299` |
|
||||
| large-v2 | 2.9 GiB | `0f4c8e34f21cf1a914c59d8b3ce882345ad349d6` |
|
||||
| large-v2-q5_0 | 1.1 GiB | `00e39f2196344e901b3a2bd5814807a769bd1630` |
|
||||
| large-v3 | 2.9 GiB | `ad82bf6a9043ceed055076d0fd39f5f186ff8062` |
|
||||
| large-v3-q5_0 | 1.1 GiB | `e6e2ed78495d403bef4b7cff42ef4aaadcfea8de` |
|
||||
|
||||
Models are multilingual unless the model name includes `.en`. Models ending in `-q5_0` are [quantized](../README.md#quantization). Models ending in `-tdrz` support local diarization (marking of speaker turns) using [tinydiarize](https://github.com/akashmjn/tinydiarize). More information about models is available [upstream (openai/whisper)](https://github.com/openai/whisper#available-models-and-languages). The list above is a subset of the models supported by the [download-ggml-model.sh](download-ggml-model.sh) script, but many more are available at https://huggingface.co/ggerganov/whisper.cpp/tree/main and elsewhere.
|
||||
|
||||
## Model files for testing purposes
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
src="https://huggingface.co/ggerganov/whisper.cpp"
|
||||
pfx="resolve/main/ggml"
|
||||
|
||||
BOLD="\033[1m"
|
||||
RESET='\033[0m'
|
||||
|
||||
# get the path of this script
|
||||
get_script_path() {
|
||||
if [ -x "$(command -v realpath)" ]; then
|
||||
@@ -22,17 +25,17 @@ get_script_path() {
|
||||
models_path="${2:-$(get_script_path)}"
|
||||
|
||||
# Whisper models
|
||||
models="tiny.en
|
||||
tiny
|
||||
models="tiny
|
||||
tiny.en
|
||||
tiny-q5_1
|
||||
tiny.en-q5_1
|
||||
base.en
|
||||
base
|
||||
base.en
|
||||
base-q5_1
|
||||
base.en-q5_1
|
||||
small
|
||||
small.en
|
||||
small.en-tdrz
|
||||
small
|
||||
small-q5_1
|
||||
small.en-q5_1
|
||||
medium
|
||||
@@ -41,14 +44,21 @@ medium-q5_0
|
||||
medium.en-q5_0
|
||||
large-v1
|
||||
large-v2
|
||||
large-v2-q5_0
|
||||
large-v3
|
||||
large-v3-q5_0"
|
||||
|
||||
# list available models
|
||||
list_models() {
|
||||
printf "\n"
|
||||
printf " Available models:"
|
||||
printf "Available models:"
|
||||
model_class=""
|
||||
for model in $models; do
|
||||
this_model_class="${model%%[.-]*}"
|
||||
if [ "$this_model_class" != "$model_class" ]; then
|
||||
printf "\n "
|
||||
model_class=$this_model_class
|
||||
fi
|
||||
printf " %s" "$model"
|
||||
done
|
||||
printf "\n\n"
|
||||
@@ -57,6 +67,8 @@ list_models() {
|
||||
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||
printf "Usage: %s <model> [models_path]\n" "$0"
|
||||
list_models
|
||||
printf "___________________________________________________________\n"
|
||||
printf "${BOLD}.en${RESET} = english-only ${BOLD}-q5_[01]${RESET} = quantized ${BOLD}-tdrz${RESET} = tinydiarize\n"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
@@ -98,14 +110,12 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "Failed to download ggml model %s \n" "$model"
|
||||
printf "Please try again later or download the original Whisper model files and convert them yourself.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
printf "Done! Model '%s' saved in '%s/ggml-%s.bin'\n" "$model" "$models_path" "$model"
|
||||
printf "You can now use it like this:\n\n"
|
||||
printf " $ ./main -m %s/ggml-%s.bin -f samples/jfk.wav\n" "$models_path" "$model"
|
||||
|
||||
Reference in New Issue
Block a user