File size: 1,895 Bytes
89bf59d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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/."