medic17 commited on
Commit
e750c7e
·
verified ·
1 Parent(s): 9784ea7

Add README

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: agpl-3.0
3
+ tags:
4
+ - koboldcpp
5
+ ---
6
+
7
+ # koboldcpp builds with machine code for Ampere and Ada GPUs
8
+
9
+ Builds of [koboldcpp](https://github.com/LostRuins/koboldcpp)'s CUDA backend from unmodified release tags, with one
10
+ change to the compiler flags.
11
+
12
+ ## Why
13
+
14
+ The official release compiles its GPU code with `-gencode arch=compute_NN,code=compute_NN`. That emits only PTX
15
+ (portable intermediate code), so the NVIDIA driver compiles it the first time a model is loaded on a machine and
16
+ caches the result in `~/.nv/ComputeCache`. On a freshly created cloud GPU instance that cache is empty: measured on
17
+ an NVIDIA A40 with a 31 GB model, the first launch spent about 55 s in "Starting model warm up", against 0.3 s on
18
+ later launches. These builds add machine code, so there is nothing to compile: 11 s to ready instead of 69 s, with
19
+ the same generation speed.
20
+
21
+ ## What is different from the release
22
+
23
+ Only the CUDA 12 flag block of the `Makefile`:
24
+
25
+ ```
26
+ NVCCFLAGS += -Wno-deprecated-gpu-targets \
27
+ -gencode arch=compute_80,code=compute_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_89,code=sm_89 \
28
+ -DKCPP_LIMIT_CUDA_MAX_ARCH=800
29
+ ```
30
+
31
+ - `sm_86` machine code: A40, RTX A6000, RTX 30 series.
32
+ - `sm_89` machine code: L40, L40S, RTX 6000 Ada, RTX 40 series.
33
+ - `compute_80` PTX: fallback for any other card, which then compiles on first use as the release does.
34
+ - The release's `compute_50`, `compute_61` and `compute_75` targets are dropped.
35
+
36
+ Each tarball records the source commit (`SOURCE_COMMIT`) and the exact flags (`BUILD_FLAGS`).
37
+
38
+ ## Files
39
+
40
+ `koboldcpp-<version>-cu12-sm86-sm89.tar.gz` unpacks to `koboldcpp/` with `koboldcpp.py`, `koboldcpp_cublas.so` and
41
+ the files the release bundle carries. Only the CUDA backend is included. Run it with:
42
+
43
+ ```
44
+ python3 koboldcpp/koboldcpp.py --usecuda --model model.gguf
45
+ ```
46
+
47
+ Needs at run time: Python 3 with `jinja2` and `psutil`, the CUDA 12 runtime and cuBLAS libraries
48
+ (`libcublas-12-8` on Ubuntu), and an NVIDIA driver.
49
+
50
+ ## Reproduce
51
+
52
+ `build.sh` in this repository is the complete build. It runs as a Hugging Face Job:
53
+
54
+ ```
55
+ hf jobs run --flavor cpu-upgrade --timeout 2h --secrets HF_TOKEN \
56
+ -e KCPP_VERSION=1.121 -e HF_REPO=<user>/<repo> \
57
+ nvidia/cuda:12.8.1-devel-ubuntu22.04 \
58
+ bash -c 'apt-get update -qq && apt-get install -y -qq curl ca-certificates >/dev/null && curl -fsSL https://huggingface.co/<user>/<repo>/resolve/main/build.sh | bash'
59
+ ```
60
+
61
+ ## Licence
62
+
63
+ koboldcpp is licensed under AGPL-3.0; its bundled GGML, llama.cpp and stable-diffusion.cpp parts are MIT. Both
64
+ licence texts are inside each tarball. The corresponding source is the upstream repository at the commit in
65
+ `SOURCE_COMMIT`, plus `build.sh` here.