@@ -156,6 +156,20 @@ def _execute_evolved_program(self, program_text: str) -> Optional[Any]:
156156 try :
157157 print ("🔧 Executing evolved program..." )
158158
159+ # Check if program_text is actually a file path
160+ if program_text .startswith ('/' ) and '\n ' not in program_text and len (program_text ) < 500 :
161+ # This looks like a file path, read the actual content
162+ print (f"📁 Reading program from file: { program_text } " )
163+ if os .path .exists (program_text ):
164+ with open (program_text , 'r' ) as f :
165+ actual_program_text = f .read ()
166+ else :
167+ print (f"❌ Program file not found: { program_text } " )
168+ return None
169+ else :
170+ # This is the actual program text
171+ actual_program_text = program_text
172+
159173 # Create execution environment with required imports
160174 exec_globals = {
161175 '__builtins__' : __builtins__ ,
@@ -176,7 +190,7 @@ def _execute_evolved_program(self, program_text: str) -> Optional[Any]:
176190 print ("⚠️ Could not import mlx_lm, RoPE may not work" )
177191
178192 # Execute the evolved program
179- exec (program_text , exec_globals )
193+ exec (actual_program_text , exec_globals )
180194
181195 # Extract the custom attention class
182196 custom_class = exec_globals .get ('CustomGQAAttention' )
0 commit comments