gaurv007 commited on
Commit
00a51e0
·
verified ·
1 Parent(s): 1bf89dc

Upload alpha_factory/run.py

Browse files
Files changed (1) hide show
  1. alpha_factory/run.py +11 -5
alpha_factory/run.py CHANGED
@@ -41,10 +41,16 @@ async def setup_models(interactive: bool = False, hf_token: str = None) -> Model
41
  return manager
42
 
43
 
44
- async def run_pipeline(config, manager: ModelManager | None = None):
45
- """Run the full pipeline under a single event loop."""
 
 
 
 
 
 
46
  # Update LLM config with Ollama URL
47
- config.llm.base_url = f"{args.ollama_url}/v1"
48
 
49
  # Create pipeline
50
  pipeline = AlphaPipeline(config)
@@ -118,7 +124,7 @@ def main():
118
  try:
119
  if args.proven:
120
  console.print(" [green]Proven template mode — no LLM model discovery needed[/]")
121
- asyncio.run(run_pipeline(config, manager=None))
122
  else:
123
  # Discover and select models, then run pipeline
124
  async def _discover_and_run():
@@ -126,7 +132,7 @@ def main():
126
  interactive=args.interactive,
127
  hf_token=hf_token,
128
  )
129
- return await run_pipeline(config, manager=manager)
130
  asyncio.run(_discover_and_run())
131
  except KeyboardInterrupt:
132
  console.print("\n[yellow]Interrupted by user[/]")
 
41
  return manager
42
 
43
 
44
+ async def run_pipeline(config, ollama_url: str = "http://localhost:11434", manager: ModelManager | None = None):
45
+ """Run the full pipeline under a single event loop.
46
+
47
+ Args:
48
+ config: Pipeline configuration
49
+ ollama_url: Base URL for Ollama (default: http://localhost:11434)
50
+ manager: Optional ModelManager for LLM mode (None for proven mode)
51
+ """
52
  # Update LLM config with Ollama URL
53
+ config.llm.base_url = f"{ollama_url}/v1"
54
 
55
  # Create pipeline
56
  pipeline = AlphaPipeline(config)
 
124
  try:
125
  if args.proven:
126
  console.print(" [green]Proven template mode — no LLM model discovery needed[/]")
127
+ asyncio.run(run_pipeline(config, ollama_url=args.ollama_url, manager=None))
128
  else:
129
  # Discover and select models, then run pipeline
130
  async def _discover_and_run():
 
132
  interactive=args.interactive,
133
  hf_token=hf_token,
134
  )
135
+ return await run_pipeline(config, ollama_url=args.ollama_url, manager=manager)
136
  asyncio.run(_discover_and_run())
137
  except KeyboardInterrupt:
138
  console.print("\n[yellow]Interrupted by user[/]")