a8nova's picture
nnopt port: Bonsai-27B-llama.cpp
9d62c0e verified
Raw History Blame Contribute Delete
1.03 kB
#!/bin/bash
# Installs the runner, run.sh, port.json and the GGUF weights into DEST (this Mac is the device).
set -euo pipefail
cd "$(dirname "$0")"
DEST="${1:?usage: deploy.sh DEST}"
[ -x bin/nnopt_runner ] || { echo "run build.sh first" >&2; exit 1; }
MODEL_SRC="$(cat bin/model_path.txt)"
[ -f "$MODEL_SRC" ] || { echo "weights not found: $MODEL_SRC" >&2; exit 1; }
mkdir -p "$DEST"
cp bin/nnopt_runner "$DEST/nnopt_runner"
cp src/run.sh "$DEST/run.sh"
# APFS clone when possible (instant, no extra space); plain copy otherwise.
if ! cmp -s "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf" 2>/dev/null; then
rm -f "$DEST/Bonsai-27B-Q1_0.gguf"
cp -c "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf" 2>/dev/null || cp "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf"
fi
cat > "$DEST/port.json" <<JSON
{"contract": 1, "model_type": "text_to_text",
"runtime": "PrismML llama.cpp fork $(cut -c1-8 bin/llama_commit.txt), Metal (all layers on GPU)",
"precision": "Q1_0_g128 weights (as published), f16 KV cache"}
JSON
echo "deployed to $DEST"