MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / explore

Function explore

trinity/cli/launcher.py:97–136  ·  view source on GitHub ↗

Run explorer.

(config: Config, *, timeout: Optional[float] = None)

Source from the content-addressed store, hash-verified

95
96
97def explore(config: Config, *, timeout: Optional[float] = None) -> StageStatus:
98 """Run explorer."""
99 from trinity.explorer.explorer import Explorer
100
101 explorer = Explorer.get_actor(config)
102 startup_started_at = time.perf_counter()
103 startup_time_sec: Optional[float] = None
104 run_started_at: Optional[float] = None
105
106 try:
107 ray.get(explorer.prepare.remote(), timeout=timeout)
108 startup_time_sec = time.perf_counter() - startup_started_at
109
110 run_started_at = time.perf_counter()
111 ray.get(explorer.sync_weight.remote(), timeout=timeout)
112 ray.get(explorer.explore.remote(), timeout=timeout)
113 execution_time_sec = time.perf_counter() - run_started_at
114 return StageStatus(
115 stage="explore",
116 success=True,
117 startup_time_sec=startup_time_sec,
118 execution_time_sec=execution_time_sec,
119 total_time_sec=time.perf_counter() - startup_started_at,
120 )
121 except Exception as exc:
122 error = _build_stage_error(exc)
123 logger.error(f"Explorer failed:\n{error.traceback_text}")
124 execution_time_sec = (
125 time.perf_counter() - run_started_at if run_started_at is not None else None
126 )
127 return StageStatus(
128 stage="explore",
129 success=False,
130 startup_time_sec=startup_time_sec,
131 execution_time_sec=execution_time_sec,
132 total_time_sec=time.perf_counter() - startup_started_at,
133 error=error,
134 )
135 finally:
136 ray.get(explorer.shutdown.remote(), timeout=timeout)
137
138
139def train(config: Config, *, timeout: Optional[float] = None) -> StageStatus:

Callers 6

run_explorer_perfFunction · 0.90
test_explorerMethod · 0.90
test_explorerMethod · 0.90
test_explorerMethod · 0.90
run_explorerFunction · 0.90
run_explorerFunction · 0.90

Calls 5

StageStatusClass · 0.85
_build_stage_errorFunction · 0.85
remoteMethod · 0.80
get_actorMethod · 0.45
getMethod · 0.45

Tested by 5

test_explorerMethod · 0.72
test_explorerMethod · 0.72
test_explorerMethod · 0.72
run_explorerFunction · 0.72
run_explorerFunction · 0.72