EvalHarness/evalharness/data/datasets/swe_bench_verified.py
sora 587274d8b6 sandbox pull: SWE-bench per-instance pre-pull with resume (es port)
- naming corrected to the Docker Hub truth es verified 500/500:
  swebench/sweb.eval.x86_64.{instance_id.lower(), __->_1776_}:latest
  (my repo-base rewrite was wrong; per-instance images ARE published)
- 'evalharness sandbox pull swe_bench_verified': concurrent pulls,
  resume state in <cache-dir>/swe_pull_state.json, --dry-run N,
  --retry-failed; self-contained (own dataset registry, no evalscope
  import)
- save/load intentionally omitted per user call (pull-only for now)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-17 09:36:20 +00:00

45 lines
1.8 KiB
Python

"""SWE-bench Verified (official source: princeton-nlp/SWE-bench_Verified)."""
from ..sample import Sample, SandboxSpec
from ..registry import register_dataset
from ..spec import DatasetSpec
@register_dataset(
DatasetSpec(
name='swe_bench_verified',
source='princeton-nlp/SWE-bench_Verified', # official: https://huggingface.co/datasets/princeton-nlp/SWE-bench_Verified
split='test',
gen_config={'temperature': 0.0, 'max_tokens': 32768},
task_type='agent',
tags=['code', 'agent', 'swe'],
requires=['docker'],
description='SWE-bench Verified; per-instance docker image carried in Sample.sandbox.',
)
)
def swe_bench_verified():
def to_sample(record: dict) -> Sample:
instance_id = record['instance_id']
# EXACT Docker Hub naming (verified by es's pull state: 500/500):
# swebench/sweb.eval.x86_64.{instance_id.lower() with __->_1776_}:latest
# -- per-instance images ARE published under the swebench/ namespace
img = ('swebench/sweb.eval.x86_64.'
+ instance_id.lower().replace('__', '_1776_') + ':latest')
return Sample(
input=record['problem_statement'],
target=record['patch'], # gold patch (for oracle/oracle-check only)
sandbox=SandboxSpec(image=img),
metadata={
'instance_id': instance_id,
'repo': record['repo'],
'base_commit': record['base_commit'],
'test_patch': record['test_patch'],
'FAIL_TO_PASS': record['FAIL_TO_PASS'],
'PASS_TO_PASS': record['PASS_TO_PASS'],
'environment_setup_commit': record.get('environment_setup_commit'),
'difficulty': record.get('difficulty'),
},
)
return to_sample