All checks were successful
release-tag / release-image (push) Successful in 6m28s
71 lines
2.4 KiB
Bash
71 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
MODELS="$ROOT/models"
|
|
TOOLS="$ROOT/local-tools"
|
|
mkdir -p "$MODELS" "$TOOLS"
|
|
|
|
download() {
|
|
local url="$1" out="$2"
|
|
if [[ -f "$out" && -s "$out" ]]; then
|
|
echo "[ok] vorhanden: $out"
|
|
return
|
|
fi
|
|
echo "[download] $url"
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -fL --retry 3 --progress-bar "$url" -o "$out"
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
wget -O "$out" "$url"
|
|
else
|
|
echo "Fehler: curl oder wget wird benötigt." >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Whisper model. whisper-cli itself is built into the Docker image since v7.6.
|
|
download "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin" "$MODELS/ggml-small.bin"
|
|
|
|
# German Piper voice + sidecar config.
|
|
download "https://huggingface.co/rhasspy/piper-voices/resolve/main/de/de_DE/thorsten/medium/de_DE-thorsten-medium.onnx" "$MODELS/de_DE-thorsten-medium.onnx"
|
|
download "https://huggingface.co/rhasspy/piper-voices/resolve/main/de/de_DE/thorsten/medium/de_DE-thorsten-medium.onnx.json" "$MODELS/de_DE-thorsten-medium.onnx.json"
|
|
|
|
if [[ ! -x "$TOOLS/piper" ]]; then
|
|
case "$(uname -m)" in
|
|
x86_64|amd64) asset="piper_linux_x86_64.tar.gz" ;;
|
|
aarch64|arm64) asset="piper_linux_aarch64.tar.gz" ;;
|
|
armv7l) asset="piper_linux_armv7l.tar.gz" ;;
|
|
*) echo "Piper-Binary für Architektur $(uname -m) bitte manuell unter $TOOLS/piper ablegen." >&2; exit 1 ;;
|
|
esac
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
archive="$tmp/piper.tar.gz"
|
|
download "https://github.com/rhasspy/piper/releases/download/2023.11.14-2/$asset" "$archive"
|
|
mkdir -p "$tmp/extract"
|
|
tar -xzf "$archive" -C "$tmp/extract"
|
|
piper_exec="$(find "$tmp/extract" -type f -name piper -perm -u+x | head -n 1 || true)"
|
|
if [[ -z "$piper_exec" ]]; then
|
|
echo "Piper konnte im Release-Archiv nicht gefunden werden." >&2
|
|
exit 1
|
|
fi
|
|
piper_dir="$(dirname "$piper_exec")"
|
|
cp -a "$piper_dir"/. "$TOOLS"/
|
|
chmod +x "$TOOLS/piper"
|
|
echo "[ok] Piper installiert: $TOOLS/piper"
|
|
else
|
|
echo "[ok] Piper vorhanden: $TOOLS/piper"
|
|
fi
|
|
|
|
cat <<MSG
|
|
|
|
Voice-Dateien sind vorbereitet.
|
|
Jetzt neu bauen/starten:
|
|
docker compose build --no-cache jarvis
|
|
docker compose up -d
|
|
|
|
Diagnose:
|
|
docker compose exec jarvis /app/scripts/doctor.sh # falls Scripts gemountet/kopiert sind
|
|
oder:
|
|
docker compose exec jarvis sh -lc 'command -v whisper-cli; ls -lh /models/ggml-small.bin /tools/piper /models/de_DE-thorsten-medium.onnx'
|
|
MSG
|