HelloSun commited on
Commit
0039a57
·
verified ·
1 Parent(s): e93524d

Upload build_llamacpp_pangu_diffusion.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. build_llamacpp_pangu_diffusion.sh +50 -0
build_llamacpp_pangu_diffusion.sh ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #
3
+ # One-click build of llama.cpp with openPangu-R-7B-Diffusion support.
4
+ #
5
+ # ./build_llamacpp_pangu_diffusion.sh
6
+ #
7
+ # It will:
8
+ # 1. clone llama.cpp at the pinned release tag
9
+ # 2. download and apply the openPangu-R-Diffusion patch
10
+ # 3. build llama-diffusion-cli / llama-cli / llama-quantize
11
+ #
12
+ # Requirements: git, cmake >= 3.14, a C/C++ toolchain, and (optionally) an NVIDIA GPU.
13
+ #
14
+ set -euo pipefail
15
+
16
+ LLAMA_TAG="b11719"
17
+ PATCH_URL="https://huggingface.co/HelloSun/openPangu-R-7B-Diffusion-Q4KM/resolve/main/pangu-diffusion-llamacpp.patch"
18
+ WORKDIR="${WORKDIR:-$PWD/pangu-diffusion-build}"
19
+
20
+ mkdir -p "$WORKDIR"
21
+ cd "$WORKDIR"
22
+
23
+ if [ ! -d llama.cpp ]; then
24
+ echo ">>> cloning llama.cpp ($LLAMA_TAG) ..."
25
+ git clone --depth 1 --branch "$LLAMA_TAG" https://github.com/ggml-org/llama.cpp.git
26
+ fi
27
+
28
+ cd llama.cpp
29
+ git checkout -- . 2>/dev/null || true
30
+
31
+ echo ">>> downloading patch ..."
32
+ curl -L --fail -o pangu-diffusion-llamacpp.patch "$PATCH_URL"
33
+
34
+ echo ">>> applying patch ..."
35
+ git apply pangu-diffusion-llamacpp.patch
36
+
37
+ echo ">>> configuring ..."
38
+ if command -v nvcc >/dev/null 2>&1; then
39
+ cmake -B build -DGGML_CUDA=ON -DLLAMA_CURL=OFF
40
+ else
41
+ cmake -B build -DGGML_NATIVE=ON -DLLAMA_CURL=OFF
42
+ fi
43
+
44
+ echo ">>> building ..."
45
+ cmake --build build --config Release -j"$(nproc)" --target llama-diffusion-cli llama-cli llama-quantize
46
+
47
+ echo
48
+ echo ">>> done. binaries:"
49
+ echo " $WORKDIR/llama.cpp/build/bin/llama-diffusion-cli"
50
+ echo " $WORKDIR/llama.cpp/build/bin/llama-cli"