File size: 1,319 Bytes
d8290eb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """Score the selected policy without changing its observations or actions."""
from dataclasses import replace
from pathlib import Path
from .rl.config import load_rl_config
from .rl.service import RLService
def start_policy_evaluation(runner, *, mocap_zmq_endpoint=None):
root = Path(__file__).resolve().parents[1]
config = load_rl_config(runner._eval_config or root / "configs/policy_eval.yaml")
if mocap_zmq_endpoint is not None:
config = replace(config, zmq_endpoint=mocap_zmq_endpoint)
policy_path = Path(runner.settings.policy_path).resolve()
print(f"[POLICY EVAL] policy={policy_path} obs={runner.policy.obs_dim} "
"recording only; no training/exploration/action changes; manual stop", flush=True)
return RLService(config, runner.contract, runner.spec, runner.robot_base_origin_world,
mode="baseline", observe_only=True, observation_dim=runner.policy.obs_dim,
project_root=root, run_dir=runner._eval_run_dir,
policy_metadata={"path": str(policy_path), "name": policy_path.name,
"version": runner.settings.deployment_version,
"reference": type(runner.reference).__name__,
"scoring_config": str(Path(runner._eval_config or root / "configs/policy_eval.yaml").resolve())})
|