PingPongRealWorldRL / runtime /deployment_versions.py
KurisiTOMA's picture
chore: publish H2 real-world RL system
d8290eb verified
Raw History Blame Contribute Delete
1.73 kB
"""One selection binds the adapter, predictor and policy for real and sim runs."""
from dataclasses import dataclass
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
@dataclass(frozen=True)
class DeploymentBundle:
velocity: str
predictor: str
policy_key: str
notice_policy: str = "stage-b"
generation_trigger_tth_s: float | None = None
@property
def policy_path(self) -> Path:
return PROJECT_ROOT / self.policy_key
DEPLOYMENTS = {
"original": DeploymentBundle("original", "original", "policies/h2/h2_stageC_model_10500.onnx"),
"v1": DeploymentBundle("physics-ls-v1", "rk4-v1", "policies/h2/h2_real_v1_model_8998.onnx", "curriculum", 0.55),
"v2": DeploymentBundle("physics-ls-v2", "rk4-v2", "policies/h2/h2_tail_v2_model_9997.onnx", "curriculum", 0.55),
}
def deployment_bundle(version: str) -> DeploymentBundle:
try:
return DEPLOYMENTS[version]
except KeyError:
raise ValueError(f"unknown deployment version: {version!r}; choose original|v1|v2") from None
if __name__ == "__main__":
import argparse
import shlex
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("version", choices=DEPLOYMENTS)
args = parser.parse_args()
bundle = deployment_bundle(args.version)
# Only fixed local values are emitted; launchers evaluate these assignments.
for name, value in {
"H2_DEPLOYMENT_VERSION": args.version,
"H2_VELOCITY_VERSION": bundle.velocity,
"H2_PREDICTOR_VERSION": bundle.predictor,
"H2_POLICY_PATH": str(bundle.policy_path),
"H2_NOTICE_POLICY": bundle.notice_policy,
}.items():
print(f"{name}={shlex.quote(value)}")