fix whisper.cpp metal; remove helpers

Trying to standardize on huggingface-cli downloads the models and ScriptHub scripts or endpoints make use of that.
This commit is contained in:
Max Howell 2023-11-21 17:41:31 -05:00
parent 702c0e236a
commit 2c4fedb117
3 changed files with 16 additions and 64 deletions

View file

@ -13,13 +13,13 @@ provides:
- bin/whisper.cpp - bin/whisper.cpp
dependencies: dependencies:
gnu.org/wget: '*'
libsdl.org: '*' libsdl.org: '*'
build: build:
dependencies: dependencies:
freedesktop.org/pkg-config: ~0.29 freedesktop.org/pkg-config: ~0.29
gnu.org/patch: '*' gnu.org/patch: '*'
gnu.org/coreutils: '*'
script: script:
- run: patch -p1 < props/illegal_instruction.patch - run: patch -p1 < props/illegal_instruction.patch
if: <1.4.3 if: <1.4.3
@ -28,21 +28,22 @@ build:
- make stream --jobs {{ hw.concurrency }} - make stream --jobs {{ hw.concurrency }}
- make command --jobs {{ hw.concurrency }} - make command --jobs {{ hw.concurrency }}
- mkdir -p {{prefix}}/bin {{prefix}}/tbin {{prefix}}/share # ggml-metal.metal must be installed alongside whisper.cpp sadly
- mv main stream command {{prefix}}/tbin - install -Dt {{prefix}}/bin
- chmod +x {{prefix}}/tbin/* ggml-metal.metal
stream command
models/download-ggml-model.sh
- mv models/download-ggml-model.sh {{prefix}}/tbin/download-ggml-model.sh - install -D main {{prefix}}/bin/whisper.cpp
- mv props/whisper.cpp props/whisper-fetch {{prefix}}/bin
- mv examples/command/commands.txt {{prefix}}/share - install -D examples/command/commands.txt {{prefix}}/share/whisper.cpp/commands.txt
env:
darwin/aarch64:
# https://github.com/ggerganov/whisper.cpp/issues/1367
WHISPER_NO_METAL: 1
test: test:
dependencies: env:
curl.se: '*' cache: $HOME/.cache/huggingface
script: | script: |
curl -LO https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav huggingface-cli download ggerganov/whisper.cpp ggml-base.en.bin
whisper.cpp -f jfk.wav --print-colors model="$(find "$cache" -name "ggml-base.en.bin")"
curl https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav | whisper.cpp --model "$model" -
cache:
$HOME/.cache/huggingface

View file

@ -1,17 +0,0 @@
#!/bin/sh
set -e
test -n "$VERBOSE" && set -x
MODEL_NAME="base"
MODEL_DIR="$1"
VERSION="$2"
D="$(cd "$(dirname "$0")"/../tbin && pwd)"
mkdir -p "$MODEL_DIR"
# we have to move the script as it downloads relative to itself
cp "$D/download-ggml-model.sh" "$MODEL_DIR"
bash "$MODEL_DIR/download-ggml-model.sh" "$MODEL_NAME.en"
rm "$MODEL_DIR/download-ggml-model.sh"

View file

@ -1,32 +0,0 @@
#!/bin/sh
set -e
test -n "$VERBOSE" && set -x
D="$(cd "$(dirname "$0")"/.. && pwd)"
VERSION="$(basename "$D")"
MODEL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/models/whisper"
export PATH="$D/tbin:$PATH"
whisper-fetch "$MODEL_DIR" $VERSION
case $1 in
stream)
shift
exec "$D"/tbin/stream \
--model "$MODEL_DIR"/ggml-base.en.bin \
"$@"
;;
command)
shift
exec "$D"/tbin/command \
--model "$MODEL_DIR"/ggml-base.en.bin \
"$@"
;;
*)
exec "$D"/tbin/main \
--model "$MODEL_DIR"/ggml-base.en.bin \
"$@"
;;
esac