KOS-V4-Instruct-GGUF / testing /run_quant_ifeval.sh
codybum's picture
Upload testing/run_quant_ifeval.sh with huggingface_hub
2e13348 verified
Raw
History Blame Contribute Delete
1.29 kB
#!/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