]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
Changes to work by default on macOS - use curl when wget is not available, and use...
authorandypayne <redacted>
Wed, 26 Oct 2022 00:35:11 +0000 (17:35 -0700)
committerGeorgi Gerganov <redacted>
Wed, 26 Oct 2022 09:18:18 +0000 (12:18 +0300)
models/download-ggml-model.sh

index 8caaeda93dafa7d8611db03ab20270d6b25dd03d..10a15c95168879500c6858843a3e411ed70fcd4e 100755 (executable)
@@ -3,7 +3,17 @@
 # This script downloads Whisper model files that have already been converted to ggml format.
 # This way you don't have to convert them yourself.
 
-models_path=$(dirname $(realpath $0))
+# get the path of this script
+function get_script_path() {
+    if [ -x "$(command -v realpath)" ]; then
+        echo "$(dirname $(realpath $0))"
+    else
+        local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
+        echo "$ret"
+    fi
+}
+
+models_path=$(get_script_path)
 
 # Whisper models
 models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large" )
@@ -45,7 +55,15 @@ if [ -f "ggml-$model.bin" ]; then
     exit 0
 fi
 
-wget --quiet --show-progress -O ggml-$model.bin https://ggml.ggerganov.com/ggml-model-whisper-$model.bin
+if [ -x "$(command -v wget)" ]; then
+    wget --quiet --show-progress -O ggml-$model.bin https://ggml.ggerganov.com/ggml-model-whisper-$model.bin
+elif [ -x "$(command -v curl)" ]; then
+    curl --output ggml-$model.bin https://ggml.ggerganov.com/ggml-model-whisper-$model.bin
+else
+    printf "Either wget or curl is required to download models.\n"
+    exit 1
+fi
+
 
 if [ $? -ne 0 ]; then
     printf "Failed to download ggml model $model \n"