Merge pull request #321941 from davidkna/openai-whisper-cpp-1.6.2
openai-whisper-cpp: 1.5.4 -> 1.6.2
This commit is contained in:
commit
6fb82de34c
@ -25,13 +25,13 @@ let
|
|||||||
in
|
in
|
||||||
effectiveStdenv.mkDerivation (finalAttrs: {
|
effectiveStdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "whisper-cpp";
|
pname = "whisper-cpp";
|
||||||
version = "1.5.4";
|
version = "1.6.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ggerganov";
|
owner = "ggerganov";
|
||||||
repo = "whisper.cpp";
|
repo = "whisper.cpp";
|
||||||
rev = "refs/tags/v${finalAttrs.version}" ;
|
rev = "refs/tags/v${finalAttrs.version}" ;
|
||||||
hash = "sha256-9H2Mlua5zx2WNXbz2C5foxIteuBgeCNALdq5bWyhQCk=";
|
hash = "sha256-hIEIu7feOZWqxRskf6Ej7l653/9KW8B3cnpPLoCRBAc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# The upstream download script tries to download the models to the
|
# The upstream download script tries to download the models to the
|
||||||
@ -80,6 +80,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
|||||||
env = lib.optionalAttrs stdenv.isDarwin {
|
env = lib.optionalAttrs stdenv.isDarwin {
|
||||||
WHISPER_COREML = "1";
|
WHISPER_COREML = "1";
|
||||||
WHISPER_COREML_ALLOW_FALLBACK = "1";
|
WHISPER_COREML_ALLOW_FALLBACK = "1";
|
||||||
|
WHISPER_METAL_EMBED_LIBRARY = "1";
|
||||||
} // lib.optionalAttrs cudaSupport {
|
} // lib.optionalAttrs cudaSupport {
|
||||||
WHISPER_CUBLAS = "1";
|
WHISPER_CUBLAS = "1";
|
||||||
};
|
};
|
||||||
@ -99,15 +100,6 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
|||||||
wrapProgram $out/bin/whisper-cpp-download-ggml-model \
|
wrapProgram $out/bin/whisper-cpp-download-ggml-model \
|
||||||
--prefix PATH : ${lib.makeBinPath [wget]}
|
--prefix PATH : ${lib.makeBinPath [wget]}
|
||||||
|
|
||||||
${lib.optionalString stdenv.isDarwin ''
|
|
||||||
install -Dt $out/share/whisper-cpp ggml-metal.metal
|
|
||||||
|
|
||||||
for bin in whisper-cpp whisper-cpp-stream whisper-cpp-command; do
|
|
||||||
wrapProgram $out/bin/$bin \
|
|
||||||
--set-default GGML_METAL_PATH_RESOURCES $out/share/whisper-cpp
|
|
||||||
done
|
|
||||||
''}
|
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -1,51 +1,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
|
--- a/models/download-ggml-model.sh
|
||||||
+++ b/models/download-ggml-model.sh
|
+++ b/models/download-ggml-model.sh
|
||||||
@@ -9,18 +9,6 @@
|
@@ -12,18 +12,6 @@ pfx="resolve/main/ggml"
|
||||||
src="https://huggingface.co/ggerganov/whisper.cpp"
|
BOLD="\033[1m"
|
||||||
pfx="resolve/main/ggml"
|
RESET='\033[0m'
|
||||||
|
|
||||||
-# get the path of this script
|
-# get the path of this script
|
||||||
-function get_script_path() {
|
-get_script_path() {
|
||||||
- if [ -x "$(command -v realpath)" ]; then
|
- if [ -x "$(command -v realpath)" ]; then
|
||||||
- echo "$(dirname "$(realpath "$0")")"
|
- dirname "$(realpath "$0")"
|
||||||
- else
|
- else
|
||||||
- local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
|
- _ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"
|
||||||
- echo "$ret"
|
- echo "$_ret"
|
||||||
- fi
|
- fi
|
||||||
-}
|
-}
|
||||||
-
|
-
|
||||||
-models_path="${2:-$(get_script_path)}"
|
-models_path="${2:-$(get_script_path)}"
|
||||||
-
|
-
|
||||||
# Whisper models
|
# Whisper models
|
||||||
models=(
|
models="tiny
|
||||||
"tiny.en"
|
tiny.en
|
||||||
@@ -56,8 +44,8 @@ function list_models {
|
@@ -64,8 +52,8 @@ list_models() {
|
||||||
printf "\n\n"
|
printf "\n\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
-if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
-if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||||
- printf "Usage: $0 <model> [models_path]\n"
|
- printf "Usage: %s <model> [models_path]\n" "$0"
|
||||||
+if [ "$#" -ne 1 ]; then
|
+if [ "$#" -ne 1 ]; then
|
||||||
+ printf "Usage: $0 <model>\n"
|
+ printf "Usage: %s <model>\n" "$0"
|
||||||
list_models
|
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"*$'
|
||||||
|
|
||||||
exit 1
|
printf "Downloading ggml model %s from '%s' ...\n" "$model" "$src"
|
||||||
@@ -82,8 +70,6 @@ fi
|
|
||||||
|
|
||||||
printf "Downloading ggml model $model from '$src' ...\n"
|
-cd "$models_path" || exit
|
||||||
|
|
||||||
-cd "$models_path"
|
|
||||||
-
|
-
|
||||||
if [ -f "ggml-$model.bin" ]; then
|
if [ -f "ggml-$model.bin" ]; then
|
||||||
printf "Model $model already exists. Skipping download.\n"
|
printf "Model %s already exists. Skipping download.\n" "$model"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -105,7 +91,7 @@ if [ $? -ne 0 ]; then
|
@@ -116,7 +102,7 @@ if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
-printf "Done! Model '$model' saved in '$models_path/ggml-$model.bin'\n"
|
-printf "Done! Model '%s' saved in '%s/ggml-%s.bin'\n" "$model" "$models_path" "$model"
|
||||||
+printf "Done! Model '$model' saved in 'ggml-$model.bin'\n"
|
+printf "Done! Model '%s' saved in 'ggml-%s.bin'\n" "$model" "$model"
|
||||||
printf "You can now use it like this:\n\n"
|
printf "You can now use it like this:\n\n"
|
||||||
-printf " $ ./main -m $models_path/ggml-$model.bin -f samples/jfk.wav\n"
|
-printf " $ ./main -m %s/ggml-%s.bin -f samples/jfk.wav\n" "$models_path" "$model"
|
||||||
+printf " $ whisper-cpp -m ggml-$model.bin -f samples/jfk.wav\n"
|
+printf " $ whisper-cpp -m ggml-%s.bin -f samples/jfk.wav\n" "$model"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user