-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·69 lines (63 loc) · 3.84 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·69 lines (63 loc) · 3.84 KB
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
# ReflexLearn install.sh
# ─────────────────────────────────────────────────────────────────────────────
# This script performs ALL network operations required by ReflexLearn in one
# declared, user-visible step. After this script completes, the skill can run
# fully offline with --offline flag.
#
# Network operations performed:
# 1. pip install — pulls packages from PyPI:
# sentence-transformers, numpy, huggingface-hub
# 2. Model pre-cache — downloads ~80 MB of weights from Hugging Face:
# sentence-transformers/all-MiniLM-L6-v2
#
# No further network calls are made at runtime when --offline is set.
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
MODEL="sentence-transformers/all-MiniLM-L6-v2"
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo ""
echo "╔══════════════════════════════════════════════════════╗"
echo "║ ReflexLearn — Install Script ║"
echo "╚══════════════════════════════════════════════════════╝"
echo ""
echo "This script will:"
echo " 1. Install Python packages from PyPI (sentence-transformers, numpy, huggingface-hub)"
echo " 2. Download model weights from Hugging Face (~80 MB, one-time only)"
echo ""
read -r -p "Proceed? [y/N] " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
# ── Step 1: Install Python dependencies ──────────────────────────────────────
echo ""
echo "▶ Step 1/2: Installing Python dependencies..."
pip install --quiet -r "$SKILL_DIR/requirements.txt"
echo " ✓ Dependencies installed."
# ── Step 2: Pre-cache model weights ──────────────────────────────────────────
echo ""
echo "▶ Step 2/2: Pre-caching model weights from Hugging Face..."
echo " Model : $MODEL"
echo " Size : ~80 MB (downloaded once, cached in ~/.cache/huggingface/)"
echo ""
python3 - <<'PYEOF'
from sentence_transformers import SentenceTransformer
import sys
print(" Downloading/verifying model weights...")
model = SentenceTransformer("all-MiniLM-L6-v2")
# Quick smoke test to confirm the model works
test_emb = model.encode("test", convert_to_numpy=True)
assert test_emb.shape[0] == 384, "Unexpected embedding dimension"
print(" ✓ Model cached and verified (embedding dim=384).")
PYEOF
# ── Done ──────────────────────────────────────────────────────────────────────
echo ""
echo "╔══════════════════════════════════════════════════════╗"
echo "║ Installation complete. ReflexLearn is ready. ║"
echo "║ ║"
echo "║ Run with --offline to prevent any further network ║"
echo "║ access at runtime: ║"
echo "║ python3 reflex_learn.py --query '...' --offline ║"
echo "╚══════════════════════════════════════════════════════╝"
echo ""