git clone https://github.com/ggerganov/llama.cpp cd llama.cpp
$ nvidia-smi --query-gpu=compute_cap --format=csv,noheader 89
GPU_CC=89
$ nvcc --list-gpu-arch … compute_75 compute_80 compute_86 compute_87 …
$ cmake -B build \
-DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=$GPU_CC \
-DCMAKE_BUILD_TYPE=Release
$ time cmake --build build --config Release -j $(nproc)
-Wl,-rpath,… (see cat build/tools/cli/CMakeFiles/llama-cli.dir/link.txt) so that they contain the paths of the shared objects they need. $ readelf -d build/bin/llama-cli | grep -E 'RPATH|RUNPATH' $ ldd build/bin/llama-simple | grep $PWD
-G "MinGW Makefiles" option: P:\ath\to\llama.cpp> cmake -B build -G "MinGW Makefiles" P:\ath\to\llama.cpp> cmake --build build --config Release
build/bin (the common prefix llama- is removed): batched-bench | Benchmark the batched decoding performance |
batched | Demonstration of batched generation from a given prompt. A swift clone is found under examples/batched.swift |
bench | Benchmark the performance of the inference for various parameters. |
cli | A CLI tool for accessing and experimenting with most of llama.cpp's functionality. TODO For the --grammar, --grammar-file and --json-schema command line options see grammars below. |
convert-llama2c-to-ggml | This example reads weights from Andrej Karpathy's llama2.c project and saves them in ggml compatible format. The vocab that is available in models/ggml-vocab.bin is used by default |
cvector-generator | Demonstration of how to generate a control vector using gguf models. |
embedding | Demonstrates the generation of a(?) high-dimensional vector of a given text |
eval-callback | Using callbacks during intference to print all operations and tensor data to the console. |
export-lora | Apply LORA adapters to base models and export the resulting model |
gen-docs | |
gguf-hash | Hash GGUF files to detect difference on a per model and per tensor level. |
gguf-split | CLI to split and merge GGUF files |
gguf | |
gritlm | Example for Generative Representational Instruction Tuning (GRIT). A gritlm model can generate embeddings as well as "normal" text generation depending on the instructions in the prompt. |
imatrix | Computes an importance matrix for a model and given text dataset - which Can be used during quantization to enchance the quality of the quantized models (See Pull Request 4861) |
infill | Using the infill mode with Code Llama models supporting infill mode. |
llava-cli | LLaVA ? |
lookahead | Demonstration of lookahead decoding technique, see also Break the Sequential Dependency of LLM Inference Using Lookahead Decoding and Pull Request 4207 |
lookup-create | Demonstration of Prompt Lookup Decoding, see also apoorvumang/prompt-lookup-decoding, Pull Reqeust 4484 and Issue 4226. |
lookup-merge | |
lookup-stats | |
lookup | |
minicpmv-cli | |
parallel | (Simplified) simulation of erving incoming requests in parallel |
passkey | A passkey retrieval task is an evaluation method used to measure a language models ability to recall information from long contexts. See also Pull Requests 3856 and 4810. |
perplexity | A tool for measuring the perplexity (and other quality metrics) of a model over a given text. |
q8dot | |
quantize | … |
qwen2vl-cli | |
retrieval | Demonstration of a simple retrieval technique based on cosine similarity. |
run | A comprehensive example for (minimally) running llama.cpp models. Useful for inferencing. Used with RamaLama |
save-load-state | |
server | The LLaMA.cpp HTTP Server: A lightweight, OpenAI API compatible, HTTP server for serving LLMs. Based on cpp-httplib and nlohman/json. (llama-server -m model.gguf --port 11434). See also grammars/ below. |
simple-chat | Demonstration of a simple chat program using the chat template from the GGUF file. |
simple | A minimal example for implementing apps with llama.cpp. Useful for developers. |
speculative-simple | Demonstration of basic greedy speculative decoding |
speculative | Demonstration of speculative decoding and tree-based speculative decoding techniques |
tokenize | … |
tts | … |
vdot |
test_ omitted): arg-parser | |
autorelease | |
backend-ops | |
barrier | |
c | |
chat-template | |
gguf | |
log | |
model-load-cancel | |
quantize-fns | |
quantize-perf | |
rope | |
tokenizer-0 |
cd llama.cpp make -j