@@ -14,23 +14,25 @@ def inspection(args):
14
14
-- completion.py: prompt + completion
15
15
-- execution_trace.txt: execution trace
16
16
"""
17
- path = os .path .join ("inspect" , args .eval_results .split ("/" )[- 1 ].replace (".json" , "" ))
17
+ path = os .path .join (args . save_path , args .eval_results .split ("/" )[- 1 ].replace (".json" , "" ))
18
18
if args .in_place :
19
19
shutil .rmtree (path , ignore_errors = True )
20
20
if not os .path .exists (path ):
21
21
os .makedirs (path )
22
- problems = get_bigcodebench ()
22
+ problems = get_bigcodebench (subset = args . subset )
23
23
24
24
eval_results = json .load (open (args .eval_results , "r" ))
25
25
for task_id , results in eval_results ["eval" ].items ():
26
+ if task_id not in problems :
27
+ continue
26
28
if all (result ["status" ] == "pass" for result in results ):
27
29
continue
28
30
task_path = os .path .join (path , task_id )
29
31
if not os .path .exists (task_path ):
30
32
os .makedirs (task_path )
31
33
task_id_data = problems [task_id ]
32
34
with open (os .path .join (task_path , "ground_truth.py" ), "w" ) as f :
33
- f .write (task_id_data [f"{ args .subset } _prompt" ] + "\n \n " + task_id_data ["canonical_solution" ])
35
+ f .write (task_id_data [f"{ args .split } _prompt" ] + "\n \n " + task_id_data ["canonical_solution" ])
34
36
35
37
# write test
36
38
with open (os .path .join (task_path , "test_case.py" ), "w" ) as f :
@@ -48,9 +50,13 @@ def inspection(args):
48
50
f .write ("=" * 50 + "\n " )
49
51
def main ():
50
52
parser = argparse .ArgumentParser ()
51
- parser .add_argument ("--eval-results" , required = True , type = str )
52
- parser .add_argument ("--subset" , required = True , type = str )
53
- parser .add_argument ("--in-place" , action = "store_true" )
53
+ parser .add_argument ("--eval_results" , required = True , type = str )
54
+ parser .add_argument (
55
+ "--split" , required = True , type = str , choices = ["complete" , "instruct" ]
56
+ )
57
+ parser .add_argument ("--subset" , default = "hard" , type = str , choices = ["full" , "hard" ])
58
+ parser .add_argument ("--save_path" , default = "inspect" , type = str )
59
+ parser .add_argument ("--in_place" , action = "store_true" )
54
60
args = parser .parse_args ()
55
61
56
62
inspection (args )
0 commit comments