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
One-command installer and a container image on every release (#141)
0xaron5710dc380f9c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 7fa22bc..078a7c6 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -9,7 +9,7 @@ jobs:steps:- uses: actions/checkout@v7- name: Shell scripts parse- run: for f in install.sh serve start scripts/package.sh scripts/verify-dispatch.sh scripts/cross-aarch64.sh scripts/smoke-test.sh patches/apply.sh docker/entrypoint.sh bench/box.sh bench/jobs.sh bench/quick.sh; do bash -n "$f"; done+ run: for f in install.sh get.sh serve start scripts/package.sh scripts/verify-dispatch.sh scripts/cross-aarch64.sh scripts/smoke-test.sh patches/apply.sh docker/entrypoint.sh bench/box.sh bench/jobs.sh bench/quick.sh; do bash -n "$f"; done- name: Python compilesrun: python3 -m py_compile scripts/graft_mtp.py bench/*.py- name: Unit testsdiff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.ymlnew file mode 100644index 0000000..8622f01--- /dev/null+++ b/.github/workflows/docker-image.yml@@ -0,0 +1,42 @@+name: docker-image++# Builds the engine image from the Dockerfile. When a release is published it is pushed to the GitHub container+# registry as ghcr.io/<owner>/openset-llm:<tag> and :latest. Started by hand it only builds, as a check.+# The image holds the engine, not the model: the model is downloaded into a volume on first start.++on:+ release:+ types: [published]+ workflow_dispatch:++permissions:+ contents: read++jobs:+ image:+ runs-on: ubuntu-24.04+ permissions:+ contents: read+ packages: write+ env:+ IMAGE: ghcr.io/${{ github.repository_owner }}/openset-llm+ steps:+ - uses: actions/checkout@v7++ - name: Build+ run: docker build -t "$IMAGE:build" .++ - name: The engine in the image starts+ run: docker run --rm --entrypoint /opt/openset-llm/bin/llama-server -e LD_LIBRARY_PATH=/opt/openset-llm/bin "$IMAGE:build" --version++ - name: Push to the container registry+ if: github.event_name == 'release'+ env:+ TAG: ${{ github.event.release.tag_name }}+ TOKEN: ${{ github.token }}+ run: |+ printf '%s' "$TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin+ docker tag "$IMAGE:build" "$IMAGE:$TAG"+ docker tag "$IMAGE:build" "$IMAGE:latest"+ docker push "$IMAGE:$TAG"+ docker push "$IMAGE:latest"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bf3b4ae..f57d28f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,15 @@ All notable changes to openset-llm. Dates are YYYY-MM-DD.## Unreleased+Added++- One-command install: `curl -fsSL https://raw.githubusercontent.com/opensetlabs/openset-llm/main/get.sh | bash`.+ No clone and no compiler: it installs the latest release with its prebuilt engine and adds an `openset-llm`+ command (`openset-llm`, `openset-llm serve`, `check`, `version`, `update`). A failed install leaves the previous+ version in place.+- Container image on every release: publishing a release builds the Dockerfile and pushes+ `ghcr.io/opensetlabs/openset-llm:<tag>` and `:latest`.+## 0.3.3 (2026-11-27)Install without a compiler: releases now carry a prebuilt engine.diff --git a/README.md b/README.mdindex fc8318b..b77d882 100644--- a/README.md+++ b/README.md@@ -66,6 +66,17 @@ but no AVX-512 (Intel Core 12th gen and newer, older Core, AMD Zen 1 to 3) runs([what was measured, and how to run it](#cpus-without-avx-512)). It builds from source, so it needs git, cmake anda C++ compiler; on Ubuntu or Debian: `sudo apt install -y build-essential cmake git`.+**Fastest way in: one command, no clone and no compiler.** It installs the latest release with the engine already+built for it, downloads the model, and adds an `openset-llm` command (x86-64 Linux or WSL2 with glibc 2.35 or newer:+Ubuntu 22.04, Debian 12 and later). You can read the script first: [get.sh](get.sh).++```sh+curl -fsSL https://raw.githubusercontent.com/opensetlabs/openset-llm/main/get.sh | bash+openset-llm+```++Or build it from source, which works on older systems too and uses a build tuned to your CPU:+```shgit clone https://github.com/opensetlabs/openset-llm && cd openset-llm./start@@ -433,6 +444,12 @@ docker run --rm -p 127.0.0.1:8080:8080 -v openset-llm-models:/data/models openseThe first `docker run` downloads the model (~7.3 GB) into the `openset-llm-models` volume; later runs start in ~40 s.+From release 0.3.4 on, each release also publishes this image, so you can skip the clone and the build:++```sh+docker run --rm -p 127.0.0.1:8080:8080 -v openset-llm-models:/data/models ghcr.io/opensetlabs/openset-llm+```+**Windows (WSL2).** WSL2 gets half of your RAM by default, so on a 16 GB PC raise it first. In PowerShell:```powershelldiff --git a/SECURITY.md b/SECURITY.mdindex 4694ebb..3d262cc 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -16,7 +16,8 @@ attacker gains. You will get an answer within a week.may install build tools with apt or pip. `--bin-url` downloads and runs a prebuilt binary: only use a tarball youtrust. `--prebuilt` downloads the engine attached to the latest release of this repository and checks it againstthat release's `SHA256SUMS`; the checksum comes from the same release, so it detects a damaged download, not a- tampered release. Nothing is fetched after install.+ tampered release. `get.sh` (the one-command installer) downloads the sources of a release and runs that+ release's `install.sh --prebuilt`; read it before piping it to a shell if you do not know this project. Nothing is fetched after install.- **Prompt states on disk.** With resume on (the default), the server keeps up to 8 prefix states built from yourprompts in `~/.openset-llm/state`. Delete the folder to clear them, or run `./serve --no-resume`.- Until the first tagged release, only the latest commit on `main` is supported with fixes.diff --git a/get.sh b/get.shnew file mode 100755index 0000000..27e7c4d--- /dev/null+++ b/get.sh@@ -0,0 +1,96 @@+#!/usr/bin/env bash+# get.sh: install openset-llm with one command. No git clone and no compiler: it downloads the sources of the latest+# release and the engine built for that release, prepares the model, and adds an `openset-llm` command.+#+# curl -fsSL https://raw.githubusercontent.com/opensetlabs/openset-llm/main/get.sh | bash+#+# Then: openset-llm # start the server and open the chat page (any ./serve option works: --port 9000)+# openset-llm serve ... # the server only+# openset-llm check # what this machine will get+# openset-llm update # move to the latest release+#+# Needs x86-64 Linux (or WSL2) with glibc 2.35 or newer (Ubuntu 22.04, Debian 12), curl, tar and python3.+# On anything else, build from source: see the README.+#+# Settings (environment): OPENSET_LLM_VERSION=v0.3.3 picks a release; OPENSET_LLM_APP is where the scripts go+# (default ~/.local/share/openset-llm); OPENSET_LLM_HOME is where the engine and the model go (default ~/.openset-llm);+# OPENSET_LLM_BIN_DIR is where the command goes (default ~/.local/bin).+set -euo pipefail++main() {+ local repo=https://github.com/opensetlabs/openset-llm+ local app=${OPENSET_LLM_APP:-$HOME/.local/share/openset-llm}+ local bindir=${OPENSET_LLM_BIN_DIR:-$HOME/.local/bin}+ local version=${OPENSET_LLM_VERSION:-}+ say() { printf '\033[1m==> %s\033[0m\n' "$*"; }+ die() { printf '\033[31merror:\033[0m %s\n' "$*" >&2; exit 1; }+ from_source="Build it from source instead: git clone $repo && cd openset-llm && ./start"++ [ "$(uname -s)" = Linux ] || die "this installer is for Linux (on Windows, run it inside WSL2). $from_source"+ case $(uname -m) in x86_64|amd64) ;; *) die "prebuilt engines exist for x86-64 only. $from_source" ;; esac+ for tool in curl tar python3; do command -v "$tool" >/dev/null 2>&1 || die "missing $tool; install it and run this again"; done+ local libc; libc=$(getconf GNU_LIBC_VERSION 2>/dev/null | awk '{print $2}')+ case $libc in+ '') die "this system does not use glibc, which the prebuilt engine needs. $from_source" ;;+ 1.*|2.[0-9]|2.[12][0-9]|2.3[0-4]) die "glibc $libc is older than the prebuilt engine needs (2.35). $from_source" ;;+ esac++ if [ -z "$version" ]; then+ # the "latest" page redirects to the newest release tag+ version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "$repo/releases/latest") || die "could not reach $repo"+ version=${version##*/}+ fi+ case $version in v[0-9]*.[0-9]*.[0-9]*) ;; *) die "unexpected release name: $version" ;; esac++ say "Installing openset-llm $version into $app"+ mkdir -p "$(dirname "$app")" "$bindir"+ local stage; stage=$(mktemp -d "$app.XXXXXX")+ # shellcheck disable=SC2064+ trap "rm -rf '$stage'" EXIT+ curl -fSL --retry 3 "${OPENSET_LLM_SOURCE_URL:-$repo/archive/refs/tags/$version.tar.gz}" | tar -xz -C "$stage" --strip-components=1 \+ || die "could not download the sources of $version"+ [ -f "$stage/install.sh" ] && [ -f "$stage/serve" ] && [ -f "$stage/start" ] || die "the download of $version is incomplete"+ grep -q -- '--prebuilt' "$stage/install.sh" || die "$version has no prebuilt engine (0.3.3 is the first release with one). $from_source"+ echo "$version" > "$stage/.version"++ # the engine attached to that same release, checked against its SHA256SUMS; the model comes from Hugging Face+ # (install.sh ends by saying how to start it from where it ran, which is a temporary folder here: leave that out)+ OPENSET_LLM_RELEASE_URL=${OPENSET_LLM_RELEASE_URL:-$repo/releases/download/$version} bash "$stage/install.sh" --prebuilt \+ | sed -e '/^Start it:/d' -e '/^Then chat:/d' \+ || die "the install did not finish (see the message above); nothing was changed in $app"++ # only now replace the previous scripts+ rm -rf "$app.previous"+ if [ -e "$app" ]; then mv "$app" "$app.previous"; fi+ mv "$stage" "$app"+ rm -rf "$app.previous"+ trap - EXIT++ cat > "$bindir/openset-llm" <<EOF+#!/bin/sh+# openset-llm: installed by get.sh. The scripts are in $app.+APP='$app'+case \${1:-start} in+ start) [ \$# -gt 0 ] && shift; exec "\$APP/start" "\$@" ;;+ serve) shift; exec "\$APP/serve" "\$@" ;;+ check) exec "\$APP/install.sh" --check ;;+ version) cat "\$APP/.version" ;;+ update) curl -fsSL https://raw.githubusercontent.com/opensetlabs/openset-llm/main/get.sh | bash ;;+ help|-h|--help)+ echo "openset-llm [start] [serve options] start the server and open the chat page"+ echo "openset-llm serve [options] the server only (openset-llm serve --help lists the options)"+ echo "openset-llm check | version | update" ;;+ *) exec "\$APP/start" "\$@" ;;+esac+EOF+ chmod +x "$bindir/openset-llm"++ say "Done: openset-llm $version"+ case ":$PATH:" in+ *":$bindir:"*) echo "Start it: openset-llm" ;;+ *) echo "Start it: $bindir/openset-llm"+ echo "($bindir is not on your PATH. Add it, or open a new terminal if your system adds it at login.)" ;;+ esac+}++main "$@"diff --git a/tests/test_get_script.py b/tests/test_get_script.pynew file mode 100644index 0000000..c46ca25--- /dev/null+++ b/tests/test_get_script.py@@ -0,0 +1,151 @@+import io+import os+from pathlib import Path+import shutil+import subprocess+import tarfile+import tempfile+import unittest++ROOT = Path(__file__).resolve().parents[1]+++class GetScript(unittest.TestCase):+ """get.sh: download the sources of a release, run its install.sh --prebuilt against that same release, and add+ the openset-llm command. A failed install must leave the previous scripts and command as they were."""++ def setUp(self):+ self.temp = tempfile.TemporaryDirectory()+ self.addCleanup(self.temp.cleanup)+ self.work = Path(self.temp.name)+ self.tools = self.work / 'tools'+ self.tools.mkdir()+ for name in ('dirname', 'grep', 'cut', 'sed', 'awk', 'cat', 'mkdir', 'mv', 'rm', 'tar', 'gzip', 'mktemp',+ 'chmod', 'bash', 'sh', 'env'):+ executable = shutil.which(name)+ if executable:+ (self.tools / name).symlink_to(executable)+ self.command(self.tools / 'python3', '#!/bin/sh\nexit 0\n')+ self.command(self.tools / 'uname', '#!/bin/sh\ncase $1 in -s) echo "${FAKE_OS:-Linux}" ;; -m) echo "${FAKE_ARCH:-x86_64}" ;; esac\n')+ self.command(self.tools / 'getconf', '#!/bin/sh\necho "glibc ${FAKE_GLIBC:-2.39}"\n')+ # -I ... -w: the "latest release" redirect; otherwise: the source tarball on stdout+ self.command(self.tools / 'curl', '#!/bin/sh\n'+ 'printf \'%s\\n\' "$*" >> "$CURL_LOG"\n'+ 'case " $* " in\n'+ ' *" -w "*) printf \'%s\' "https://github.com/opensetlabs/openset-llm/releases/tag/${LATEST:-v9.8.7}" ;;\n'+ ' *) [ -f "$SOURCE" ] || exit 22; cat "$SOURCE" ;;\n'+ 'esac\n')+ self.app = self.work / 'share/openset-llm'+ self.bindir = self.work / 'bin'+ self.source = self.work / 'source.tar.gz'+ self.env = {'HOME': str(self.work), 'PATH': str(self.tools), 'OPENSET_LLM_APP': str(self.app),+ 'OPENSET_LLM_BIN_DIR': str(self.bindir), 'SOURCE': str(self.source),+ 'CURL_LOG': str(self.work / 'curl.log'), 'INSTALL_LOG': str(self.work / 'install.log')}++ def command(self, path, content):+ path.write_text(content)+ path.chmod(0o755)++ def release(self, install_rc=0, prebuilt=True, marker='new'):+ files = {+ 'install.sh': '#!/bin/bash\n# --prebuilt\n' if prebuilt else '#!/bin/bash\n',+ 'serve': f'#!/bin/sh\necho "serve {marker} $*"\n',+ 'start': f'#!/bin/sh\necho "start {marker} $*"\n',+ }+ files['install.sh'] += ('printf \'%s|%s\\n\' "$*" "$OPENSET_LLM_RELEASE_URL" >> "$INSTALL_LOG"\n'+ 'echo "Start it: from-the-staging-folder/serve"\n'+ f'exit {install_rc}\n')+ stream = io.BytesIO()+ with tarfile.open(fileobj=stream, mode='w:gz') as tar:+ for name, text in files.items():+ data = text.encode()+ entry = tarfile.TarInfo(f'openset-llm-9.8.7/{name}')+ entry.mode = 0o755+ entry.size = len(data)+ tar.addfile(entry, io.BytesIO(data))+ self.source.write_bytes(stream.getvalue())++ def get(self, **extra):+ with open(ROOT / 'get.sh') as script: # piped, the way users run it+ return subprocess.run(['/bin/bash'], stdin=script, env={**self.env, **extra},+ text=True, capture_output=True, timeout=20)++ def launcher(self, *args):+ return subprocess.run([str(self.bindir / 'openset-llm'), *args], env=self.env, text=True, capture_output=True)++ def test_installs_the_latest_release_and_the_command(self):+ self.release()+ result = self.get()+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertEqual((self.app / '.version').read_text().strip(), 'v9.8.7')+ self.assertNotIn('from-the-staging-folder', result.stdout) # install.sh's own hint names a temporary folder+ self.assertIn('Start it:', result.stdout)+ # install.sh ran with --prebuilt, against the assets of that same release+ self.assertEqual((self.work / 'install.log').read_text().strip(),+ '--prebuilt|https://github.com/opensetlabs/openset-llm/releases/download/v9.8.7')+ self.assertIn('archive/refs/tags/v9.8.7.tar.gz', (self.work / 'curl.log').read_text())+ self.assertEqual(self.launcher().stdout.strip(), 'start new')+ self.assertEqual(self.launcher('--port', '9000').stdout.strip(), 'start new --port 9000')+ self.assertEqual(self.launcher('start', '--port', '9000').stdout.strip(), 'start new --port 9000')+ self.assertEqual(self.launcher('serve', '--no-spec').stdout.strip(), 'serve new --no-spec')+ self.assertEqual(self.launcher('version').stdout.strip(), 'v9.8.7')+ self.assertEqual([p.name for p in self.app.parent.iterdir()], ['openset-llm']) # no staging left behind++ def test_a_named_version_is_used_without_asking_for_the_latest(self):+ self.release()+ result = self.get(OPENSET_LLM_VERSION='v1.2.3')+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertEqual((self.app / '.version').read_text().strip(), 'v1.2.3')+ self.assertNotIn(' -w ', (self.work / 'curl.log').read_text())+ self.assertIn('releases/download/v1.2.3', (self.work / 'install.log').read_text())++ def test_failed_install_keeps_the_previous_version(self):+ self.release(marker='old')+ self.assertEqual(self.get().returncode, 0)+ self.release(install_rc=7, marker='broken')+ result = self.get()+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('did not finish', result.stderr)+ self.assertEqual(self.launcher().stdout.strip(), 'start old')+ self.assertEqual([p.name for p in self.app.parent.iterdir()], ['openset-llm'])++ def test_update_replaces_the_previous_version(self):+ self.release(marker='old')+ self.assertEqual(self.get().returncode, 0)+ self.release(marker='newer')+ self.assertEqual(self.get().returncode, 0)+ self.assertEqual(self.launcher().stdout.strip(), 'start newer')+ self.assertEqual([p.name for p in self.app.parent.iterdir()], ['openset-llm'])++ def test_release_without_a_prebuilt_engine_is_refused(self):+ self.release(prebuilt=False)+ result = self.get()+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('no prebuilt engine', result.stderr)+ self.assertFalse(self.app.exists())+ self.assertFalse((self.work / 'install.log').exists())++ def test_unsupported_machines_are_told_to_build_from_source(self):+ self.release()+ for extra, message in (({'FAKE_ARCH': 'aarch64'}, 'x86-64 only'), ({'FAKE_OS': 'Darwin'}, 'for Linux'),+ ({'FAKE_GLIBC': '2.31'}, 'older than'), ({'FAKE_GLIBC': '2.9'}, 'older than')):+ with self.subTest(extra=extra):+ result = self.get(**extra)+ self.assertNotEqual(result.returncode, 0)+ self.assertIn(message, result.stderr)+ self.assertIn('git clone', result.stderr)+ self.assertFalse(self.app.exists())+ for glibc in ('2.35', '2.36', '2.41'):+ with self.subTest(glibc=glibc):+ self.assertEqual(self.get(FAKE_GLIBC=glibc).returncode, 0)++ def test_unexpected_release_name_is_refused(self):+ self.release()+ result = self.get(LATEST='login?return_to=x')+ self.assertNotEqual(result.returncode, 0)+ self.assertIn('unexpected release name', result.stderr)+ self.assertFalse(self.app.exists())+++if __name__ == '__main__':+ unittest.main()