Reinforcement Learning
ml-agents
TensorBoard
ONNX
deep-reinforcement-learning
deep-rl-course
Pyramids
ML-Agents-Pyramids
Eval Results (legacy)
Instructions to use rabitrabi/ppo-Pyramids with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ml-agents
How to use rabitrabi/ppo-Pyramids with ml-agents:
mlagents-load-from-hf --repo-id="rabitrabi/ppo-Pyramids" --local-dir="./downloads"
- Notebooks
- Google Colab
- Kaggle
Publish trained Pyramids policy and 32-episode evaluation
Browse filesFiles changed (25)
- Pyramids-initial.yamlAdded+32
- Pyramids.onnx+1-1
- Pyramids.yaml+2-1
- Pyramids/Pyramids-130976.onnxAdded+3
- Pyramids/Pyramids-130976.ptAdded+3
- Pyramids/Pyramids-327634.onnxAdded+3
- Pyramids/Pyramids-327634.ptAdded+3
- Pyramids/Pyramids-393172.onnxAdded+3
- Pyramids/Pyramids-393172.ptAdded+3
- Pyramids/Pyramids-458717.onnxAdded+3
- Pyramids/Pyramids-458717.ptAdded+3
- Pyramids/Pyramids-524226.onnxAdded+3
- Pyramids/Pyramids-524226.ptAdded+3
- Pyramids/Pyramids-524354.onnxAdded+3
- Pyramids/Pyramids-524354.ptAdded+3
- Pyramids/checkpoint.pt+1-1
- Pyramids/events.out.tfevents.1796028869.rabia-LOQ-15IAX9E.3435329.0Added+3
- README.md+4-3
- config.json+5-5
- configuration.yaml+5-5
- evaluate.py+17-4
- evaluation-deterministic.jsonAdded+43
- evaluation.json+2-1
- run_logs/training_status.json+43-7
- validation.jsonAdded+181
1234567891011121314151617181920212223242526272829303132behaviors: Pyramids: trainer_type: ppo hyperparameters: batch_size: 128 buffer_size: 2048 learning_rate: 0.0003 beta: 0.01 epsilon: 0.2 lambd: 0.95 num_epoch: 3 learning_rate_schedule: linear network_settings: normalize: false hidden_units: 128 num_layers: 2 vis_encode_type: simple reward_signals: extrinsic: gamma: 0.99 strength: 1.0 rnd: gamma: 0.99 strength: 0.01 network_settings: hidden_units: 64 num_layers: 3 learning_rate: 0.0001 keep_checkpoints: 5 max_steps: 65536 time_horizon: 128 summary_freq: 40961223version https://git-lfs.github.com/spec/v1oid sha256:ba413627b4227b53be5539aee25d049d50a9c58d022c350f3a2b399309c24e5doid sha256:822127f8de9d21df40c3997370802cb895dcb17697a3b329fbb9930bd5bce9aasize 16225426 unmodified lines272829303031323326 unmodified lines num_layers: 3 learning_rate: 0.0001 keep_checkpoints: 5 max_steps: 65536 max_steps: 524288 checkpoint_interval: 65536 time_horizon: 128 summary_freq: 4096123version https://git-lfs.github.com/spec/v1oid sha256:822127f8de9d21df40c3997370802cb895dcb17697a3b329fbb9930bd5bce9aasize 162254123version https://git-lfs.github.com/spec/v1oid sha256:e4555c7ab1059a5cb426200efb378f2e85bc7bf1f7312233862e8d0c835724a3size 1120941123version https://git-lfs.github.com/spec/v1oid sha256:837a00cd8bbb7c0f16fd55e119266db5be78acc7832fbac7f97b5b52fc8714b6size 162254123version https://git-lfs.github.com/spec/v1oid sha256:b08196e780b72548fa8b1f07b553edeabf350426c4dae0a14ac42172912d182bsize 1120941123version https://git-lfs.github.com/spec/v1oid sha256:2be4fe2039e18f53fff3ee945e83e48d9241065d31db6e6e6b768dc88e5ecc38size 162254123version https://git-lfs.github.com/spec/v1oid sha256:db56af8b75feadc9958c2a6d2f1bd13b6177ed6ad14766a8fd9fef5ed1730064size 1120941123version https://git-lfs.github.com/spec/v1oid sha256:bd93dcfcb021d3c56cc8d0a5dd8af650e23f1222713fbdf46697afff931fd5e8size 162254123version https://git-lfs.github.com/spec/v1oid sha256:098437b9f68664c07b74b8d7819053de06ebf7d70d7050fe40a1618b8cd2726dsize 1120941123version https://git-lfs.github.com/spec/v1oid sha256:19f5a602edbd479419fc8235d077cabc3a7ff7c139298582784923637fdb00a4size 162254123version https://git-lfs.github.com/spec/v1oid sha256:45aa74d49c9c38725980901d934715b81b626ee87b845bb195a0a9596e962adcsize 1120941123version https://git-lfs.github.com/spec/v1oid sha256:19f5a602edbd479419fc8235d077cabc3a7ff7c139298582784923637fdb00a4size 162254123version https://git-lfs.github.com/spec/v1oid sha256:776f0907ad5729123aebe22a30b0f404562c4c103bf0b4b37a80fb224bc7f60asize 11209411223version https://git-lfs.github.com/spec/v1oid sha256:cd883b592da0ab635415bc46b03c340ba6ede5201c97db69ebb199493fc71e9coid sha256:514f2167f65f7d308d5283cb7d8c70f0893d5375fdee0b4bb73644e413a5bf56size 1120546123version https://git-lfs.github.com/spec/v1oid sha256:d0c3efe2d8a9e30b700fc630e335c17bfb0205563771104f5620ae14ffc62b8esize 43663624 unmodified lines25262728282930313232333435363738393940414224 unmodified lines
# PPO on Pyramids
This Unity ML-Agents 1.1.0 policy was trained from scratch on CPU for the Hugging Face Deep Reinforcement Learning Course with a 65,536-step budget and training seed 42.This Unity ML-Agents 1.1.0 policy was trained from scratch on CPU for the Hugging Face Deep Reinforcement Learning Course with a 524,288-step budget. The first 65,841 steps used seed 42 and the resumed run used seed 43. Four checkpoints were compared by sampled-policy mean return at validation seed 2025. The top-level ONNX file is the selected 130,976-step checkpoint.
## Evaluation
The exported ONNX policy sampled actions in a fresh Unity session with seed 2026. Across the first 32 completed episodes, the mean return was **-1.000** and the population standard deviation was **0.000**. Training used the random network distillation curiosity bonus. Evaluation measures the original environment rewards. Individual returns are in `evaluation.json`.The exported ONNX policy sampled actions in a fresh Unity session with seed 2026. Across the first 32 completed episodes, the mean return was **-1.000** and the population standard deviation was **0.000**. Training used the random network distillation curiosity bonus. Evaluation measures the original environment rewards. The sampled policy collected gold in 0 of 32 episodes. The deterministic policy collected gold in 0 of 32 episodes and scored -1.000 ± 0.000. Individual returns are in `evaluation.json`.
## Reproduce
Use Python 3.10.12, Unity ML-Agents 1.1.0, CPU PyTorch 2.2.2, ONNX 1.15.0 and ONNX Runtime 1.18.1. Download the Linux simulator linked in [course unit 5](https://huggingface.co/learn/deep-rl-course/en/unit5/hands-on).
```bashmlagents-learn Pyramids.yaml --env=/path/to/Pyramids --run-id=Pyramids --no-graphics --seed=42 --time-scale=64 --torch-device=cpumlagents-learn Pyramids-initial.yaml --env=/path/to/Pyramids --run-id=Pyramids --no-graphics --seed=42 --time-scale=64 --torch-device=cpumlagents-learn Pyramids.yaml --env=/path/to/Pyramids --run-id=Pyramids --no-graphics --resume --seed=43 --time-scale=64 --torch-device=cpupython evaluate.py Pyramids /path/to/Pyramids 6360 --seed=2026 --episodes=32```15 unmodified lines161718191920212236 unmodified lines59606162626364655 unmodified lines71727374747576777879808081828313 unmodified lines97989910010010110210315 unmodified lines "beta_schedule": "linear", "epsilon_schedule": "linear" }, "checkpoint_interval": 500000, "checkpoint_interval": 65536, "network_settings": { "normalize": false, "hidden_units": 128,36 unmodified lines "init_path": null, "keep_checkpoints": 5, "even_checkpoints": false, "max_steps": 65536, "max_steps": 524288, "time_horizon": 128, "summary_freq": 4096, "threaded": false,5 unmodified lines "env_path": "envs/Pyramids/Pyramids", "env_args": [ "-job-worker-count", "1" "2" ], "base_port": 6330, "num_envs": 1, "num_areas": 1, "timeout_wait": 60, "seed": 42, "seed": 43, "max_lifetime_restarts": 10, "restarts_rate_limit_n": 1, "restarts_rate_limit_period_s": 6013 unmodified lines "run_id": "Pyramids", "initialize_from": null, "load_model": false, "resume": false, "resume": true, "force": false, "train_model": false, "inference": false,13 unmodified lines141516171718192030 unmodified lines51525354545556573 unmodified lines616263646465666768696970717211 unmodified lines848586878788899013 unmodified lines learning_rate_schedule: linear beta_schedule: linear epsilon_schedule: linear checkpoint_interval: 500000 checkpoint_interval: 65536 network_settings: normalize: false hidden_units: 12830 unmodified lines init_path: null keep_checkpoints: 5 even_checkpoints: false max_steps: 65536 max_steps: 524288 time_horizon: 128 summary_freq: 4096 threaded: false3 unmodified lines env_path: envs/Pyramids/Pyramids env_args: - -job-worker-count - '1' - '2' base_port: 6330 num_envs: 1 num_areas: 1 timeout_wait: 60 seed: 42 seed: 43 max_lifetime_restarts: 10 restarts_rate_limit_n: 1 restarts_rate_limit_period_s: 6011 unmodified lines run_id: Pyramids initialize_from: null load_model: false resume: false resume: true force: false train_model: false inference: false10 unmodified lines111213141415161712 unmodified lines30313233343536378 unmodified lines464748495051525354555657585918 unmodified lines78798081828377848586873 unmodified lines91929387949596979899100101102931031041051061 unmodified line10810911011111211311411511610 unmodified linesfrom mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
def policy_actions(session, decisions, spec):def policy_actions(session, decisions, spec, deterministic=False): batch = len(decisions) inputs = {} for inp in session.get_inputs():12 unmodified lines ("continuous_actions", actions.add_continuous), ("discrete_actions", actions.add_discrete), ): if deterministic: name = "deterministic_" + name if name in {out.name for out in session.get_outputs()}: setter(session.run([name], inputs)[0]) return actions8 unmodified lines opts.intra_op_num_threads = 1 opts.inter_op_num_threads = 1 model_path = Path("results") / args.name / (args.name + ".onnx") if args.model_path: model_path = Path(args.model_path) if not model_path.exists(): model_path = Path(__file__).resolve().parent / (args.name + ".onnx") session = ort.InferenceSession(str(model_path), opts, providers=["CPUExecutionProvider"]) totals = defaultdict(float) returns = [] gold = [] soccer = args.name == "SoccerTwos" env = UnityEnvironment(file_name=args.env, seed=args.seed, base_port=args.port, no_graphics=True, side_channels=[engine],18 unmodified lines totals[uid] += float(reward) if ended: returns.append(totals.pop(uid)) if args.name == 'Pyramids': gold.append(bool(not steps.interrupted[row] and reward > 0)) if len(decisions): env.set_actions(behavior, policy_actions(session, decisions, spec.action_spec)) env.set_actions(behavior, policy_actions(session, decisions, spec.action_spec, args.deterministic)) if len(returns) >= args.episodes: break env.step()3 unmodified lines env.close() returns = returns[:args.episodes] report = dict(environment=args.name, seed=args.seed, episodes=len(returns), stochastic_policy=True, mean=float(np.mean(returns)), stochastic_policy=not args.deterministic, mean=float(np.mean(returns)), std=float(np.std(returns)), returns=returns) if gold: report['gold_pickups'] = sum(gold[:args.episodes]) if soccer: report.update(opponent="uniform random actions", evaluated_team=0, metric="per-match shared team return") print(json.dumps(report)) output_path = Path(args.output) if args.output else model_path.parent / "evaluation.json" (model_path.parent / "evaluation.json").write_text(json.dumps(report, indent=2) + "\n") output_path.write_text(json.dumps(report, indent=2) + "\n")
if __name__ == "__main__":1 unmodified line parser.add_argument("name") parser.add_argument("env") parser.add_argument("port", type=int) parser.add_argument("--model-path") parser.add_argument("--output") parser.add_argument("--deterministic", action="store_true") parser.add_argument("--episodes", type=int, default=32) parser.add_argument("--seed", type=int, default=2026) evaluate(parser.parse_args())12345678910111213141516171819202122232425262728293031323334353637383940414243{ "environment": "Pyramids", "seed": 2026, "episodes": 32, "stochastic_policy": false, "mean": -0.9999999310821295, "std": 0.0, "returns": [ -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ], "gold_pickups": 0}37 unmodified lines3839404141424337 unmodified lines -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ] ], "gold_pickups": 0}1 unmodified line234565678891010111213141516171819202122232425262728293031323334353637383940414243444546474849501551525318545520565758591 unmodified line "Pyramids": { "checkpoints": [ { "steps": 65841, "file_path": "results/Pyramids/Pyramids/Pyramids-65841.onnx", "steps": 327634, "file_path": "results/Pyramids/Pyramids/Pyramids-327634.onnx", "reward": null, "creation_time": 1796028760.570879, "creation_time": 1796029194.9683628, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-65841.pt" "results/Pyramids/Pyramids/Pyramids-327634.pt" ] }, { "steps": 393172, "file_path": "results/Pyramids/Pyramids/Pyramids-393172.onnx", "reward": -0.9996000528335571, "creation_time": 1796029274.6643064, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-393172.pt" ] }, { "steps": 458717, "file_path": "results/Pyramids/Pyramids/Pyramids-458717.onnx", "reward": -0.09466671943664551, "creation_time": 1796029351.182556, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-458717.pt" ] }, { "steps": 524226, "file_path": "results/Pyramids/Pyramids/Pyramids-524226.onnx", "reward": null, "creation_time": 1796029439.7382226, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-524226.pt" ] }, { "steps": 524354, "file_path": "results/Pyramids/Pyramids/Pyramids-524354.onnx", "reward": null, "creation_time": 1796029439.7698808, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-524354.pt" ] } ], "final_checkpoint": { "steps": 65841, "steps": 524354, "file_path": "results/Pyramids/Pyramids.onnx", "reward": null, "creation_time": 1796028760.570879, "creation_time": 1796029439.7698808, "auxillary_file_paths": [ "results/Pyramids/Pyramids/Pyramids-65841.pt" "results/Pyramids/Pyramids/Pyramids-524354.pt" ] } },123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181{ "selected_training_step": 130976, "measurements": [ { "training_step": 130976, "environment": "Pyramids", "seed": 2025, "episodes": 32, "stochastic_policy": true, "mean": -0.5317186875149673, "std": 0.9766286976487613, "returns": [ 1.7570000167470425, 1.5460000312887132, 1.3870000422466546, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999311257852, -0.9999999311257852, 1.544000031426549, -0.9999999311257852, 1.3800000427290797, 1.3710000433493406, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ], "gold_pickups": 6 }, { "training_step": 262141, "environment": "Pyramids", "seed": 2025, "episodes": 32, "stochastic_policy": true, "mean": -0.9363124311639694, "std": 0.3545969924020713, "returns": [ -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, 1.0380000662989914, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ], "gold_pickups": 1 }, { "training_step": 393172, "environment": "Pyramids", "seed": 2025, "episodes": 32, "stochastic_policy": true, "mean": -0.7994061819872513, "std": 0.6242568983292798, "returns": [ 1.2080000545829535, 1.0150000678841025, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999311257852, 1.196000055409968, -0.9999999311257852, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ], "gold_pickups": 3 }, { "training_step": 524354, "environment": "Pyramids", "seed": 2025, "episodes": 32, "stochastic_policy": true, "mean": -0.7975311821137439, "std": 0.6298706672175708, "returns": [ -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, 1.2520000515505672, 1.1460000588558614, 1.081000063335523, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295, -0.9999999310821295 ], "gold_pickups": 3 } ]}Pyramids-initial.yamlAdded+32
Pyramids.onnx+1-1
Pyramids.yaml+2-1
Pyramids/Pyramids-130976.onnxAdded+3
Pyramids/Pyramids-130976.ptAdded+3
Pyramids/Pyramids-327634.onnxAdded+3
Pyramids/Pyramids-327634.ptAdded+3
Pyramids/Pyramids-393172.onnxAdded+3
Pyramids/Pyramids-393172.ptAdded+3
Pyramids/Pyramids-458717.onnxAdded+3
Pyramids/Pyramids-458717.ptAdded+3
Pyramids/Pyramids-524226.onnxAdded+3
Pyramids/Pyramids-524226.ptAdded+3
Pyramids/Pyramids-524354.onnxAdded+3
Pyramids/Pyramids-524354.ptAdded+3
Pyramids/checkpoint.pt+1-1
Pyramids/events.out.tfevents.1796028869.rabia-LOQ-15IAX9E.3435329.0Added+3
README.md+4-3
config.json+5-5
configuration.yaml+5-5
evaluate.py+17-4
evaluation-deterministic.jsonAdded+43
evaluation.json+2-1
run_logs/training_status.json+43-7
validation.jsonAdded+181