Files
voice_linux/scripts/download_models.sh

46 lines
955 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
mkdir -p ./models
BASE_URL="https://huggingface.co/ggerganov/whisper.cpp/resolve/main"
MODELS=(
"ggml-tiny.en.bin"
"ggml-base.en.bin"
"ggml-small.en.bin"
"ggml-medium.en.bin"
"ggml-large-v3-turbo.bin"
"ggml-large-v3.bin"
)
need_cmd() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "[models] error: required command '$1' not found" >&2
exit 2
fi
}
need_cmd wget
echo "[models] target dir: $ROOT_DIR/models"
for model in "${MODELS[@]}"; do
out="./models/$model"
url="$BASE_URL/$model"
if [[ -f "$out" ]]; then
size="$(stat -c%s "$out" 2>/dev/null || echo 0)"
echo "[models] found local copy for $model (${size} bytes), resuming/verifying with wget -c"
else
echo "[models] downloading: $model"
fi
wget -c -O "$out" "$url"
echo "[models] ready: $model"
done
echo "[models] complete"