File size: 1,959 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 | #!/usr/bin/env bash
# Deep mode, rule C: for the tasks where the N attempts disagree, one more session of the model, with tools, in the
# task's container: it reads the candidate patches, writes a reproduction, tries each candidate and submits the final
# patch. It never sees the benchmark's tests. Then the result is scored.
# N=8 PORT=9006 bash tools/review_run.sh (on the node in tmux; a live engine on PORT)
# LIMIT=3 reviews only the first three tasks and does not score: a smoke test.
set -u
R=/data/train/mini
N=${N:?}; PORT=${PORT:-9006}; TAG=${TAG:-deep}; WORKERS=${WORKERS:-40}
P=$R/venv/bin/python
log() { echo "$(date -u +%FT%TZ) [review N=$N] $*"; }
cd $R/src
D=$R/results/review/$TAG-n$N; C=$R/pool_patches/cands-$TAG-n$N
[ -n "${LIMIT:-}" ] && D=$D-smoke
mkdir -p $D
log "$($P deep/make_candidates.py --attempts $R/results/$TAG --n $N --out-patches $C --out-subset $D/subset.json)"
if [ -n "${LIMIT:-}" ]; then
$P -c "import json,sys; d=json.load(open(sys.argv[1])); d['instance_ids']=d['instance_ids'][:int(sys.argv[2])]; json.dump(d, open(sys.argv[1],'w'))" $D/subset.json "$LIMIT"
fi
LABEL=${TAG}C-review-n$N OUT=$D URL=http://127.0.0.1:$PORT/v1 WORKERS=$WORKERS TEMP=0.8 STEPS=100 MAXTOK=8192 SUBSET=$D/subset.json \
STARTUP="mkdir -p /tmp/candidates; cp /patches/cands-$TAG-n$N/{{instance_id}}/* /tmp/candidates/ 2>/dev/null; true" \
EXTRA_ARGS="-c $R/src/deep/review.yaml" taskset -c 32-255 bash eval/run_agent.sh > $R/logs/review-$TAG-n$N.log 2>&1
log "sessions: $(tail -1 $R/logs/review-$TAG-n$N.log | cut -c1-220)"
[ -n "${LIMIT:-}" ] && exit 0
log "$($P deep/merge_review.py --base $R/results/agent/${TAG}A-n$N/preds.json --review $D/preds.json --subset $D/subset.json --cands $C \
--out $R/results/agent/${TAG}C-n$N --name rightnow-mini-$TAG-reviewed-n$N)"
LABEL=${TAG}C-n$N EW=8 bash eval/score.sh > $R/logs/${TAG}C-score-$N.log 2>&1
log "scored: $(tail -1 $R/logs/${TAG}C-score-$N.log | cut -c1-220)"
|