@@ -22,10 +22,11 @@ def parse_args() -> argparse.Namespace:
2222 parser .add_argument (
2323 "evaluation_file" , help = "Path to the evaluation file containing an 'evaluate' function"
2424 )
25+
2526 parser .add_argument (
26- "initial_program " ,
27- nargs = "? " ,
28- help = "Path to the initial program file " ,
27+ "initial_programs " ,
28+ nargs = "+ " ,
29+ help = "Path(s) to one or more initial program files " ,
2930 default = None ,
3031 )
3132
@@ -61,8 +62,6 @@ def parse_args() -> argparse.Namespace:
6162
6263 parser .add_argument ("--secondary-model" , help = "Secondary LLM model name" , default = None )
6364
64- parser .add_argument ("--initial-programs-dir" , help = "Path to initial programs directory" , default = None )
65-
6665 return parser .parse_args ()
6766
6867
@@ -76,39 +75,12 @@ async def main_async() -> int:
7675 args = parse_args ()
7776
7877 # Check if files exist.
79- # If args.initial_program is present, it should be a file.
80- # If args.initial_programs_dir is present, it should be a directory, and args.initial_program should be `None`.
81- if args .initial_programs_dir :
82- if args .initial_program :
83- print ("Error: Cannot specify both initial-program and --initial-programs-dir" )
84- return 1
85- if not os .path .isdir (args .initial_programs_dir ):
86- print (f"Error: Initial programs path '{ args .initial_programs_dir } ' is not a directory" )
87- return 1
88- elif args .initial_program :
89- if args .initial_programs_dir :
90- print ("Error: Cannot specify both --initial-programs-dir and initial_program" )
91- return 1
92- if not os .path .isfile (args .initial_program ):
93- print (f"Error: Initial program file '{ args .initial_program } ' is not a file" )
78+
79+ for program in args .initial_programs :
80+ if not os .path .isfile (program ):
81+ print (f"Error: Initial program file '{ program } ' does not exist" )
9482 return 1
9583
96- # Populate the initial_programs_paths vector.
97- initial_programs_paths = []
98- if args .initial_programs_dir :
99- initial_programs_paths = [
100- os .path .join (args .initial_programs_dir , f )
101- for f in os .listdir (args .initial_programs_dir )
102- if f .endswith (".py" )
103- ]
104- elif args .initial_program :
105- initial_programs_paths = [args .initial_program ]
106-
107- # Check that initial_programs_paths is not empty
108- if not initial_programs_paths :
109- print ("Error: No initial programs found. Please provide a valid initial program or directory." )
110- return 1
111-
11284 if not os .path .exists (args .evaluation_file ):
11385 print (f"Error: Evaluation file '{ args .evaluation_file } ' not found" )
11486 return 1
@@ -135,7 +107,7 @@ async def main_async() -> int:
135107 # Initialize OpenEvolve
136108 try :
137109 openevolve = OpenEvolve (
138- initial_programs_paths = initial_programs_paths ,
110+ initial_programs_paths = args . initial_programs ,
139111 evaluation_file = args .evaluation_file ,
140112 config = config ,
141113 config_path = args .config if config is None else None ,
0 commit comments