Spaces:
Running
Running
andypayne
commited on
Commit
·
7b2581f
1
Parent(s):
626e4b8
Changes to work by default on macOS - use curl when wget is not available, and use an alternative method to get the script path when realpath is not available.
Browse files
models/download-ggml-model.sh
CHANGED
|
@@ -3,7 +3,17 @@
|
|
| 3 |
# This script downloads Whisper model files that have already been converted to ggml format.
|
| 4 |
# This way you don't have to convert them yourself.
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Whisper models
|
| 9 |
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large" )
|
|
@@ -45,7 +55,15 @@ if [ -f "ggml-$model.bin" ]; then
|
|
| 45 |
exit 0
|
| 46 |
fi
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
if [ $? -ne 0 ]; then
|
| 51 |
printf "Failed to download ggml model $model \n"
|
|
|
|
| 3 |
# This script downloads Whisper model files that have already been converted to ggml format.
|
| 4 |
# This way you don't have to convert them yourself.
|
| 5 |
|
| 6 |
+
# get the path of this script
|
| 7 |
+
function get_script_path() {
|
| 8 |
+
if [ -x "$(command -v realpath)" ]; then
|
| 9 |
+
echo "$(dirname $(realpath $0))"
|
| 10 |
+
else
|
| 11 |
+
local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
|
| 12 |
+
echo "$ret"
|
| 13 |
+
fi
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
models_path=$(get_script_path)
|
| 17 |
|
| 18 |
# Whisper models
|
| 19 |
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large" )
|
|
|
|
| 55 |
exit 0
|
| 56 |
fi
|
| 57 |
|
| 58 |
+
if [ -x "$(command -v wget)" ]; then
|
| 59 |
+
wget --quiet --show-progress -O ggml-$model.bin https://ggml.ggerganov.com/ggml-model-whisper-$model.bin
|
| 60 |
+
elif [ -x "$(command -v curl)" ]; then
|
| 61 |
+
curl --output ggml-$model.bin https://ggml.ggerganov.com/ggml-model-whisper-$model.bin
|
| 62 |
+
else
|
| 63 |
+
printf "Either wget or curl is required to download models.\n"
|
| 64 |
+
exit 1
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
|
| 68 |
if [ $? -ne 0 ]; then
|
| 69 |
printf "Failed to download ggml model $model \n"
|