Training template
simulo create mybot --type training # --type training is the defaultThe simplest starter: one job that trains a PPO policy to balance a pole on a cart, and saves the trained checkpoint to a durable volume.
cartpole = simulo.Asset.from_registry("simulo/robot/cartpole:v1")
vol = simulo.Volume.from_name("mybot-checkpoints", create_if_missing=True)
app = simulo.App("mybot", mounts={"/out": vol}) # runs on the default Simulo runtime
with app.runtime.imports(): import torch # resolved only on the worker, never at submit
class MybotTask(simulo.Task): ... # build(), get_observations(), get_rewards(), get_dones(), apply_actions(), reset_idx()
@app.job( system=simulo.SystemType.TIER_1, timeout=8 * 60 * 60, retries=2, callbacks=[simulo.callbacks.ResumableCheckpoint(every=50)],)def train(num_envs: int = 4096, max_iterations: int = 200) -> dict: env = simulo.LearningEnv(task=MybotTask(), num_envs=num_envs, device="cuda", ...) trainer = simulo.RLTrainer(env=env, algorithm="PPO", device="cuda", seed=42) stats = trainer.train(max_iterations=max_iterations) trainer.save(f"{vol.path}/mybot_final.pt") ... return {"checkpoint": ..., "num_envs": num_envs, **stats}No @app.entrypoint — train is the app’s only job, so simulo run maps
--num-envs/--max-iterations straight onto its own parameters.
Where to edit
Section titled “Where to edit”MybotTask—build()constructs the scene (swap the pinned global cartpole ref for your own published asset; see Bring your own robot).get_observations()/get_rewards()/get_dones()/apply_actions()/reset_idx()are your task’s actual learning logic — observation vector, reward shaping, termination condition, and how actions map onto the robot’s joints.train— training hyperparameters (num_envs,max_iterations), resources (system=,timeout=), and what the job returns. Its parameters are the app’s CLI flags —simulo run app.py --helpalways reflects this function’s current signature.
retries=2 plus ResumableCheckpoint(every=50) mean a retried or preempted
run resumes from its latest checkpoint instead of restarting — see
Continue or resume for exactly what that
callback declares and how it differs from simulo run --from.
Run it
Section titled “Run it”simulo run app.py --num-envs 4096 --max-iterations 200--num-envs and --max-iterations are this app’s flags, mapped straight
onto train’s own parameters (no @app.entrypoint needed) — not flags
simulo run itself defines. See Run &
submit for the full distinction.
simulo logs --follow # watch it trainsimulo result # best_reward, checkpoint, iterationssimulo models # best.pt / latest.pt, ready to download