Download eval/run_agent.sh from RightNowAI/RightNow-Mini: direct link, hf CLI and curl.
- Browser
- Download file 2.99 kB
-
https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/eval/run_agent.sh
- Command line
-
hf download hf://RightNowAI/RightNow-Mini/eval/run_agent.sh
-
curl -L -o run_agent.sh https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/eval/run_agent.sh
2.99 kB
| # One pass of the bash-only agent (mini-swe-agent, its own swebench.yaml) over the evaluation subset. | |
| # LABEL=stock-1 URL=http://127.0.0.1:9006/v1 MODEL=hosted_vllm/inkling-2-mini bash eval/run_agent.sh | |
| # LABEL=opus55-1 RELAY=1 WORKERS=8 bash eval/run_agent.sh # the comparison model, through the laptop relay | |
| # Output: /data/train/mini/results/agent/$LABEL/{preds.json, <instance>/<instance>.traj.json, run.log} | |
| set -u | |
| R=/data/train/mini | |
| LABEL=${LABEL:?give LABEL}; URL=${URL:-http://127.0.0.1:9006/v1}; MODEL=${MODEL:-hosted_vllm/inkling-2-mini} | |
| WORKERS=${WORKERS:-32}; TEMP=${TEMP:-0}; MAXTOK=${MAXTOK:-16384}; STEPS=${STEPS:-250}; RELAY=${RELAY:-0} | |
| SUBSET=${SUBSET:-$R/src/eval/subset.json}; DATA=${DATA:-verified}; SPLIT=${SPLIT:-test} | |
| export PATH=$R/bin:$R/venv/bin:$PATH MSWEA_DOCKER_EXECUTABLE=$R/bin/docker HF_HOME=$R/hf PYTHONPATH=$R/src/eval | |
| OUT=${OUT:-$R/results/agent/$LABEL}; mkdir -p "$OUT" | |
| FILTER=$(python - "$SUBSET" <<'EOF' | |
| import json, re, sys | |
| print("^(" + "|".join(re.escape(i) for i in json.load(open(sys.argv[1]))["instance_ids"]) + ")$") | |
| EOF | |
| ) | |
| if [ "$RELAY" = 1 ]; then | |
| MODEL_ARGS=(--model-class relay_model.RelayOpenRouterModel -m anthropic/claude-opus-5.5 | |
| -c model.set_cache_control=default_end -c model.model_kwargs.max_tokens="$MAXTOK" | |
| -c agent.cost_limit="${COST_LIMIT:-2.5}") | |
| else | |
| export MSWEA_COST_TRACKING=ignore_errors | |
| MODEL_ARGS=(-m "$MODEL" -c model.model_kwargs.api_base="$URL" -c model.model_kwargs.api_key=EMPTY | |
| -c model.model_kwargs.temperature="$TEMP" -c model.model_kwargs.max_tokens="$MAXTOK" -c agent.cost_limit=0) | |
| fi | |
| echo "== $LABEL start $(date -u +%FT%TZ) workers=$WORKERS temp=$TEMP steps=$STEPS maxtok=$MAXTOK relay=$RELAY" | tee -a "$OUT/meta.txt" | |
| # STARTUP: a command run in the task's container before the agent starts, with the instance's fields as {{ names }}. | |
| # SWE-smith needs one: a task is a branch of the repository inside the image, so it must be checked out first. | |
| STARTUP_ARGS=() | |
| [ -n "${STARTUP:-}" ] && STARTUP_ARGS=(-c "run.env_startup_command=$STARTUP") | |
| # shellcheck disable=SC2086 | |
| mini-extra swebench --subset "$DATA" --split "$SPLIT" --filter "$FILTER" -o "$OUT" -w "$WORKERS" \ | |
| -c swebench.yaml -c agent.step_limit="$STEPS" "${MODEL_ARGS[@]}" "${STARTUP_ARGS[@]}" ${EXTRA_ARGS:-} > "$OUT/run.log" 2>&1 | |
| echo "== $LABEL agent done $(date -u +%FT%TZ) exit=$?" | tee -a "$OUT/meta.txt" | |
| python - "$OUT" <<'EOF' | |
| import json, sys, glob, collections | |
| out = sys.argv[1] | |
| try: | |
| p = json.load(open(out + "/preds.json")) | |
| except Exception as e: | |
| print("no preds.json:", e); sys.exit() | |
| st = collections.Counter() | |
| for f in glob.glob(out + "/*/*.traj.json"): | |
| try: | |
| st[json.load(open(f)).get("info", {}).get("exit_status")] += 1 | |
| except Exception: | |
| st["unreadable"] += 1 | |
| print("predictions:", len(p), "with a patch:", sum(1 for v in p.values() if (v.get("model_patch") or "").strip()), "exit statuses:", dict(st)) | |
| EOF | |