#!/bin/bash set -euo pipefail cd -- "$(dirname -- "$0")" export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" if [[ "$(uname -s)" != Darwin || "$(uname -m)" != arm64 ]]; then echo 'Run this launcher in a native Apple Silicon macOS Terminal.'; exit 1 fi if ! command -v uv >/dev/null || ! command -v node >/dev/null || ! command -v npm >/dev/null; then echo 'Missing prerequisites. Install uv and Node.js, then rerun. With Homebrew: brew install uv node' exit 1 fi node -e 'if(Number(process.versions.node.split(".")[0])<20)process.exit(1)' || { echo 'Node.js 20 or later is required.'; exit 1; } export UV_CACHE_DIR="$PWD/.cache/uv" export HF_HOME="$PWD/.cache/huggingface" export PYTHONUNBUFFERED=1 export OMP_NUM_THREADS=4 export PYTORCH_ENABLE_MPS_FALLBACK=1 uv venv --python 3.11 --allow-existing .venv uv pip install --python .venv/bin/python -r requirements.txt if [[ ! -d node_modules ]]; then npm ci --ignore-scripts --no-audit --no-fund fi echo 'Preparing 512 ABO objects, training 6,000 steps, then evaluating and publishing if the release checks pass.' echo 'Keep your Mac connected to power and its lid open. Rerun this same command after an interruption.' exec caffeinate -i .venv/bin/python pipeline.py --publish "$@"