File size: 2,091 Bytes
87efc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# Download Mistral-Small-3.2-24B-Instruct Q4_K_M GGUF model
#
# Usage: export HF_TOKEN=hf_... && bash scripts/download-model.sh
#
# Always verify the repo name via HF Search API before downloading.
# HF repo names change and compressed context can reconstruct them incorrectly.

set -e

MODEL_REPO="bartowski/mistralai_Mistral-Small-3.2-24B-Instruct-2506-GGUF"
MODEL_FILE="mistralai_Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M.gguf"
VOLUME_NAME="${VOLUME_NAME:-turboquant-models}"

if [ -z "$HF_TOKEN" ]; then
  echo "ERROR: HF_TOKEN not set."
  echo "Get a free token at: https://huggingface.co/settings/tokens"
  echo "Then: export HF_TOKEN=hf_..."
  exit 1
fi

echo "=== Verifying repo exists ==="
HF_CHECK=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $HF_TOKEN" \
  "https://huggingface.co/api/models/${MODEL_REPO}")

if [ "$HF_CHECK" != "200" ]; then
  echo "ERROR: Repo not found or unauthorized (HTTP $HF_CHECK)"
  echo "Search for available repos:"
  curl -s -H "Authorization: Bearer $HF_TOKEN" \
    "https://huggingface.co/api/models?search=bartowski+mistral+small+3.2&limit=5" \
    | python3 -c "import sys,json; [print(m['modelId']) for m in json.load(sys.stdin)]"
  exit 1
fi

echo "Repo: ${MODEL_REPO} ✓"
echo "File: ${MODEL_FILE}"
echo "Volume: ${VOLUME_NAME}"
echo ""

docker volume create ${VOLUME_NAME} 2>/dev/null || true

echo "=== Downloading (~14 GB, may take 20-30 min) ==="
docker run --rm \
  -v ${VOLUME_NAME}:/models \
  -e HF_TOKEN="${HF_TOKEN}" \
  python:3.11-slim \
  bash -c "
    pip install -q huggingface_hub && \
    python -c \"
import os
from huggingface_hub import hf_hub_download
path = hf_hub_download(
    repo_id='${MODEL_REPO}',
    filename='${MODEL_FILE}',
    local_dir='/models',
    resume_download=True,
    token=os.environ.get('HF_TOKEN')
)
print('Downloaded to:', path)
print('Size: {:.1f} GB'.format(os.path.getsize(path) / 1e9))
\"
  "

echo ""
echo "=== Done ==="
echo "Model ready at: /models/${MODEL_FILE} (in Docker volume '${VOLUME_NAME}')"
echo "Run: bash scripts/run-baseline.sh"