broadfield's picture
Add README with full docs
54adb5f verified
|
Raw History Blame Contribute Delete
7.6 kB
# llamainstall — llama.cpp on any device
One installer to put **llama.cpp v1.x** on **any** device. It auto-detects your
hardware, picks the best backend (CUDA → ROCm → Vulkan → CPU / Metal), downloads
the exact tuned binary from the official llama.cpp bucket, and acts as a tiny
version manager (install / switch / rollback / remove).
The scripts themselves are tiny wrappers around the official binary bucket
(`ggml-org/install.sh` on Hugging Face), which the llama.cpp project updates
with every release. This means **you always get the latest binaries without us
mirroring 192 GB of artifacts** — and you can even point the scripts at your own
bucket with `LLAMA_BUCKET=yourorg/your-bucket`.
- 🏠 Landing page: <https://broadfield-llamainstall.hf.space>
- 🤗 Scripts repo: <https://huggingface.co/datasets/broadfield/llamainstall-scripts>
- 📦 Upstream: <https://github.com/ggml-org/llama.cpp> (current stable: **v1.0.0**)
---
## Quick install
**macOS / Linux / FreeBSD (bash or sh):**
```bash
curl -LsSf https://huggingface.co/datasets/broadfield/llamainstall-scripts/resolve/main/llamainstall.sh | sh
```
**Windows (PowerShell ≥ 5.1):**
```powershell
irm https://huggingface.co/datasets/broadfield/llamainstall-scripts/resolve/main/llamainstall.ps1 | iex
```
That's it. The installer:
1. resolves the **latest** build from the bucket (`latest` pointer),
2. runs hardware **probes** and picks CUDA → ROCm → Vulkan → CPU (or Metal on Apple),
3. downloads the matching **tuned binary**,
4. verifies the version stamp, and
5. puts `llama` (or `llama.exe` on Windows) on your PATH.
Try it:
```bash
llama serve # opens the built-in Web UI on http://localhost:8080
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF # chat in the terminal
```
---
## Usage
| Command | Effect |
|---|---|
| `llamainstall install [version]` | install (default: latest) and activate |
| `llamainstall use <version>` | switch active version |
| `llamainstall list` | show installed versions + active |
| `llamainstall remove <version>` | delete a version |
| `llamainstall doctor` | report hardware + recommended backend |
| `llamainstall models` | popular GGUF models to try |
| `llamainstall serve [model]` | run llama-server with a small model |
| `llamainstall uninstall` | remove everything |
**Versions:** `latest` (default) · `stable` · `b<build>` (e.g. `b12359`) ·
`g<commit>` · `v<tag>` (e.g. `v1.0.0`).
Examples:
```bash
llamainstall install b12359 # pin a specific nightly build
llamainstall use b12320 # roll back to an older build
llamainstall list # see what you have
```
---
## Environment variables
| Variable | Effect |
|---|---|
| `LLAMA_BUCKET` | custom bucket, e.g. `yourorg/install.sh` (default `ggml-org/install.sh`) |
| `LLAMA_VERSION` | force a version instead of resolving `latest` |
| `HF_TOKEN` | pass an HF token for rate-limited/private models |
| `SKIP_CUDA` `SKIP_ROCM` `SKIP_VULKAN` | skip probe backends (any non-empty value) |
| `LLAMAINSTALL_ROOT` | change install root (bash only, default `~/.llamainstall`) |
---
## Install location
| Platform | Binary | Version data |
|---|---|---|
| macOS / Linux / FreeBSD | `~/.local/bin/llama` (symlink) | `~/.llamainstall/versions/<ver>/llama` |
| Windows | `%LOCALAPPDATA%\Microsoft\WindowsApps\llama.exe` | `%LOCALAPPDATA%\llamainstall\versions\<ver>\llama.exe` |
The active version is recorded in `~/.llamainstall/active` (or
`%LOCALAPPDATA%\llamainstall\active`). `use`/`install` re-point the symlink/copy,
so rollback is instant.
---
## Backends & hardware
The official bucket ships prebuilt, **hardware-tuned** binaries. The probe order:
| Backend | Used when |
|---|---|
| **CUDA** | NVIDIA GPU + driver/CUDA toolkit detected |
| **ROCm** | AMD GPU + HIP SDK detected |
| **Vulkan** | generic GPU with Vulkan driver (works on most iGPUs) |
| **CPU** | anything else — tuned by CPU SIMD feature set (AVX512/AVX2/AVX/…) |
| **Metal** | macOS Apple Silicon (M1–M5 / A18) |
Run `llamainstall doctor` to see exactly what your machine reports.
**Windows notes**
- CUDA acceleration needs the NVIDIA CUDA Toolkit: `winget install Nvidia.CUDA`
(the probe detects a missing toolkit and tells you).
- ROCm on Windows needs the HIP SDK from AMD.
- Vulkan needs no toolkit for most GPUs — good fallback for Intel iGPUs.
---
## Running models
`llama` is the single multi-call binary (CLI, server, and tools). Popular GGUFs:
| Approx. size | Model | HF repo id |
|---|---|---|
| 0.6 GB | Qwen3.5-0.8B-GGUF | `ggml-org/Qwen3.5-0.8B-GGUF` |
| 0.9 GB | Llama-3.2-1B-Instruct-GGUF | `ggml-org/Llama-3.2-1B-Instruct-GGUF` |
| 2.0 GB | Qwen3-4B-GGUF | `ggml-org/Qwen3-4B-GGUF` |
| 2.2 GB | Llama-3.2-3B-Instruct-GGUF | `ggml-org/Llama-3.2-3B-Instruct-GGUF` |
| 4.9 GB | Qwen3-8B-GGUF | `ggml-org/Qwen3-8B-GGUF` |
| 5.0 GB | DeepSeek-R1-Distill-Qwen-7B | `ggml-org/DeepSeek-R1-Distill-Qwen-7B-GGUF` |
Run any of them directly:
```bash
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF # OpenAI-compatible server + Web UI
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF # terminal chat
```
---
## Other devices
### Docker
```bash
docker run -p 8080:8080 -v ./models:/models ghcr.io/ggml-org/llama.cpp:server
# CUDA variant
docker run --gpus all -p 8080:8080 -v ./models:/models ghcr.io/ggml-org/llama.cpp:server-cuda
```
See the official docs: <https://github.com/ggml-org/llama.cpp/blob/master/docs/docker.md>
### Android (Termux)
Build from source inside Termux — ARM64 (aarch64) with Vulkan works well:
```bash
pkg install cmake ninja vulkan-headers
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build -DGGML_VULKAN=ON && cmake --build build -j4
```
Official guide: <https://github.com/ggml-org/llama.cpp/blob/master/docs/android.md>
### WSL2
Inside WSL2, just use the Linux script. CUDA passes through automatically with
a recent Windows NVIDIA driver (no CUDA inside Linux needed).
### RISC-V / other CPUs
Build from source — llama.cpp has RVV, ZVFH and AMX tuning. Follow the build
guide: <https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md>
---
## How it works (internals)
`llamainstall.sh` and `llamainstall.ps1` are thin, dependency-light wrappers
around the official llama.cpp binary bucket:
```
https://huggingface.co/buckets/<LLAMA_BUCKET>/resolve/<VERSION>/latest
https://huggingface.co/buckets/<LLAMA_BUCKET>/resolve/<VERSION>/<ARCH>/<OS>/<backend>/probe/probe.zst
https://huggingface.co/buckets/<LLAMA_BUCKET>/resolve/<VERSION>/<ARCH>/<OS>/<backend>/<config>/llama-app.zst
```
They download a small **probe** binary, run it to detect your hardware config,
then fetch the matching **llama-app binary** (zstd-compressed), verify the
version stamp, and install it. On macOS the Metal config comes from `sysctl`
instead of a probe binary.
The same trick means you can host your own bucket on Hugging Face (Storage
Buckets) and point `LLAMA_BUCKET` at it — handy for air-gapped fleets or custom
builds (e.g. a specific CUDA arch matrix).
---
## Security
- Downloads come from **huggingface.co** over TLS (the official distribution
host used by llama.cpp itself).
- The version stamp is verified after download (protects against truncation).
- The scripts only run the official `probe`/`featcode` binaries from the bucket.
- Set `HF_TOKEN` if you need authenticated access.
---
## License
The scripts are MIT — do whatever you like. The llama.cpp binaries are MIT
licensed by the llama.cpp project. GGUF models have their own licenses — check
each model card.