@@ -14,23 +14,25 @@ def inspection(args):
1414 -- completion.py: prompt + completion
1515 -- execution_trace.txt: execution trace
1616 """
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" , "" ))
1818 if args .in_place :
1919 shutil .rmtree (path , ignore_errors = True )
2020 if not os .path .exists (path ):
2121 os .makedirs (path )
22- problems = get_bigcodebench ()
22+ problems = get_bigcodebench (subset = args . subset )
2323
2424 eval_results = json .load (open (args .eval_results , "r" ))
2525 for task_id , results in eval_results ["eval" ].items ():
26+ if task_id not in problems :
27+ continue
2628 if all (result ["status" ] == "pass" for result in results ):
2729 continue
2830 task_path = os .path .join (path , task_id )
2931 if not os .path .exists (task_path ):
3032 os .makedirs (task_path )
3133 task_id_data = problems [task_id ]
3234 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" ])
3436
3537 # write test
3638 with open (os .path .join (task_path , "test_case.py" ), "w" ) as f :
@@ -48,9 +50,13 @@ def inspection(args):
4850 f .write ("=" * 50 + "\n " )
4951def main ():
5052 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" )
5460 args = parser .parse_args ()
5561
5662 inspection (args )
0 commit comments