about summary refs log tree commit diff
path: root/pkgs/tools/audio/openai-whisper-cpp/download-models.patch
blob: 7589c2ef36f8358b184288cb64b513121f592646 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh
index 1f1075b..7476c8e 100755
--- a/models/download-ggml-model.sh
+++ b/models/download-ggml-model.sh
@@ -12,18 +12,6 @@ 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
-        dirname "$(realpath "$0")"
-    else
-        _ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"
-        echo "$_ret"
-    fi
-}
-
-models_path="${2:-$(get_script_path)}"
-
 # Whisper models
 models="tiny
 tiny.en
@@ -64,8 +52,8 @@ list_models() {
     printf "\n\n"
 }
 
-if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
-    printf "Usage: %s <model> [models_path]\n" "$0"
+if [ "$#" -ne 1 ]; then
+    printf "Usage: %s <model>\n" "$0"
     list_models
     printf "___________________________________________________________\n"
     printf "${BOLD}.en${RESET} = english-only ${BOLD}-q5_[01]${RESET} = quantized ${BOLD}-tdrz${RESET} = tinydiarize\n"
@@ -94,8 +82,6 @@ echo "$model" | grep -q '^"tdrz"*$'
 
 printf "Downloading ggml model %s from '%s' ...\n" "$model" "$src"
 
-cd "$models_path" || exit
-
 if [ -f "ggml-$model.bin" ]; then
     printf "Model %s already exists. Skipping download.\n" "$model"
     exit 0
@@ -116,7 +102,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-printf "Done! Model '%s' saved in '%s/ggml-%s.bin'\n" "$model" "$models_path" "$model"
+printf "Done! Model '%s' saved in 'ggml-%s.bin'\n" "$model" "$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"
+printf "  $ whisper-cpp -m ggml-%s.bin -f samples/jfk.wav\n" "$model"
 printf "\n"