Skip to content

Inference template

Terminal window
simulo create mybot --type inference

A full policy lifecycle in one self-contained app: train produces its own checkpoint, so evaluate and rollout are never stranded waiting on another app to have run first. All three are @app.jobs in the same file, sharing two volumes — one for checkpoints, one for reports.

checkpoints = simulo.Volume.from_name("mybot-checkpoints", create_if_missing=True)
reports = simulo.Volume.from_name("mybot-reports", create_if_missing=True)
app = simulo.App("mybot", mounts={"/checkpoints": checkpoints, "/reports": reports})
@app.job(system=simulo.SystemType.TIER_1, timeout=8 * 60 * 60, retries=2, callbacks=[simulo.callbacks.ResumableCheckpoint(every=50)])
def train(num_envs: int = 512, max_iterations: int = 20) -> dict:
... # saves BOTH the trainer checkpoint AND an exported TorchScript policy
@app.job(system=simulo.SystemType.TIER_1, timeout=2 * 60 * 60)
def evaluate(num_episodes: int = 10, num_rounds: int = 5) -> dict:
... # replays the checkpoint over several rounds, aggregates with numpy
@app.job(system=simulo.SystemType.TIER_1, timeout=1 * 60 * 60)
def rollout(num_steps: int = 200) -> dict:
... # plays the exported policy with simulo.RLPlayer, records an MCAP

No @app.entrypoint — with three jobs and no entrypoint, --job NAME picks which one simulo run submits, and the remaining flags map onto that job’s own parameters (see App & Jobs). Only one stage is submitted per simulo run; omit --job and it refuses, naming the three jobs rather than guessing. After a submit, simulo run names the other jobs it didn’t run in one line (e.g. “Other jobs in app.py: evaluate, rollout (submit with: simulo run app.py –job NAME)”) — a pointer to the flag, not a per-stage copy-pasteable command with its own flags filled in.

evaluate and rollout both need train’s checkpoint volume populated first — running them before train fails with a clear “checkpoint not found” error, not a silent no-op.

Terminal window
simulo run app.py --job train --num-envs 512 --max-iterations 20

Trains a PPO policy and saves two outputs to the checkpoint volume: the trainer checkpoint evaluate reads, and an exported TorchScript policy rollout plays directly (trainer-free).

Same task-authoring surface as the training template (MybotTask.build() / get_observations() / get_rewards() / get_dones() / apply_actions() / reset_idx()), plus:

  • evaluate — the metrics you aggregate and the reward target you score against (the scaffold reads it with os.environ.get(...), with a built-in default).
  • rollout — recording configuration (simulo.RecordConfig) and how many steps to play.
Terminal window
simulo logs --follow # each stage, while it runs
simulo result # each stage's own return value
simulo recordings # after rollout — downloads the MCAP