RSIChallenge / auto-impl /scripts /ptb_status.sh
Jerry999's picture
Add files using upload-large-folder tool
158258b verified
Raw History Blame Contribute Delete
3.45 kB
#!/bin/bash
# One-screen status of the PostTrainBench reproduction: queue, baseline validation, sweep results.
# bash scripts/ptb_status.sh
set -uo pipefail
cd /home/jiaruiliu/local/git-repos/auto-impl
RESULTS="${RESULTS:-/home/jiaruiliu/ptb-data/results}"
SWEEP_DIR="$RESULTS/claude_non_api_claude-opus-5_10h_run1"
echo "════════ 队列 ════════"
squeue -u "$USER" -o "%.9i %.18j %.9T %.12r %.11M %.20R" 2>/dev/null | grep -E "ptb|JOBID" || echo "(无 ptb 作业)"
echo
echo "════════ base model 权重 ════════"
PYTHONPATH=src python3 -c "
from posttrainbench.solve import model_is_cached
for m in ['google/gemma-3-4b-pt','Qwen/Qwen3-4B-Base','Qwen/Qwen3-1.7B-Base','HuggingFaceTB/SmolLM3-3B-Base']:
ok = model_is_cached(m)
print(f' {m:34} {\"就绪\" if ok else \"缺权重 -- 该模型的 cell 会失败\"}')
" 2>/dev/null
echo
echo "════════ baseline 复现验证 ════════"
bash scripts/ptb_validate_baselines.sh --check 2>/dev/null
echo
echo "════════ sweep 结果 (seed _run1) ════════"
if [[ -d "$SWEEP_DIR" ]]; then
printf "%-46s %-12s %s\n" RUN STATUS SCORE
for d in "$SWEEP_DIR"/*/; do
[[ -d "$d" ]] || continue
name=$(basename "$d")
if [[ -f "$d/metrics.json" ]]; then
score=$(python3 -c "import json;m=json.load(open('$d/metrics.json'));print(f\"{m.get('accuracy', m.get('score','?')):.4f}\")" 2>/dev/null || echo "?")
printf "%-46s %-12s %s\n" "$name" "done" "$score"
elif [[ -d "$d/final_model" ]]; then
printf "%-46s %-12s %s\n" "$name" "评测中" "-"
else
printf "%-46s %-12s %s\n" "$name" "agent中" "-"
fi
done
else
echo "(还没有 run 目录)"
fi
echo
echo "════════ agent 终止原因 ════════"
# terminal_reason is the reliable signal. The error text varies too much to grep for: one cell
# died on "API Error: Server error mid-response", another on "Server is temporarily limiting
# requests (not your usage limit)" -- neither contains rate_limit_error or any other fixed token.
for d in "$SWEEP_DIR"/*/; do
[[ -f "$d/solve_out.txt" ]] || continue
reason=$(grep -oE '"terminal_reason":"[^"]*"' "$d/solve_out.txt" 2>/dev/null | tail -1 | cut -d'"' -f4)
[[ -n "$reason" && "$reason" != "success" ]] || continue
printf " %-46s %s\n" "$(basename "$d" | sed 's/_2026.*//')" "$reason"
grep -oE '"result":"[^"]{0,100}' "$d/solve_out.txt" 2>/dev/null | tail -1 | sed 's/^/ /'
done
echo " (空 = 无异常终止)"
echo
echo "════════ 近期结束的作业 ════════"
sacct --starttime=now-2days --format=JobID,JobName%22,State,ExitCode,Elapsed 2>/dev/null \
| grep -E "ptb" | grep -v "\.batch\|\.extern" | tail -25
echo
echo "════════ 失败作业的报错 ════════"
for jid in $(sacct --starttime=now-2days --format=JobID,JobName%22,State -P 2>/dev/null \
| grep -E "ptb" | grep -v "\.batch\|\.extern" | grep -E "FAILED|TIMEOUT|CANCELLED|OUT_OF" \
| cut -d'|' -f1 | tail -6); do
for f in logs/*-"$jid".out; do
[[ -f "$f" ]] || continue
echo "--- $f ---"
grep -E "Error|error:|Traceback|Missing API|no GPU|shim did not|No x2p|SystemExit|CUDA out of memory|rate.?limit|401|429" "$f" | tail -5
done
done