File size: 2,811 Bytes
5ce45af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# One-off on 2026-12-01 16:40Z, safe to run again. Two faults in the scoring of that afternoon:
#   1. eval/rescore.sh ran the harness in the run's folder, so its report landed next to the run's own files and the
#      merge, which looks in rescore/, found none and recorded "scored again, nothing resolved" without reading a result.
#   2. the harness's last step failed for some runs while hundreds of other containers came and went, so they have
#      per-instance reports and no run report ("NO REPORT FILE").
# This moves the misplaced reports, forgets the empty merges and merges again from the real reports, then scores
# again every run that finished scoring without a summary. Nothing is scored from memory: every number is re-read.
#   bash tools/fix_scoring.sh
R=/data/train/mini
P=$R/venv/bin/python
log() { echo "$(date -u +%FT%TZ) [fix] $*" | tee -a $R/logs/fix_scoring.log; }
cd $R/src
tmux kill-session -t rq 2>/dev/null
for p in $(pgrep -f 'eval/[r]escore.sh'); do kill "$p" 2>/dev/null; done
sleep 2
for d in $R/results/agent/* $R/results/deep/att-* $R/results/prune*/att-*; do
    [ -s "$d/summary.json" ] || continue
    [ "$(basename "$d")" = opus55-1 ] && continue                 # its rescoring ran in rescore/ and was merged correctly
    case "$d" in */att-*) label=$(basename "$(dirname "$d")")-$(basename "$d") ;; *) label=$(basename "$d") ;; esac
    mkdir -p "$d/rescore"
    mv "$d"/*-rescore.json "$d/rescore/" 2>/dev/null
    $P eval/rescore_merge.py reset "$d" "$label" >/dev/null
    rm -rf "$d/rescore.lock"
    if ls "$d"/rescore/*.json >/dev/null 2>&1; then
        log "$label: $($P eval/rescore_merge.py merge "$d" "$label" | cut -c1-200)"
        mkdir -p "$d/rescore.lock"
    else
        rm -rf "$d/rescore"
    fi
done
# runs whose scoring ended with no summary: score again (finished instances are read back, the rest are run)
n=0
for d in $R/results/agent/* $R/results/deep/att-* $R/results/prune*/att-*; do
    [ -s "$d/preds.json" ] && [ ! -s "$d/summary.json" ] || continue
    grep -q "scoring done" "$d/meta.txt" 2>/dev/null || continue
    pgrep -f "run_id $(basename "$d") " >/dev/null && continue
    case "$d" in */att-*) label=$(basename "$(dirname "$d")")-$(basename "$d") ;; *) label=$(basename "$d") ;; esac
    pgrep -f "run_id $label " >/dev/null && continue
    n=$((n + 1))
    tmux new-session -d -s "again$(date +%s)x$n" "cd $R/src && LABEL=$label OUT=$d EW=6 bash eval/score.sh > $R/logs/again-$label.log 2>&1; echo \"\$(date -u +%FT%TZ) [fix] $label scored again: \$(tail -1 $R/logs/again-$label.log | cut -c1-200)\" >> $R/logs/fix_scoring.log"
    log "$label: scoring again"
done
tmux new-session -d -s rq "bash $R/src/tools/rescore_queue.sh 2>&1 | tee -a $R/logs/rescore_queue.log"
log "done; rescore queue restarted"