cloudunity commited on
Commit
df20cf4
·
verified ·
1 Parent(s): 4a86e79

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +85 -0
start.sh ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ MODEL_DIR="/data/models"
5
+
6
+ mkdir -p "$MODEL_DIR"
7
+
8
+ MODEL_REPO="ornith-ai/Ornith-1.5-9B-GGUF"
9
+ MODEL_FILE="Ornith-1.5-9B-Q4_K_M.gguf"
10
+
11
+ echo "=============================================="
12
+ echo " Ornith-1.5-9B"
13
+ echo " CPU / Q4_K_M / Long Context"
14
+ echo "=============================================="
15
+
16
+ echo "Downloading model..."
17
+
18
+ python - <<PY
19
+ from huggingface_hub import hf_hub_download, list_repo_files
20
+
21
+ files = list_repo_files("${MODEL_REPO}")
22
+ expected = "${MODEL_FILE}"
23
+ if expected not in files:
24
+ print(f"ERROR: {expected} not found in repo. Available GGUF files:")
25
+ for f in sorted(files):
26
+ if f.endswith(".gguf"):
27
+ print(f" {f}")
28
+ raise SystemExit(1)
29
+
30
+ path = hf_hub_download(
31
+ repo_id="${MODEL_REPO}",
32
+ filename="${MODEL_FILE}",
33
+ local_dir="${MODEL_DIR}",
34
+ )
35
+
36
+ print("Downloaded:")
37
+ print(path)
38
+ PY
39
+
40
+ MODEL="${MODEL_DIR}/${MODEL_FILE}"
41
+
42
+ if [ ! -f "$MODEL" ]; then
43
+ echo "ERROR: Model not found:"
44
+ echo "$MODEL"
45
+ echo
46
+ echo "Files in model directory:"
47
+ ls -lah "$MODEL_DIR"
48
+ exit 1
49
+ fi
50
+
51
+ echo
52
+ echo "Model:"
53
+ ls -lh "$MODEL"
54
+
55
+ echo
56
+ echo "Starting llama-server..."
57
+
58
+ export LD_LIBRARY_PATH="/opt/llama${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
59
+
60
+ exec /opt/llama/llama-server \
61
+ --model "$MODEL" \
62
+ --host 0.0.0.0 \
63
+ --port 7860 \
64
+ --ctx-size 32768 \
65
+ --threads 2 \
66
+ --threads-batch 2 \
67
+ --batch-size 512 \
68
+ --ubatch-size 128 \
69
+ --cache-type-k q8_0 \
70
+ --cache-type-v q8_0 \
71
+ --flash-attn on \
72
+ --cont-batching
73
+ 2>/dev/null || \
74
+ /opt/llama/llama-server \
75
+ --model "$MODEL" \
76
+ --host 0.0.0.0 \
77
+ --port 7860 \
78
+ --ctx-size 32768 \
79
+ --threads 2 \
80
+ --threads-batch 2 \
81
+ --batch-size 512 \
82
+ --ubatch-size 128 \
83
+ --cache-type-k q8_0 \
84
+ --cache-type-v q8_0 \
85
+ --cont-batching