| #!/usr/bin/env bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -euo pipefail |
|
|
| HERE="$(cd "$(dirname "$0")" && pwd)" |
| cd "$HERE" |
|
|
| log() { printf "\033[1;34m[install]\033[0m %s\n" "$*"; } |
| err() { printf "\033[1;31m[install] ERROR:\033[0m %s\n" "$*" >&2; exit 1; } |
|
|
| log "starting LEM-Eval bootstrap on $(hostname)" |
|
|
| |
|
|
| command -v git >/dev/null 2>&1 || err "git not found" |
| command -v uv >/dev/null 2>&1 || err "uv not found — install from https://github.com/astral-sh/uv" |
|
|
| |
|
|
| if [[ -z "${HF_TOKEN:-}" ]] && [[ ! -f "$HOME/.cache/huggingface/token" ]]; then |
| err "HF_TOKEN not set and ~/.cache/huggingface/token not found. Run 'huggingface-cli login' or export HF_TOKEN." |
| fi |
|
|
| |
|
|
| WORKSPACES="$HERE/workspaces" |
| mkdir -p "$WORKSPACES" |
| log "workspace root: $WORKSPACES" |
|
|
| |
|
|
| LEM_BENCHMARKS_DIR="$HERE/lem-benchmarks" |
| if [[ ! -d "$LEM_BENCHMARKS_DIR/.git" ]]; then |
| log "cloning lthn/LEM-benchmarks → $LEM_BENCHMARKS_DIR" |
| git clone https://huggingface.co/datasets/lthn/LEM-benchmarks "$LEM_BENCHMARKS_DIR" |
| else |
| log "lthn/LEM-benchmarks already cloned, pulling latest" |
| (cd "$LEM_BENCHMARKS_DIR" && git pull --ff-only) |
| fi |
|
|
| |
|
|
| log "resolving targets this machine can run..." |
| uv run --script eval.py --my-targets || true |
|
|
| |
| |
| |
| LEM_TYPES="${LEM_TYPES:-}" python3 - <<'PY' |
| import os, platform, subprocess, yaml |
|
|
| types_env = os.environ.get("LEM_TYPES", "").strip() |
| if types_env: |
| allowed = set(t.strip() for t in types_env.split(",")) |
| else: |
| allowed = set() |
| try: |
| import mlx_lm |
| if platform.system() == "Darwin": |
| allowed.add("mlx") |
| except ImportError: |
| pass |
| if not allowed: |
| allowed = {"mlx"} |
|
|
| with open("targets.yaml") as f: |
| cfg = yaml.safe_load(f) |
| for t in cfg.get("targets", []): |
| if t.get("type") not in allowed: |
| continue |
| name, repo = t["name"], t["this"] |
| dest = os.path.join("workspaces", name) |
| if os.path.isdir(os.path.join(dest, ".git")): |
| print(f" [{name}] already cloned, pulling") |
| subprocess.run(["git", "-C", dest, "pull", "--ff-only"], check=False) |
| else: |
| print(f" [{name}] cloning https://huggingface.co/{repo} → {dest}") |
| subprocess.run(["git", "clone", f"https://huggingface.co/{repo}", dest], check=True) |
| PY |
|
|
| |
|
|
| log "warming uv venv cache (first run pulls lighteval from fork, ~60-90s)" |
| uv run --script eval.py --list-targets >/dev/null || true |
|
|
| log "bootstrap complete." |
| log "" |
| log "next steps:" |
| log " 1. Review targets.yaml and adjust owner fields if needed" |
| log " 2. Run a manual eval: ./lem-eval.sh once" |
| log " 3. Install cron entries from cron/ for continuous operation" |
|
|