ch9344: 2.0 -> 0-unstable-2024-11-15 (#354536)
[NixPkgs.git] / pkgs / tools / audio / openai-whisper-cpp / download-models.patch
blob7589c2ef36f8358b184288cb64b513121f592646
1 diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh
2 index 1f1075b..7476c8e 100755
3 --- a/models/download-ggml-model.sh
4 +++ b/models/download-ggml-model.sh
5 @@ -12,18 +12,6 @@ pfx="resolve/main/ggml"
6 BOLD="\033[1m"
7 RESET='\033[0m'
9 -# get the path of this script
10 -get_script_path() {
11 - if [ -x "$(command -v realpath)" ]; then
12 - dirname "$(realpath "$0")"
13 - else
14 - _ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"
15 - echo "$_ret"
16 - fi
19 -models_path="${2:-$(get_script_path)}"
21 # Whisper models
22 models="tiny
23 tiny.en
24 @@ -64,8 +52,8 @@ list_models() {
25 printf "\n\n"
28 -if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
29 - printf "Usage: %s <model> [models_path]\n" "$0"
30 +if [ "$#" -ne 1 ]; then
31 + printf "Usage: %s <model>\n" "$0"
32 list_models
33 printf "___________________________________________________________\n"
34 printf "${BOLD}.en${RESET} = english-only ${BOLD}-q5_[01]${RESET} = quantized ${BOLD}-tdrz${RESET} = tinydiarize\n"
35 @@ -94,8 +82,6 @@ echo "$model" | grep -q '^"tdrz"*$'
37 printf "Downloading ggml model %s from '%s' ...\n" "$model" "$src"
39 -cd "$models_path" || exit
41 if [ -f "ggml-$model.bin" ]; then
42 printf "Model %s already exists. Skipping download.\n" "$model"
43 exit 0
44 @@ -116,7 +102,7 @@ if [ $? -ne 0 ]; then
45 exit 1
48 -printf "Done! Model '%s' saved in '%s/ggml-%s.bin'\n" "$model" "$models_path" "$model"
49 +printf "Done! Model '%s' saved in 'ggml-%s.bin'\n" "$model" "$model"
50 printf "You can now use it like this:\n\n"
51 -printf " $ ./main -m %s/ggml-%s.bin -f samples/jfk.wav\n" "$models_path" "$model"
52 +printf " $ whisper-cpp -m ggml-%s.bin -f samples/jfk.wav\n" "$model"
53 printf "\n"