Skip to content

Commit e6d17e2

Browse files
authored
whisper-cpp: 1.7.2 -> 1.7.5 (#382394)
2 parents 724f787 + 20b19da commit e6d17e2

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh
2-
index 1f1075b..7476c8e 100755
2+
index ef9c90da..a7e2a17c 100755
33
--- a/models/download-ggml-model.sh
44
+++ b/models/download-ggml-model.sh
5-
@@ -12,18 +12,6 @@ pfx="resolve/main/ggml"
5+
@@ -12,15 +12,6 @@ pfx="resolve/main/ggml"
66
BOLD="\033[1m"
77
RESET='\033[0m'
88

@@ -15,39 +15,43 @@ index 1f1075b..7476c8e 100755
1515
- echo "$_ret"
1616
- fi
1717
-}
18-
-
19-
-models_path="${2:-$(get_script_path)}"
20-
-
18+
19+
script_path="$(get_script_path)"
20+
21+
@@ -30,7 +21,6 @@ case "$script_path" in
22+
*) default_download_path="$script_path" ;; # Otherwise, use script directory
23+
esac
24+
25+
-models_path="${2:-$default_download_path}"
26+
2127
# Whisper models
2228
models="tiny
23-
tiny.en
24-
@@ -64,8 +52,8 @@ list_models() {
29+
@@ -80,8 +70,8 @@ list_models() {
2530
printf "\n\n"
2631
}
2732

2833
-if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
2934
- printf "Usage: %s <model> [models_path]\n" "$0"
30-
+if [ "$#" -ne 1 ]; then
35+
+if [ "$#" -lt 1 ]; then
3136
+ printf "Usage: %s <model>\n" "$0"
3237
list_models
3338
printf "___________________________________________________________\n"
3439
printf "${BOLD}.en${RESET} = english-only ${BOLD}-q5_[01]${RESET} = quantized ${BOLD}-tdrz${RESET} = tinydiarize\n"
35-
@@ -94,8 +82,6 @@ echo "$model" | grep -q '^"tdrz"*$'
40+
@@ -110,7 +100,6 @@ echo "$model" | grep -q '^"tdrz"*$'
3641

3742
printf "Downloading ggml model %s from '%s' ...\n" "$model" "$src"
3843

3944
-cd "$models_path" || exit
40-
-
45+
4146
if [ -f "ggml-$model.bin" ]; then
4247
printf "Model %s already exists. Skipping download.\n" "$model"
43-
exit 0
44-
@@ -116,7 +102,7 @@ if [ $? -ne 0 ]; then
45-
exit 1
48+
@@ -143,7 +132,7 @@ else
49+
whisper_cmd="./build/bin/whisper-cli"
4650
fi
4751

4852
-printf "Done! Model '%s' saved in '%s/ggml-%s.bin'\n" "$model" "$models_path" "$model"
4953
+printf "Done! Model '%s' saved in 'ggml-%s.bin'\n" "$model" "$model"
5054
printf "You can now use it like this:\n\n"
51-
-printf " $ ./main -m %s/ggml-%s.bin -f samples/jfk.wav\n" "$models_path" "$model"
52-
+printf " $ whisper-cpp -m ggml-%s.bin -f samples/jfk.wav\n" "$model"
55+
-printf " $ %s -m %s/ggml-%s.bin -f samples/jfk.wav\n" "$whisper_cmd" "$models_path" "$model"
56+
+printf " $ %s -m /ggml-%s.bin -f samples/jfk.wav\n" "$whisper_cmd" "$model"
5357
printf "\n"

pkgs/by-name/wh/whisper-cpp/package.nix

+12-18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
stdenv,
44
cmake,
5+
git,
56
apple-sdk_11,
67
ninja,
78
fetchFromGitHub,
@@ -43,8 +44,6 @@ let
4344
cmakeFeature
4445
optional
4546
optionals
46-
optionalString
47-
forEach
4847
;
4948

5049
darwinBuildInputs = [ apple-sdk_11 ];
@@ -73,13 +72,13 @@ let
7372
in
7473
effectiveStdenv.mkDerivation (finalAttrs: {
7574
pname = "whisper-cpp";
76-
version = "1.7.2";
75+
version = "1.7.5";
7776

7877
src = fetchFromGitHub {
79-
owner = "ggerganov";
78+
owner = "ggml-org";
8079
repo = "whisper.cpp";
81-
rev = "refs/tags/v${finalAttrs.version}";
82-
hash = "sha256-y30ZccpF3SCdRGa+P3ddF1tT1KnvlI4Fexx81wZxfTk=";
80+
tag = "v${finalAttrs.version}";
81+
hash = "sha256-tvCT0QRdmRGsjtQZcEZMgSe2/47tSkfdaPqS/2MuQTs=";
8382
};
8483

8584
# The upstream download script tries to download the models to the
@@ -89,7 +88,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
8988
patches = [ ./download-models.patch ];
9089

9190
postPatch = ''
92-
for target in examples/{bench,command,main,quantize,server,stream,talk}/CMakeLists.txt; do
91+
for target in examples/{bench,command,cli,quantize,server,stream,talk-llama}/CMakeLists.txt; do
9392
if ! grep -q -F 'install('; then
9493
echo 'install(TARGETS ''${TARGET} RUNTIME)' >> $target
9594
fi
@@ -99,6 +98,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
9998
nativeBuildInputs =
10099
[
101100
cmake
101+
git
102102
ninja
103103
which
104104
makeWrapper
@@ -154,17 +154,11 @@ effectiveStdenv.mkDerivation (finalAttrs: {
154154

155155
postInstall = ''
156156
# Add "whisper-cpp" prefix before every command
157-
mv -v $out/bin/{main,whisper-cpp}
157+
mv -v "$out/bin/"{quantize,whisper-quantize}
158158
159-
for file in $out/bin/*; do
160-
if [[ -x "$file" && -f "$file" && "$(basename $file)" != "whisper-cpp" ]]; then
161-
mv -v "$file" "$out/bin/whisper-cpp-$(basename $file)"
162-
fi
163-
done
164-
165-
install -v -D -m755 $src/models/download-ggml-model.sh $out/bin/whisper-cpp-download-ggml-model
159+
install -v -D -m755 "$src/models/download-ggml-model.sh" "$out/bin/whisper-cpp-download-ggml-model"
166160
167-
wrapProgram $out/bin/whisper-cpp-download-ggml-model \
161+
wrapProgram "$out/bin/whisper-cpp-download-ggml-model" \
168162
--prefix PATH : ${lib.makeBinPath [ wget ]}
169163
'';
170164

@@ -174,7 +168,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
174168

175169
installCheckPhase = ''
176170
runHook preInstallCheck
177-
$out/bin/whisper-cpp --help >/dev/null
171+
"$out/bin/whisper-cli" --help >/dev/null
178172
runHook postInstallCheck
179173
'';
180174

@@ -186,7 +180,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
186180
'';
187181
homepage = "https://github.com/ggerganov/whisper.cpp";
188182
license = lib.licenses.mit;
189-
mainProgram = "whisper-cpp";
183+
mainProgram = "whisper-cli";
190184
platforms = lib.platforms.all;
191185
broken = coreMLSupport;
192186
badPlatforms = optionals cudaSupport lib.platforms.darwin;

0 commit comments

Comments
 (0)