File size: 2,203 Bytes
aa1df78 | 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 | #!/usr/bin/env bash
# Best-of-N data generation: sampled attempts of the stock model on every pool task, with the same bash-only agent
# as the evaluation. Attempts run side by side, spread over the generation servers.
# ATTEMPTS="1 2 3" PORTS="9003 9004 9005" bash train/gen.sh
# Output: /data/train/mini/results/gen/att-<k>/{preds.json, <instance>/<instance>.traj.json}
#
# A SWE-smith task is the repository with one bug put in. STARTUP builds that state in the container before the
# agent starts, from files written by train/make_task_states.py (no network needed; the official way is a branch
# fetched from GitHub, which failed while the data center's network was down on 2026-12-01).
# (A first run that day built no state at all, so the agents worked on repositories without the bug: thrown away.)
set -u
R=/data/train/mini
ATTEMPTS=${ATTEMPTS:-1 2 3}; PORTS=(${PORTS:-9003 9004 9005})
TEMP=${TEMP:-0.8}; STEPS=${STEPS:-75}; WORKERS=${WORKERS:-40}; MODEL=${MODEL:-hosted_vllm/inkling-2-mini}
POOL=${POOL:-$R/src/train/pool/pool.json}; TAG=${TAG:-gen}
DATA=${DATA:-smith}; SPLIT=${SPLIT:-train}; MAXTOK=${MAXTOK:-8192}
if [ "$DATA" = smith ]; then
STARTUP=${STARTUP:-'cd /testbed && git apply /patches/{{instance_id}}.diff 2>/dev/null && (git apply --numstat /patches/{{instance_id}}.diff | cut -f3 | xargs -r git add --) && (xargs -r git rm -q -f --ignore-unmatch -- < /patches/{{instance_id}}.rm) && git -c user.email=task@local -c user.name=task commit -qm task-state'}
else
STARTUP=${STARTUP:-}
fi
export STARTUP
i=0
echo "== $TAG start $(date -u +%FT%TZ): attempts [$ATTEMPTS] on ports [${PORTS[*]}] temp=$TEMP steps=$STEPS workers=$WORKERS maxtok=$MAXTOK data=$DATA"
for k in $ATTEMPTS; do
port=${PORTS[$((i % ${#PORTS[@]}))]}; i=$((i + 1))
( LABEL=$TAG-att-$k OUT=$R/results/$TAG/att-$k URL=http://127.0.0.1:$port/v1 MODEL=$MODEL WORKERS=$WORKERS TEMP=$TEMP \
STEPS=$STEPS SUBSET=$POOL DATA=$DATA SPLIT=$SPLIT MAXTOK=$MAXTOK taskset -c 32-255 bash $R/src/eval/run_agent.sh > $R/logs/$TAG-att-$k.log 2>&1
echo "attempt $k done $(date -u +%TZ): $(tail -1 $R/logs/$TAG-att-$k.log | cut -c1-200)" ) &
sleep 5
done
wait
echo "== $TAG done $(date -u +%FT%TZ)"
|