-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
43 lines (36 loc) · 1.21 KB
/
Copy pathrun.py
File metadata and controls
43 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import asyncio
import os
import traceback
# Try importing OpenEvolve first to verify it exists
try:
from openevolve import OpenEvolve
except ImportError:
print("CRITICAL: 'openevolve' package not found.")
print("Please run: pip install openevolve")
exit(1)
async def main():
# Ensure files exist before running
required_files = ["initial_program.py", "evaluator.py", "config.yaml"]
for f in required_files:
if not os.path.exists(f):
print(f"Error: {f} not found in current directory.")
return
print("Initializing OpenEvolve...")
try:
evolve = OpenEvolve(
initial_program_path="initial_program.py",
evaluation_file="evaluator.py",
config_path="config.yaml"
)
print("Starting evolution loop...")
best_program = await evolve.run()
print("\nEvolution Complete.")
print("Best program found:")
print(best_program)
except Exception as e:
print(f"\nRuntime Error detected!")
print(f"Details: {str(e)}")
# Print full traceback for debugging imports
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(main())