jeeltcraft commited on
Commit
9739e3d
·
verified ·
1 Parent(s): 87592c6

wait for model loading on startup

Browse files
Files changed (1) hide show
  1. run.sh +18 -3
run.sh CHANGED
@@ -1,5 +1,6 @@
1
  #!/bin/bash
2
  set -e
 
3
  /llama.cpp/build/bin/llama-server \
4
  --hf-repo Qwen/Qwen2.5-7B-Instruct-GGUF \
5
  --hf-file qwen2.5-7b-instruct-q3_k_m.gguf \
@@ -12,10 +13,24 @@ set -e
12
 
13
  LLAMA_PID=$!
14
 
15
- sleep 8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- if ! kill -0 "$LLAMA_PID" 2>/dev/null; then
18
- echo "llama-server failed to start"
19
  exit 1
20
  fi
21
 
 
1
  #!/bin/bash
2
  set -e
3
+
4
  /llama.cpp/build/bin/llama-server \
5
  --hf-repo Qwen/Qwen2.5-7B-Instruct-GGUF \
6
  --hf-file qwen2.5-7b-instruct-q3_k_m.gguf \
 
13
 
14
  LLAMA_PID=$!
15
 
16
+ echo "Waiting for llama-server to become ready..."
17
+
18
+ for i in $(seq 1 180); do
19
+ if curl -fsS http://127.0.0.1:8080/health >/dev/null; then
20
+ echo "llama-server is ready"
21
+ break
22
+ fi
23
+
24
+ if ! kill -0 "$LLAMA_PID" 2>/dev/null; then
25
+ echo "llama-server stopped during startup"
26
+ exit 1
27
+ fi
28
+
29
+ sleep 2
30
+ done
31
 
32
+ if ! curl -fsS http://127.0.0.1:8080/health >/dev/null; then
33
+ echo "llama-server did not become ready within 6 minutes"
34
  exit 1
35
  fi
36