gemma4-stack / scripts /download-models.sh
Neohosseinism's picture
Add gemma4-stack config, scripts, and docker-compose setup
89bf59d
Raw
History Blame Contribute Delete
1.9 kB
#!/usr/bin/env bash
# Download the Gemma 4 BF16 mmproj projectors (REQUIRED — must be pinned, never
# auto-fetched) and, optionally, the LLM GGUF weights. The LLM weights are also
# fetched automatically by llama-swap's `-hf ...:Q4_K_M` on first request, so by
# default we only pull the mmproj files.
#
# ./download-models.sh # mmproj only (fast, required)
# ./download-models.sh --weights # also pre-pull the Q4_K_M GGUFs
#
# Prereq: huggingface-cli logged in (Gemma is gated):
# pip install -U "huggingface_hub[cli]" && huggingface-cli login
# (and accept the Gemma 4 license once on huggingface.co)
set -euo pipefail
cd "$(dirname "$0")/.."
DEST="models"
mkdir -p "$DEST"
HF="$(command -v huggingface-cli || command -v hf || true)"
if [ -z "$HF" ]; then
echo "ERROR: huggingface-cli not found. Run: pip install -U 'huggingface_hub[cli]'" >&2
exit 1
fi
# repo : mmproj-filename : quant-filename
MODELS="
ggml-org/gemma-4-E4B-it-GGUF:mmproj-gemma-4-E4B-it-bf16.gguf:gemma-4-E4B-it-Q4_K_M.gguf
ggml-org/gemma-4-12B-it-GGUF:mmproj-gemma-4-12B-it-bf16.gguf:gemma-4-12B-it-Q4_K_M.gguf
ggml-org/gemma-4-26B-A4B-it-GGUF:mmproj-gemma-4-26B-A4B-it-bf16.gguf:gemma-4-26B-A4B-it-Q4_K_M.gguf
"
WEIGHTS=0
[ "${1:-}" = "--weights" ] && WEIGHTS=1
dl() { # repo file
echo ">> $1 :: $2"
"$HF" download "$1" "$2" --local-dir "$DEST" || \
echo " !! could not fetch $2 — verify the exact filename on the HF repo 'Files' tab" >&2
}
for row in $MODELS; do
repo="${row%%:*}"; rest="${row#*:}"
mmproj="${rest%%:*}"; quant="${rest#*:}"
dl "$repo" "$mmproj" # REQUIRED (BF16, pinned for audio)
[ "$WEIGHTS" = "1" ] && dl "$repo" "$quant"
done
echo
echo "Done. mmproj files:"
ls -lh "$DEST"/mmproj-*.gguf 2>/dev/null || echo " (none — check errors above)"
echo
echo "TEI embedder/reranker download themselves on first start into models/tei/."