39 lines
1.5 KiB
Python
39 lines
1.5 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',
|
|
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']
|
|
return Sample(
|
|
input=record['problem_statement'],
|
|
target=record['patch'], # gold patch (for oracle/oracle-check only)
|
|
sandbox=SandboxSpec(image=f'sweb.eval.x86_64.{instance_id}'), # official image naming
|
|
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
|