Official make_test_spec indexes MAP_REPO_VERSION_TO_SPECS[repo][version] -- a None version KeyError'd the official scorer (first agentic run scored 0 with 'KeyError: None' hidden in details). The base converter never copied these fields; both variants now carry them, verified with a live make_test_spec call (spec + 2KB eval script + correct image key). Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.9 KiB
Python
48 lines
1.9 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 _record_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'),
|
|
'version': record.get('version'), # official MAP_REPO_VERSION_TO_SPECS key
|
|
'patch': record.get('patch'),
|
|
'hints_text': record.get('hints_text'),
|
|
'created_at': record.get('created_at'),
|
|
},
|
|
)
|
|
|
|
return to_sample
|