File size: 1,772 Bytes
6071ec5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
# Knowledge-retention check with the SlayerLab benchmark pipeline (slayerlabs/benchmarks-fabryka-ai @ 2f4c0491,
# research/common/ewaluuj.py, lm-eval 0.4.9.1, model "slayer", panel200 sample, same protocol as the Slayer Space).
#   bash bench_suite.sh <ckpt.pt> <label> [gpu]
set -euo pipefail
CKPT=$1; LABEL=$2; GPU=${3:-0}
# generative tasks (~6 s/item on this model, ~20 min each at panel200) are skipped to stay within budget; GSM8K is measured in chat format by gsm_chat_eval.py
GEN_SKIP=",T30,T31,T33,T34,T36,T38,T39,T41,T42,T43,T47,"
if [ -n "${ZAD:-}" ]; then ZAD=$(echo "$ZAD" | tr ',' '
' | while read -r t; do case "$GEN_SKIP" in *",$t,"*) ;; *) echo "$t";; esac; done | paste -sd, -); fi
R=/workspace/benchrepo/research
PKG=/workspace/pkg/$LABEL
mkdir -p "$PKG" /workspace/slayer1b/results/bench
/venv/main/bin/python - "$CKPT" "$PKG" <<'PY'
import json, shutil, sys, torch
from safetensors.torch import save_file
ck, out = sys.argv[1], sys.argv[2]
st = torch.load(ck, map_location="cpu", weights_only=True)
sd = {k: v.float().contiguous() for k, v in st["model"].items() if k != "head.weight"}   # head is tied to tok
save_file(sd, f"{out}/model.safetensors")
json.dump(st["config"], open(f"{out}/config.json", "w"))
shutil.copy("/workspace/ckpt/tokenizer.json", f"{out}/tokenizer.json")
print("package", out, len(sd), "tensors")
PY
cd "$R"
CUDA_VISIBLE_DEVICES=$GPU .venv-eval/bin/python common/ewaluuj.py --model slayer --repo "local/$LABEL" --revision none \
  --model_path "$PKG" --device cuda --batch 16 --probka panel200 \
  --zadania ${ZAD:-T02,T05,T06,T07,T08,T10,T04,T24,T22,T25} --wyjscie "/workspace/slayer1b/results/bench/$LABEL" --etykieta "$LABEL" \
  > "/workspace/slayer1b/results/bench/$LABEL.log" 2>&1
echo "done $LABEL"