sovereign-intelligence
Front door to Drake Stapleton's sovereign stack.
Brought by drakestapleton
sovereign-intelligence / portable-pack / si-pack
| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | # Resolve the installed command even when invoked through ~/.local/bin. |
| 4 | program=$(readlink -f -- "$0") |
| 5 | root=$(dirname -- "$program") |
| 6 | case "${1:-help}" in |
| 7 | demo) shift; exec "$root/round40/demo" "$@" ;; |
| 8 | model) shift; exec "$root/round40/model" "$@" ;; |
| 9 | verify) (cd "$root" && sha256sum --quiet -c PACK.sha256); exec "$HOME/.local/bin/interplane" verify ;; |
| 10 | qualify) shift; OMC="$root/adapter-omc" exec "$root/adapter/qualify" "$@" ;; |
| 11 | attach) |
| 12 | [ "$#" -eq 2 ] || { echo 'Usage: si-pack attach /path/to/model.gguf' >&2; exit 2; } |
| 13 | [ -f "$2" ] && [ -r "$2" ] || { echo 'A readable local GGUF file is required.' >&2; exit 2; } |
| 14 | model=$(realpath -- "$2") |
| 15 | bytes=$(stat -c %s -- "$model") |
| 16 | if awk -v n="$bytes" '$1 == n {known=1} END {exit !known}' "$root/adapter/models.tsv"; then |
| 17 | hash=$(sha256sum < "$model" | cut -d' ' -f1) |
| 18 | if awk -v h="$hash" '$2 == h {known=1} END {exit !known}' "$root/adapter/models.tsv"; then |
| 19 | OMC="$root/adapter-omc" "$root/adapter/qualify" "$model" |
| 20 | fi |
| 21 | fi |
| 22 | # Existing GGUF interoperability backend. Stay offline and on loopback. |
| 23 | export LD_LIBRARY_PATH="$root/chat-runtime" |
| 24 | export CUDA_VISIBLE_DEVICES=-1 |
| 25 | exec "$root/chat-runtime/llama-server" --offline -m "$model" --device none -ngl 0 \ |
| 26 | --host 127.0.0.1 --port "${SI_PACK_PORT:-8091}" -t 2 -c 512 --no-webui |
| 27 | ;; |
| 28 | help|--help|-h) echo 'si-pack demo | model | attach FILE.gguf | qualify FILE.gguf | verify' ;; |
| 29 | *) echo "Unknown command: $1" >&2; exit 2 ;; |
| 30 | esac |