File tree Expand file tree Collapse file tree 4 files changed +17
-13
lines changed Expand file tree Collapse file tree 4 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -257,18 +257,19 @@ def test(
257
257
if reference :
258
258
branch = "reference"
259
259
else :
260
- if "humaneval" not in commit0_config ["dataset_name" ].split ("/" )[- 1 ].lower ():
260
+ dataset_name = commit0_config ["dataset_name" ].lower ()
261
+ if "humaneval" in dataset_name or "mbpp" in dataset_name or "bigcodebench" in dataset_name or "codecontests" in dataset_name :
262
+ branch = repo_or_repo_path
263
+ else :
261
264
if branch is None and not reference :
262
265
git_path = os .path .join (
263
266
commit0_config ["base_dir" ], repo_or_repo_path .split ("/" )[- 1 ]
264
267
)
265
268
branch = get_active_branch (git_path )
266
- else :
267
- branch = test_ids
268
269
269
270
if stdin :
270
271
# Read test names from stdin
271
- test_ids = sys .stdin .read (). strip ()
272
+ test_ids = sys .stdin .read ()
272
273
elif test_ids is None :
273
274
typer .echo ("Error: test_ids must be provided or use --stdin option" , err = True )
274
275
raise typer .Exit (code = 1 )
Original file line number Diff line number Diff line change @@ -25,14 +25,15 @@ def main(
25
25
dataset_name , split = dataset_split
26
26
) # type: ignore
27
27
specs = []
28
- if "swe" in dataset_name .lower ():
28
+ dataset_name = dataset_name .lower ()
29
+ if "swe" in dataset_name :
29
30
dataset_type = "swebench"
30
- elif "humaneval" in dataset_name . lower () :
31
+ elif "humaneval" in dataset_name or "mbpp" in dataset_name or "bigcodebench" in dataset_name or "codecontests" in dataset_name :
31
32
dataset_type = "simple"
32
33
else :
33
34
dataset_type = "commit0"
34
35
for example in dataset :
35
- if "swe" in dataset_name . lower () or dataset_type == "simple" :
36
+ if "swe" in dataset_name or dataset_type == "simple" :
36
37
if split != "all" and split not in example ["instance_id" ]:
37
38
continue
38
39
else :
Original file line number Diff line number Diff line change @@ -51,17 +51,18 @@ def main(
51
51
dataset : Iterator [Union [RepoInstance , SimpleInstance ]] = load_dataset (
52
52
dataset_name , split = dataset_split
53
53
) # type: ignore
54
+ dataset_name = dataset_name .lower ()
54
55
spec = None
55
56
example = None
56
57
repo_name = None
57
58
dataset_type = None
58
59
for example in dataset :
59
60
if repo_or_repo_dir .endswith ("/" ):
60
61
repo_or_repo_dir = repo_or_repo_dir [:- 1 ]
61
- if "swe" in dataset_name . lower () :
62
+ if "swe" in dataset_name :
62
63
repo_name = example ["instance_id" ]
63
64
dataset_type = "swebench"
64
- elif "humaneval" in dataset_name . lower () :
65
+ elif "humaneval" in dataset_name or "mbpp" in dataset_name or "bigcodebench" in dataset_name or "codecontests" in dataset_name :
65
66
repo_name = example ["instance_id" ]
66
67
dataset_type = "simple"
67
68
else :
@@ -130,7 +131,7 @@ def main(
130
131
)
131
132
132
133
# make patch file
133
- if "swe" in dataset_name . lower () :
134
+ if "swe" in dataset_name :
134
135
if branch == "reference" :
135
136
patch = (
136
137
example ["test" ]["patch" ] + "\n \n " + example ["test" ]["test_patch" ]
@@ -164,7 +165,7 @@ def main(
164
165
+ example ["test" ]
165
166
)
166
167
else :
167
- solution = open ( test_ids ). read ()
168
+ solution = test_ids
168
169
prompt = example ["prompt" ] if "prompt" in example .keys () else ""
169
170
matches = extract_code_blocks (solution )
170
171
if len (matches ) > 0 :
Original file line number Diff line number Diff line change @@ -23,12 +23,13 @@ def main(
23
23
base_dir : str ,
24
24
) -> None :
25
25
dataset : Iterator [RepoInstance ] = load_dataset (dataset_name , split = dataset_split ) # type: ignore
26
- if "humaneval" in dataset_name .lower ():
26
+ dataset_name = dataset_name .lower ()
27
+ if "humaneval" in dataset_name or "mbpp" in dataset_name or "bigcodebench" in dataset_name or "codecontests" in dataset_name :
27
28
return
28
29
for example in dataset :
29
30
repo_name = example ["repo" ].split ("/" )[- 1 ]
30
31
clone_url = f"https://github.com/{ example ['repo' ]} .git"
31
- if "swe" in dataset_name . lower () :
32
+ if "swe" in dataset_name :
32
33
if repo_split != "all" and repo_split not in example ["instance_id" ]:
33
34
continue
34
35
clone_dir = os .path .abspath (os .path .join (base_dir , example ["instance_id" ]))
You can’t perform that action at this time.
0 commit comments