Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.
Python aiavx512cpu-inferenceedge-aiggufinference-enginellama-cppllmllm-inferencelocal-ailocal-llmno-gpuon-device-aiopenai-apiopenai-compatiblequantizationqwenself-hostedspeculative-decodingternary
#!/usr/bin/env bash
# start: one command for people who just want to use it. Installs on the first run (asks nothing), starts the
# server, and opens the chat page in your browser when it is ready. Ctrl+C stops it.
#
# ./start # http://127.0.0.1:8080
# ./start --port 9000 # any ./serve option works here too
set -euo pipefail
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PREFIX=${OPENSET_LLM_HOME:-$HOME/.openset-llm}
HOST=127.0.0.1; PORT=8080; WEBUI=1; args=("$@")
for ((i = 0; i < ${#args[@]}; i++)); do
case ${args[i]} in
--host) HOST=${args[i+1]:-127.0.0.1} ;;
--port) PORT=${args[i+1]:-8080} ;;
--no-webui) WEBUI=0 ;;
esac
done
case "${1:-}" in -h|--help) sed -n '2,6p' "$0"; exit 0 ;; esac
if ! { [ -x "$PREFIX/bin/llama-server" ] && [ -f "$PREFIX/models/model.gguf" ]; }; then
echo "First run: installing (this downloads the model and can take a while)..."
bash "$HERE/install.sh"
fi
SHOW=$HOST
case $HOST in 0.0.0.0) SHOW=127.0.0.1 ;; ::) SHOW=::1 ;; esac
case $SHOW in *:*) SHOW=[$SHOW] ;; esac
URL=http://$SHOW:$PORT
open_page() { # Linux desktop, WSL, or just print the address
if command -v xdg-open >/dev/null 2>&1 && [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then xdg-open "$URL" >/dev/null 2>&1 && return
elif command -v wslview >/dev/null 2>&1; then wslview "$URL" >/dev/null 2>&1 && return
elif command -v explorer.exe >/dev/null 2>&1; then explorer.exe "$URL" >/dev/null 2>&1; return
fi
echo "Open $URL in your browser."
}
if [ "$WEBUI" = 1 ]; then
( ( sleep 1
for _ in $(seq 1 600); do
kill -0 $$ 2>/dev/null || exit 0 # the server (this very process after the exec below) has gone: say nothing
if curl -fsS -o /dev/null "$URL/health" 2>/dev/null; then echo; echo "Ready: $URL"; open_page; exit 0; fi
sleep 1
done
echo "Still loading after 600 s. Open $URL once the server says it is listening." ) & ) # detached: no zombie under the server
fi
# exec: the server takes over this process, so Ctrl+C, kill and closing the terminal all reach it and none leaves it behind
exec bash "$HERE/serve" "$@"