File size: 1,291 Bytes
2e13348
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# Launch llama-server for a GGUF, wait until ready, run official lm-eval ifeval
# (apply_chat_template, client-side pristine tokenizer), then kill the server.
#   run_quant_ifeval.sh <gguf> <label> <port> <gpu>
set -u
GGUF="$1"; LABEL="$2"; PORT="$3"; GPU="$4"
SRV=/workspace/llm/llama.cpp/build/bin/llama-server
SCR=/tmp/claude-0/-workspace/f1993a73-9699-445b-818e-eb56628e7541/scratchpad
SRVLOG="$SCR/srv_${LABEL}.log"

CUDA_VISIBLE_DEVICES="$GPU" "$SRV" -m "$GGUF" --host 127.0.0.1 --port "$PORT" \
  --alias kosv4 -ngl 99 -c 8192 -np 4 -t 6 > "$SRVLOG" 2>&1 &
SRVPID=$!
echo "[$LABEL] server pid=$SRVPID gpu=$GPU port=$PORT gguf=$(basename "$GGUF")"

# wait for /health ok (up to 120s)
ok=0
for i in $(seq 1 120); do
  if curl -s "http://127.0.0.1:$PORT/health" 2>/dev/null | grep -q '"status":"ok"'; then ok=1; break; fi
  if ! kill -0 "$SRVPID" 2>/dev/null; then echo "[$LABEL] server died early"; tail -20 "$SRVLOG"; exit 1; fi
  sleep 1
done
[ "$ok" = 1 ] || { echo "[$LABEL] server not ready"; tail -20 "$SRVLOG"; kill "$SRVPID" 2>/dev/null; exit 1; }
echo "[$LABEL] server ready after ~${i}s"

cd "$SCR"
python3 run_lmeval_gguf.py "$PORT" "$LABEL"
RC=$?
kill "$SRVPID" 2>/dev/null
wait "$SRVPID" 2>/dev/null
echo "[$LABEL] done rc=$RC, server stopped"
exit $RC