nixpkgs/pkgs/tools/audio/openai-whisper-cpp/download-models.patch

43 lines
1.3 KiB
Diff
Raw Normal View History

2022-12-07 15:26:15 +00:00
diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh
2023-05-03 22:05:52 +00:00
index 749b409..831f4c0 100755
2022-12-07 15:26:15 +00:00
--- a/models/download-ggml-model.sh
+++ b/models/download-ggml-model.sh
@@ -9,18 +9,6 @@
2023-05-03 22:05:52 +00:00
src="https://huggingface.co/ggerganov/whisper.cpp"
2022-12-07 15:26:15 +00:00
pfx="resolve/main/ggml"
-# get the path of this script
-function get_script_path() {
- if [ -x "$(command -v realpath)" ]; then
2023-05-03 22:05:52 +00:00
- echo "$(dirname "$(realpath "$0")")"
2022-12-07 15:26:15 +00:00
- else
- local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
- echo "$ret"
- fi
-}
-
2023-02-05 13:44:27 +00:00
-models_path="$(get_script_path)"
2022-12-07 15:26:15 +00:00
-
# Whisper models
models=( "tiny.en" "tiny" "base.en" "base" "small.en" "small" "medium.en" "medium" "large-v1" "large" )
@@ -54,8 +42,6 @@ fi
printf "Downloading ggml model $model from '$src' ...\n"
-cd $models_path
-
if [ -f "ggml-$model.bin" ]; then
printf "Model $model already exists. Skipping download.\n"
exit 0
@@ -77,7 +63,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
-printf "Done! Model '$model' saved in 'models/ggml-$model.bin'\n"
+printf "Done! Model '$model' saved in 'ggml-$model.bin'\n"
printf "You can now use it like this:\n\n"
-printf " $ ./main -m models/ggml-$model.bin -f samples/jfk.wav\n"
+printf " $ whisper-cpp -m ggml-$model.bin -f samples/jfk.wav\n"
printf "\n"