TrackmaniaRL 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- trackmaniarl-1.0.0/CHANGELOG.md +27 -0
- trackmaniarl-1.0.0/LICENSE +21 -0
- trackmaniarl-1.0.0/MANIFEST.in +7 -0
- trackmaniarl-1.0.0/NOTICE +8 -0
- trackmaniarl-1.0.0/PKG-INFO +213 -0
- trackmaniarl-1.0.0/README.md +156 -0
- trackmaniarl-1.0.0/SECURITY.md +10 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/PKG-INFO +213 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/SOURCES.txt +112 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/dependency_links.txt +1 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/entry_points.txt +2 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/requires.txt +41 -0
- trackmaniarl-1.0.0/TrackmaniaRL.egg-info/top_level.txt +1 -0
- trackmaniarl-1.0.0/pyproject.toml +215 -0
- trackmaniarl-1.0.0/readme/sdk.md +75 -0
- trackmaniarl-1.0.0/readme/trackmania.md +76 -0
- trackmaniarl-1.0.0/setup.cfg +4 -0
- trackmaniarl-1.0.0/tests/test_algorithms.py +248 -0
- trackmaniarl-1.0.0/tests/test_behavior_cloning.py +517 -0
- trackmaniarl-1.0.0/tests/test_cli_benchmark.py +583 -0
- trackmaniarl-1.0.0/tests/test_core_runtime.py +307 -0
- trackmaniarl-1.0.0/tests/test_demonstrations.py +618 -0
- trackmaniarl-1.0.0/tests/test_discrete_actions.py +39 -0
- trackmaniarl-1.0.0/tests/test_distributed_runtime.py +1822 -0
- trackmaniarl-1.0.0/tests/test_experiment_analysis_scripts.py +128 -0
- trackmaniarl-1.0.0/tests/test_experiments.py +65 -0
- trackmaniarl-1.0.0/tests/test_iqn_lidar_release.py +1247 -0
- trackmaniarl-1.0.0/tests/test_keyboard_control.py +48 -0
- trackmaniarl-1.0.0/tests/test_n_step_replay.py +119 -0
- trackmaniarl-1.0.0/tests/test_observation_collator.py +96 -0
- trackmaniarl-1.0.0/tests/test_release_runtime.py +1575 -0
- trackmaniarl-1.0.0/tests/test_replay_samplers.py +461 -0
- trackmaniarl-1.0.0/tests/test_review_fixes.py +100 -0
- trackmaniarl-1.0.0/tests/test_run_spec_serialization.py +24 -0
- trackmaniarl-1.0.0/tests/test_sequence_training.py +589 -0
- trackmaniarl-1.0.0/tests/test_synthetic_recovery.py +146 -0
- trackmaniarl-1.0.0/tests/test_torch_execution.py +151 -0
- trackmaniarl-1.0.0/tests/test_trackmania_collector.py +61 -0
- trackmaniarl-1.0.0/tests/test_trackmania_pace.py +50 -0
- trackmaniarl-1.0.0/tests/test_trajectory_guidance.py +417 -0
- trackmaniarl-1.0.0/tests/test_trajectory_optimization.py +200 -0
- trackmaniarl-1.0.0/tests/test_trajectory_stitching.py +130 -0
- trackmaniarl-1.0.0/trackmaniarl/__init__.py +12 -0
- trackmaniarl-1.0.0/trackmaniarl/__main__.py +6 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/__init__.py +18 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/_torch.py +323 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/execution.py +204 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/implicit_quantile_q_learning.py +1321 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/randomized_ensemble_sac.py +155 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/soft_actor_critic.py +173 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/stable_discrete_soft_actor_critic.py +221 -0
- trackmaniarl-1.0.0/trackmaniarl/algorithms/truncated_quantile_critic.py +207 -0
- trackmaniarl-1.0.0/trackmaniarl/builtins/__init__.py +12 -0
- trackmaniarl-1.0.0/trackmaniarl/builtins/algorithms.py +33 -0
- trackmaniarl-1.0.0/trackmaniarl/builtins/features.py +180 -0
- trackmaniarl-1.0.0/trackmaniarl/builtins/replay.py +34 -0
- trackmaniarl-1.0.0/trackmaniarl/cli.py +2092 -0
- trackmaniarl-1.0.0/trackmaniarl/core/__init__.py +86 -0
- trackmaniarl-1.0.0/trackmaniarl/core/builtins.py +197 -0
- trackmaniarl-1.0.0/trackmaniarl/core/contracts.py +130 -0
- trackmaniarl-1.0.0/trackmaniarl/core/data.py +129 -0
- trackmaniarl-1.0.0/trackmaniarl/core/pytree.py +94 -0
- trackmaniarl-1.0.0/trackmaniarl/core/replay.py +1927 -0
- trackmaniarl-1.0.0/trackmaniarl/core/runtime.py +241 -0
- trackmaniarl-1.0.0/trackmaniarl/core/spec.py +238 -0
- trackmaniarl-1.0.0/trackmaniarl/core/training.py +319 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/__init__.py +6 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/actor.py +983 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/codec.py +106 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/coordinator.py +1320 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/journal.py +129 -0
- trackmaniarl-1.0.0/trackmaniarl/distributed/protocol.py +160 -0
- trackmaniarl-1.0.0/trackmaniarl/experiments/__init__.py +6 -0
- trackmaniarl-1.0.0/trackmaniarl/experiments/evaluation.py +75 -0
- trackmaniarl-1.0.0/trackmaniarl/experiments/orchestration.py +226 -0
- trackmaniarl-1.0.0/trackmaniarl/models/__init__.py +15 -0
- trackmaniarl-1.0.0/trackmaniarl/models/actors/__init__.py +6 -0
- trackmaniarl-1.0.0/trackmaniarl/models/actors/continuous.py +43 -0
- trackmaniarl-1.0.0/trackmaniarl/models/actors/discrete.py +38 -0
- trackmaniarl-1.0.0/trackmaniarl/models/critics/__init__.py +9 -0
- trackmaniarl-1.0.0/trackmaniarl/models/critics/value.py +138 -0
- trackmaniarl-1.0.0/trackmaniarl/models/encoders/__init__.py +9 -0
- trackmaniarl-1.0.0/trackmaniarl/models/encoders/track_geometry.py +238 -0
- trackmaniarl-1.0.0/trackmaniarl/observability/__init__.py +6 -0
- trackmaniarl-1.0.0/trackmaniarl/observability/artifacts.py +203 -0
- trackmaniarl-1.0.0/trackmaniarl/observability/attribution.py +17 -0
- trackmaniarl-1.0.0/trackmaniarl/observability/trackers.py +165 -0
- trackmaniarl-1.0.0/trackmaniarl/project/__init__.py +5 -0
- trackmaniarl-1.0.0/trackmaniarl/project/openplanet/TrackmaniaRL_GrabData_IQN.as +158 -0
- trackmaniarl-1.0.0/trackmaniarl/project/openplanet/info.toml +8 -0
- trackmaniarl-1.0.0/trackmaniarl/project/scaffold.py +371 -0
- trackmaniarl-1.0.0/trackmaniarl/py.typed +0 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/__init__.py +37 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/actions.py +154 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/assets.py +121 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/baseline.py +54 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/behavior_cloning.py +1133 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/collector.py +100 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/control.py +371 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/demonstrations.py +615 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/diagnostics.py +264 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/environment.py +429 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/evaluation.py +232 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/features.py +648 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/geometry.py +361 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/guidance.py +676 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/iqn.py +401 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/pace.py +140 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/reward.py +557 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/session.py +79 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/synthetic_recovery.py +297 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/telemetry.py +160 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/trajectory_optimization.py +430 -0
- trackmaniarl-1.0.0/trackmaniarl/trackmania/trajectory_stitching.py +350 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 - 2026-08-18
|
|
4
|
+
|
|
5
|
+
- Renamed the distribution, Python package and CLI to TrackmaniaRL / `trackmaniarl`.
|
|
6
|
+
- Added attribution, trademark disclaimer and a security reporting policy.
|
|
7
|
+
- Made the generated Trackmania project valid TOML, W&B-free by default, and benchmark-ready.
|
|
8
|
+
- Validated actions through each learner policy and made discrete SAC emit Python action indices.
|
|
9
|
+
- Removed automatic unsafe checkpoint unpickling and added wheel-level CI verification.
|
|
10
|
+
|
|
11
|
+
- Recurrent IQN training now updates every post-burn-in timestep in a sequence (R2D2-style) instead of only the final step, and sequence priorities use a mixed max/mean TD error.
|
|
12
|
+
- Added optional R2D2 value rescaling and a DQfD-style demonstration margin loss to `ImplicitQuantileQLearning`; demonstration transitions are protected from FIFO eviction.
|
|
13
|
+
- Progress rewards bound per-step index advance to a physically reachable arc length, preventing hairpin cuts through folded reference lines.
|
|
14
|
+
- Lidar features keep the last valid horizontal heading through vertical moments instead of aborting the actor.
|
|
15
|
+
- Distributed run safety: journal pruning after checkpoints, refusal to silently re-ingest stale journals on fresh starts, bounded coordinator rollout queue with backpressure, actor threads that stop the process on unexpected failure, telemetry stalls that truncate episodes instead of killing the run, spool-cap pause instead of crash, thread-safe JSONL logging, safer checkpoint loading (`weights_only`), and resume-friendly manifests.
|
|
16
|
+
- `trackmaniarl benchmark` is config-driven via `evaluation.target_median_s` / `min_finish_rate` instead of a hardcoded `trackmaniarl-test` release gate.
|
|
17
|
+
- Packaging: `setuptools>=77` for SPDX licenses, OS classifiers, stricter mypy import overrides, Windows CI, and broader `.gitignore` coverage for sqlite/event leftovers.
|
|
18
|
+
|
|
19
|
+
- `trackmaniarl track record-demo` now records a whole session: `--count` laps in one go, discards outliers slower than the best finish by more than `--max-gap` seconds (default 1s), saves the rest into the output directory at the end, and mid-lap restarts discard only the partial lap instead of failing the recording.
|
|
20
|
+
- Lidar telemetry now scales velocity and speed by the configured `velocity_to_mps_scale / max_speed_mps` instead of a hardcoded 1/1000, so those observation channels carry usable signal; retrain checkpoints that relied on the previous scaling.
|
|
21
|
+
- Prioritized sequence sampling builds full n-step returns only for the timestep the learner bootstraps from, cutting redundant replay work for recurrent batches.
|
|
22
|
+
|
|
23
|
+
- Coordinator ingests the entire rollout backlog every learner iteration, removing the standing queue that trained on minutes-old transitions and inflated the reported policy lag.
|
|
24
|
+
- The distributed actor freezes one policy snapshot per training episode, so episode metrics measure a single policy version instead of a refresh mixture.
|
|
25
|
+
- IQN policies report the greedy action gap; episode and evaluation summaries log `q_margin/mean`, `q_margin/min` and `q_margin/start_mean`.
|
|
26
|
+
- Evaluation batches aggregate into `eval/summary`, and strictly better batches write an immediate best-eval checkpoint (`eval/best_checkpoint`).
|
|
27
|
+
- Replay checkpoints can restore into a larger configured capacity, enabling resume-with-bigger-buffer experiments; see `docs/v27-deterministic-stability.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Edouard Geze and Yann Bouteiller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
TrackmaniaRL is an independent project maintained by Jakub Szulc.
|
|
2
|
+
|
|
3
|
+
This repository originated from TMRL, copyright (c) 2021 Edouard Geze and
|
|
4
|
+
Yann Bouteiller, and includes code derived from that project. The applicable
|
|
5
|
+
MIT license and copyright notice are retained in LICENSE.
|
|
6
|
+
|
|
7
|
+
TrackmaniaRL is not affiliated with, endorsed by, or sponsored by Ubisoft,
|
|
8
|
+
Nadeo, or the TMRL maintainers. Trackmania is a trademark of Nadeo/Ubisoft.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TrackmaniaRL
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Reinforcement-learning library for training agents in Trackmania 2020
|
|
5
|
+
Author: Jakub Szulc
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Palamabron/AITrackmania
|
|
8
|
+
Project-URL: Repository, https://github.com/Palamabron/AITrackmania
|
|
9
|
+
Project-URL: Changelog, https://github.com/Palamabron/AITrackmania/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: reinforcement learning,robot learning,trackmania,self driving,roborace
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Games/Entertainment
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: pydantic>=2.0
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: torch>=2.4
|
|
29
|
+
Requires-Dist: tensordict>=0.6
|
|
30
|
+
Requires-Dist: gymnasium>=0.29
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Provides-Extra: orchestrator
|
|
33
|
+
Requires-Dist: google-genai>=2.2.0; extra == "orchestrator"
|
|
34
|
+
Requires-Dist: optuna>=3.0; extra == "orchestrator"
|
|
35
|
+
Provides-Extra: algorithms
|
|
36
|
+
Requires-Dist: einops>=0.7; extra == "algorithms"
|
|
37
|
+
Requires-Dist: gymnasium>=0.29; extra == "algorithms"
|
|
38
|
+
Requires-Dist: loguru>=0.7; extra == "algorithms"
|
|
39
|
+
Requires-Dist: pandas>=2.0; extra == "algorithms"
|
|
40
|
+
Requires-Dist: torchrl>=0.11; extra == "algorithms"
|
|
41
|
+
Provides-Extra: trackmania
|
|
42
|
+
Requires-Dist: gymnasium>=0.29; extra == "trackmania"
|
|
43
|
+
Requires-Dist: vgamepad>=0.1.0; sys_platform == "win32" and extra == "trackmania"
|
|
44
|
+
Provides-Extra: wandb
|
|
45
|
+
Requires-Dist: wandb>=0.15.8; extra == "wandb"
|
|
46
|
+
Provides-Extra: distributed
|
|
47
|
+
Requires-Dist: grpcio>=1.66; extra == "distributed"
|
|
48
|
+
Requires-Dist: protobuf>=5.27; extra == "distributed"
|
|
49
|
+
Requires-Dist: safetensors>=0.4.5; extra == "distributed"
|
|
50
|
+
Requires-Dist: zstandard>=0.23; extra == "distributed"
|
|
51
|
+
Requires-Dist: vgamepad>=0.1.0; sys_platform == "win32" and extra == "distributed"
|
|
52
|
+
Provides-Extra: explain
|
|
53
|
+
Requires-Dist: captum>=0.7; extra == "explain"
|
|
54
|
+
Provides-Extra: vision
|
|
55
|
+
Requires-Dist: torchvision>=0.15; extra == "vision"
|
|
56
|
+
Dynamic: license-file
|
|
57
|
+
|
|
58
|
+
# TrackmaniaRL
|
|
59
|
+
|
|
60
|
+
TrackmaniaRL is an independent reinforcement-learning library for training
|
|
61
|
+
agents in Trackmania 2020. It provides ready-to-use
|
|
62
|
+
algorithms, model families, replay components and feature pipelines. It also
|
|
63
|
+
lets a project replace any one of those components through an explicit import
|
|
64
|
+
path. Users should be able to train a bundled baseline first, then change only
|
|
65
|
+
the piece they are researching.
|
|
66
|
+
|
|
67
|
+
The project originated from TMRL and has since been substantially redesigned.
|
|
68
|
+
It is not affiliated with or endorsed by Ubisoft, Nadeo, or the TMRL
|
|
69
|
+
maintainers. Trackmania is a trademark of Nadeo/Ubisoft. See [NOTICE](NOTICE)
|
|
70
|
+
for attribution.
|
|
71
|
+
|
|
72
|
+
## One cross-platform workflow
|
|
73
|
+
|
|
74
|
+
The commands are identical on Windows, Linux, WSL and CI:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/Palamabron/AITrackmania.git
|
|
78
|
+
cd AITrackmania
|
|
79
|
+
uv sync
|
|
80
|
+
uv run trackmaniarl init my-trackmania-agent
|
|
81
|
+
cd my-trackmania-agent
|
|
82
|
+
uv sync
|
|
83
|
+
uv run trackmaniarl validate run.yaml
|
|
84
|
+
uv run trackmaniarl train run.yaml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`trackmaniarl init` creates a commented, installable agent project. `trackmaniarl validate`
|
|
88
|
+
checks imports, contracts and a synthetic update without starting the game or contacting
|
|
89
|
+
optional remote trackers.
|
|
90
|
+
`trackmaniarl train` starts a coordinator/learner and one local actor as independent
|
|
91
|
+
Windows-safe `spawn` processes. Collection stays continuous while the learner
|
|
92
|
+
updates replay and publishes policy snapshots asynchronously.
|
|
93
|
+
|
|
94
|
+
The TrackMania project uses a fresh API `1.2` run (`v6`); do not reuse an old
|
|
95
|
+
immutable artifact directory. With the game and OpenPlanet plugin running, use
|
|
96
|
+
the bounded integration check:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv run trackmaniarl track check
|
|
100
|
+
uv run trackmaniarl smoke run.yaml --transitions 100
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
On Windows (the platform that runs TrackMania), `uv sync` installs the locked
|
|
104
|
+
CUDA PyTorch wheel by default via `[tool.uv.sources]`. On other platforms it
|
|
105
|
+
installs the CPU wheel. The CUDA wheel does not need the same locally installed
|
|
106
|
+
CUDA Toolkit version, and a newer NVIDIA driver remains compatible. ROCm hosts
|
|
107
|
+
require the matching AMD Torch build, while macOS MPS uses the normal PyPI Torch
|
|
108
|
+
wheel. `device: auto` then resolves CUDA, ROCm, MPS or CPU from the installed
|
|
109
|
+
Torch build and fails early when visible accelerator hardware cannot be used.
|
|
110
|
+
|
|
111
|
+
The smoke command starts the same local async learner/actor pair as training,
|
|
112
|
+
checks a live policy refresh, and writes a checkpoint.
|
|
113
|
+
|
|
114
|
+
To start from a published release instead of a checkout, install the package,
|
|
115
|
+
then generate the extension project:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
uv tool install "trackmaniarl[distributed]"
|
|
119
|
+
trackmaniarl init my-trackmania-agent
|
|
120
|
+
cd my-trackmania-agent
|
|
121
|
+
uv sync
|
|
122
|
+
trackmaniarl validate run.yaml
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Runtime
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
run.yaml -> coordinator/learner -> SQLite WAL -> replay -> update -> checkpoint
|
|
129
|
+
^ |
|
|
130
|
+
| +---- safetensors policy snapshot
|
|
131
|
+
|
|
|
132
|
+
+---- local or remote actors -> durable rollout spool
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
There is no global runtime configuration, feature-flag routing or mandatory
|
|
136
|
+
external tracker. A run is fully described by `run.yaml` and its referenced,
|
|
137
|
+
installed Python components.
|
|
138
|
+
|
|
139
|
+
For multiple machines, put the same `TRACKMANIARL_DISTRIBUTED_TOKEN` in `.env` and use
|
|
140
|
+
an encrypted tunnel. The learner intentionally accepts loopback connections
|
|
141
|
+
only, so its bearer token and rollout data never traverse the network in clear
|
|
142
|
+
text:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# training machine
|
|
146
|
+
uv run trackmaniarl learner run.yaml --bind 127.0.0.1:8787
|
|
147
|
+
|
|
148
|
+
# each TrackMania machine: create a tunnel to the training machine first
|
|
149
|
+
ssh -N -L 8787:127.0.0.1:8787 TRAINING_MACHINE
|
|
150
|
+
uv run trackmaniarl actor run.yaml --connect 127.0.0.1:8787 --actor-id PC-1
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Only the learner needs W&B credentials. Training loads `WANDB_API_KEY` from
|
|
154
|
+
the environment or project `.env`; a separate `wandb login` is unnecessary
|
|
155
|
+
when that variable is already present.
|
|
156
|
+
|
|
157
|
+
The handshake rejects mismatched configs, models, feature/action definitions,
|
|
158
|
+
map UIDs and geometry. Rollouts use Protobuf/gRPC with Zstandard compression;
|
|
159
|
+
network model state is encoded with safetensors and never pickle.
|
|
160
|
+
|
|
161
|
+
## Bundled components
|
|
162
|
+
|
|
163
|
+
`trackmaniarl.builtins` is the supported catalogue for components included with TrackmaniaRL:
|
|
164
|
+
|
|
165
|
+
- algorithms: `soft_actor_critic`, `randomized_ensemble_sac`,
|
|
166
|
+
`truncated_quantile_critic`, `implicit_quantile_q_learning` and
|
|
167
|
+
`stable_discrete_soft_actor_critic`;
|
|
168
|
+
- models: replaceable encoders, actor heads and critics;
|
|
169
|
+
- replay: uniform, prioritized, episode-sequence and demonstration-mixing samplers;
|
|
170
|
+
- TrackMania collection adapters plus typed telemetry and track-geometry model inputs.
|
|
171
|
+
|
|
172
|
+
Use `trackmaniarl.trackmania` for the neutral TrackMania collection adapter. Game-specific
|
|
173
|
+
environment factories belong in the local extension project, so offline validation
|
|
174
|
+
does not require a running game or optional game dependencies.
|
|
175
|
+
|
|
176
|
+
Use the learner class directly in a component spec, for example
|
|
177
|
+
`trackmaniarl.algorithms.implicit_quantile_q_learning:ImplicitQuantileQLearning`.
|
|
178
|
+
A learner receives a typed `TrainingBatch`, including n-step bootstrap discounts,
|
|
179
|
+
separate termination/truncation flags, PER weights and stable transition IDs.
|
|
180
|
+
|
|
181
|
+
## Extensions and observability
|
|
182
|
+
|
|
183
|
+
The stable contracts in `trackmaniarl.core` are `Learner`, `Policy`, `ModelFactory`,
|
|
184
|
+
`ReplayStore`, `Sampler`, `FeaturePipeline`, `Evaluator`, `RunLogger` and
|
|
185
|
+
`CheckpointCodec`. Hot-path objects are slots dataclasses and PyTrees;
|
|
186
|
+
Pydantic is only used at the configuration boundary.
|
|
187
|
+
|
|
188
|
+
Every run records a redacted immutable manifest, local JSONL events, checkpoints
|
|
189
|
+
and bounded compressed episode artifacts. W&B, Captum, Gemini and Optuna are
|
|
190
|
+
optional extras:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
uv sync --extra wandb --extra explain --extra orchestrator
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Read the [SDK guide](https://github.com/Palamabron/AITrackmania/blob/main/readme/sdk.md)
|
|
197
|
+
for the component schema and a built-in run example, and the
|
|
198
|
+
[TrackMania workflow](https://github.com/Palamabron/AITrackmania/blob/main/readme/trackmania.md) for the
|
|
199
|
+
optional OpenPlanet/gamepad integration and release smoke checklist.
|
|
200
|
+
|
|
201
|
+
For the concrete `trackmaniarl-test` OpenPlanet installation, telemetry ports,
|
|
202
|
+
map preparation, boundary recording and geometry commands, see the
|
|
203
|
+
[agent OpenPlanet guide](https://github.com/Palamabron/AITrackmania/blob/main/my-trackmania-agent/openplanet/README.md).
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
Use the same commands on Windows and Linux; Poe is installed by the `dev` group:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uv run poe fmt
|
|
211
|
+
uv run poe types
|
|
212
|
+
uv run poe test
|
|
213
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# TrackmaniaRL
|
|
2
|
+
|
|
3
|
+
TrackmaniaRL is an independent reinforcement-learning library for training
|
|
4
|
+
agents in Trackmania 2020. It provides ready-to-use
|
|
5
|
+
algorithms, model families, replay components and feature pipelines. It also
|
|
6
|
+
lets a project replace any one of those components through an explicit import
|
|
7
|
+
path. Users should be able to train a bundled baseline first, then change only
|
|
8
|
+
the piece they are researching.
|
|
9
|
+
|
|
10
|
+
The project originated from TMRL and has since been substantially redesigned.
|
|
11
|
+
It is not affiliated with or endorsed by Ubisoft, Nadeo, or the TMRL
|
|
12
|
+
maintainers. Trackmania is a trademark of Nadeo/Ubisoft. See [NOTICE](NOTICE)
|
|
13
|
+
for attribution.
|
|
14
|
+
|
|
15
|
+
## One cross-platform workflow
|
|
16
|
+
|
|
17
|
+
The commands are identical on Windows, Linux, WSL and CI:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/Palamabron/AITrackmania.git
|
|
21
|
+
cd AITrackmania
|
|
22
|
+
uv sync
|
|
23
|
+
uv run trackmaniarl init my-trackmania-agent
|
|
24
|
+
cd my-trackmania-agent
|
|
25
|
+
uv sync
|
|
26
|
+
uv run trackmaniarl validate run.yaml
|
|
27
|
+
uv run trackmaniarl train run.yaml
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`trackmaniarl init` creates a commented, installable agent project. `trackmaniarl validate`
|
|
31
|
+
checks imports, contracts and a synthetic update without starting the game or contacting
|
|
32
|
+
optional remote trackers.
|
|
33
|
+
`trackmaniarl train` starts a coordinator/learner and one local actor as independent
|
|
34
|
+
Windows-safe `spawn` processes. Collection stays continuous while the learner
|
|
35
|
+
updates replay and publishes policy snapshots asynchronously.
|
|
36
|
+
|
|
37
|
+
The TrackMania project uses a fresh API `1.2` run (`v6`); do not reuse an old
|
|
38
|
+
immutable artifact directory. With the game and OpenPlanet plugin running, use
|
|
39
|
+
the bounded integration check:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv run trackmaniarl track check
|
|
43
|
+
uv run trackmaniarl smoke run.yaml --transitions 100
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
On Windows (the platform that runs TrackMania), `uv sync` installs the locked
|
|
47
|
+
CUDA PyTorch wheel by default via `[tool.uv.sources]`. On other platforms it
|
|
48
|
+
installs the CPU wheel. The CUDA wheel does not need the same locally installed
|
|
49
|
+
CUDA Toolkit version, and a newer NVIDIA driver remains compatible. ROCm hosts
|
|
50
|
+
require the matching AMD Torch build, while macOS MPS uses the normal PyPI Torch
|
|
51
|
+
wheel. `device: auto` then resolves CUDA, ROCm, MPS or CPU from the installed
|
|
52
|
+
Torch build and fails early when visible accelerator hardware cannot be used.
|
|
53
|
+
|
|
54
|
+
The smoke command starts the same local async learner/actor pair as training,
|
|
55
|
+
checks a live policy refresh, and writes a checkpoint.
|
|
56
|
+
|
|
57
|
+
To start from a published release instead of a checkout, install the package,
|
|
58
|
+
then generate the extension project:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
uv tool install "trackmaniarl[distributed]"
|
|
62
|
+
trackmaniarl init my-trackmania-agent
|
|
63
|
+
cd my-trackmania-agent
|
|
64
|
+
uv sync
|
|
65
|
+
trackmaniarl validate run.yaml
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Runtime
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
run.yaml -> coordinator/learner -> SQLite WAL -> replay -> update -> checkpoint
|
|
72
|
+
^ |
|
|
73
|
+
| +---- safetensors policy snapshot
|
|
74
|
+
|
|
|
75
|
+
+---- local or remote actors -> durable rollout spool
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
There is no global runtime configuration, feature-flag routing or mandatory
|
|
79
|
+
external tracker. A run is fully described by `run.yaml` and its referenced,
|
|
80
|
+
installed Python components.
|
|
81
|
+
|
|
82
|
+
For multiple machines, put the same `TRACKMANIARL_DISTRIBUTED_TOKEN` in `.env` and use
|
|
83
|
+
an encrypted tunnel. The learner intentionally accepts loopback connections
|
|
84
|
+
only, so its bearer token and rollout data never traverse the network in clear
|
|
85
|
+
text:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# training machine
|
|
89
|
+
uv run trackmaniarl learner run.yaml --bind 127.0.0.1:8787
|
|
90
|
+
|
|
91
|
+
# each TrackMania machine: create a tunnel to the training machine first
|
|
92
|
+
ssh -N -L 8787:127.0.0.1:8787 TRAINING_MACHINE
|
|
93
|
+
uv run trackmaniarl actor run.yaml --connect 127.0.0.1:8787 --actor-id PC-1
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Only the learner needs W&B credentials. Training loads `WANDB_API_KEY` from
|
|
97
|
+
the environment or project `.env`; a separate `wandb login` is unnecessary
|
|
98
|
+
when that variable is already present.
|
|
99
|
+
|
|
100
|
+
The handshake rejects mismatched configs, models, feature/action definitions,
|
|
101
|
+
map UIDs and geometry. Rollouts use Protobuf/gRPC with Zstandard compression;
|
|
102
|
+
network model state is encoded with safetensors and never pickle.
|
|
103
|
+
|
|
104
|
+
## Bundled components
|
|
105
|
+
|
|
106
|
+
`trackmaniarl.builtins` is the supported catalogue for components included with TrackmaniaRL:
|
|
107
|
+
|
|
108
|
+
- algorithms: `soft_actor_critic`, `randomized_ensemble_sac`,
|
|
109
|
+
`truncated_quantile_critic`, `implicit_quantile_q_learning` and
|
|
110
|
+
`stable_discrete_soft_actor_critic`;
|
|
111
|
+
- models: replaceable encoders, actor heads and critics;
|
|
112
|
+
- replay: uniform, prioritized, episode-sequence and demonstration-mixing samplers;
|
|
113
|
+
- TrackMania collection adapters plus typed telemetry and track-geometry model inputs.
|
|
114
|
+
|
|
115
|
+
Use `trackmaniarl.trackmania` for the neutral TrackMania collection adapter. Game-specific
|
|
116
|
+
environment factories belong in the local extension project, so offline validation
|
|
117
|
+
does not require a running game or optional game dependencies.
|
|
118
|
+
|
|
119
|
+
Use the learner class directly in a component spec, for example
|
|
120
|
+
`trackmaniarl.algorithms.implicit_quantile_q_learning:ImplicitQuantileQLearning`.
|
|
121
|
+
A learner receives a typed `TrainingBatch`, including n-step bootstrap discounts,
|
|
122
|
+
separate termination/truncation flags, PER weights and stable transition IDs.
|
|
123
|
+
|
|
124
|
+
## Extensions and observability
|
|
125
|
+
|
|
126
|
+
The stable contracts in `trackmaniarl.core` are `Learner`, `Policy`, `ModelFactory`,
|
|
127
|
+
`ReplayStore`, `Sampler`, `FeaturePipeline`, `Evaluator`, `RunLogger` and
|
|
128
|
+
`CheckpointCodec`. Hot-path objects are slots dataclasses and PyTrees;
|
|
129
|
+
Pydantic is only used at the configuration boundary.
|
|
130
|
+
|
|
131
|
+
Every run records a redacted immutable manifest, local JSONL events, checkpoints
|
|
132
|
+
and bounded compressed episode artifacts. W&B, Captum, Gemini and Optuna are
|
|
133
|
+
optional extras:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
uv sync --extra wandb --extra explain --extra orchestrator
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Read the [SDK guide](https://github.com/Palamabron/AITrackmania/blob/main/readme/sdk.md)
|
|
140
|
+
for the component schema and a built-in run example, and the
|
|
141
|
+
[TrackMania workflow](https://github.com/Palamabron/AITrackmania/blob/main/readme/trackmania.md) for the
|
|
142
|
+
optional OpenPlanet/gamepad integration and release smoke checklist.
|
|
143
|
+
|
|
144
|
+
For the concrete `trackmaniarl-test` OpenPlanet installation, telemetry ports,
|
|
145
|
+
map preparation, boundary recording and geometry commands, see the
|
|
146
|
+
[agent OpenPlanet guide](https://github.com/Palamabron/AITrackmania/blob/main/my-trackmania-agent/openplanet/README.md).
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
Use the same commands on Windows and Linux; Poe is installed by the `dev` group:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uv run poe fmt
|
|
154
|
+
uv run poe types
|
|
155
|
+
uv run poe test
|
|
156
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
Do not publish suspected vulnerabilities, credentials, checkpoint files, or
|
|
4
|
+
telemetry captures in public issues. Report them privately to the repository
|
|
5
|
+
maintainer with the affected version, a minimal reproduction, and the expected
|
|
6
|
+
impact.
|
|
7
|
+
|
|
8
|
+
Only load checkpoints produced by TrackmaniaRL or supplied by a trusted source.
|
|
9
|
+
The default checkpoint loader uses PyTorch's `weights_only=True` mode and
|
|
10
|
+
rejects checkpoints that require executable pickle payloads.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: TrackmaniaRL
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Reinforcement-learning library for training agents in Trackmania 2020
|
|
5
|
+
Author: Jakub Szulc
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Palamabron/AITrackmania
|
|
8
|
+
Project-URL: Repository, https://github.com/Palamabron/AITrackmania
|
|
9
|
+
Project-URL: Changelog, https://github.com/Palamabron/AITrackmania/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: reinforcement learning,robot learning,trackmania,self driving,roborace
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Games/Entertainment
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: pydantic>=2.0
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: torch>=2.4
|
|
29
|
+
Requires-Dist: tensordict>=0.6
|
|
30
|
+
Requires-Dist: gymnasium>=0.29
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Provides-Extra: orchestrator
|
|
33
|
+
Requires-Dist: google-genai>=2.2.0; extra == "orchestrator"
|
|
34
|
+
Requires-Dist: optuna>=3.0; extra == "orchestrator"
|
|
35
|
+
Provides-Extra: algorithms
|
|
36
|
+
Requires-Dist: einops>=0.7; extra == "algorithms"
|
|
37
|
+
Requires-Dist: gymnasium>=0.29; extra == "algorithms"
|
|
38
|
+
Requires-Dist: loguru>=0.7; extra == "algorithms"
|
|
39
|
+
Requires-Dist: pandas>=2.0; extra == "algorithms"
|
|
40
|
+
Requires-Dist: torchrl>=0.11; extra == "algorithms"
|
|
41
|
+
Provides-Extra: trackmania
|
|
42
|
+
Requires-Dist: gymnasium>=0.29; extra == "trackmania"
|
|
43
|
+
Requires-Dist: vgamepad>=0.1.0; sys_platform == "win32" and extra == "trackmania"
|
|
44
|
+
Provides-Extra: wandb
|
|
45
|
+
Requires-Dist: wandb>=0.15.8; extra == "wandb"
|
|
46
|
+
Provides-Extra: distributed
|
|
47
|
+
Requires-Dist: grpcio>=1.66; extra == "distributed"
|
|
48
|
+
Requires-Dist: protobuf>=5.27; extra == "distributed"
|
|
49
|
+
Requires-Dist: safetensors>=0.4.5; extra == "distributed"
|
|
50
|
+
Requires-Dist: zstandard>=0.23; extra == "distributed"
|
|
51
|
+
Requires-Dist: vgamepad>=0.1.0; sys_platform == "win32" and extra == "distributed"
|
|
52
|
+
Provides-Extra: explain
|
|
53
|
+
Requires-Dist: captum>=0.7; extra == "explain"
|
|
54
|
+
Provides-Extra: vision
|
|
55
|
+
Requires-Dist: torchvision>=0.15; extra == "vision"
|
|
56
|
+
Dynamic: license-file
|
|
57
|
+
|
|
58
|
+
# TrackmaniaRL
|
|
59
|
+
|
|
60
|
+
TrackmaniaRL is an independent reinforcement-learning library for training
|
|
61
|
+
agents in Trackmania 2020. It provides ready-to-use
|
|
62
|
+
algorithms, model families, replay components and feature pipelines. It also
|
|
63
|
+
lets a project replace any one of those components through an explicit import
|
|
64
|
+
path. Users should be able to train a bundled baseline first, then change only
|
|
65
|
+
the piece they are researching.
|
|
66
|
+
|
|
67
|
+
The project originated from TMRL and has since been substantially redesigned.
|
|
68
|
+
It is not affiliated with or endorsed by Ubisoft, Nadeo, or the TMRL
|
|
69
|
+
maintainers. Trackmania is a trademark of Nadeo/Ubisoft. See [NOTICE](NOTICE)
|
|
70
|
+
for attribution.
|
|
71
|
+
|
|
72
|
+
## One cross-platform workflow
|
|
73
|
+
|
|
74
|
+
The commands are identical on Windows, Linux, WSL and CI:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/Palamabron/AITrackmania.git
|
|
78
|
+
cd AITrackmania
|
|
79
|
+
uv sync
|
|
80
|
+
uv run trackmaniarl init my-trackmania-agent
|
|
81
|
+
cd my-trackmania-agent
|
|
82
|
+
uv sync
|
|
83
|
+
uv run trackmaniarl validate run.yaml
|
|
84
|
+
uv run trackmaniarl train run.yaml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`trackmaniarl init` creates a commented, installable agent project. `trackmaniarl validate`
|
|
88
|
+
checks imports, contracts and a synthetic update without starting the game or contacting
|
|
89
|
+
optional remote trackers.
|
|
90
|
+
`trackmaniarl train` starts a coordinator/learner and one local actor as independent
|
|
91
|
+
Windows-safe `spawn` processes. Collection stays continuous while the learner
|
|
92
|
+
updates replay and publishes policy snapshots asynchronously.
|
|
93
|
+
|
|
94
|
+
The TrackMania project uses a fresh API `1.2` run (`v6`); do not reuse an old
|
|
95
|
+
immutable artifact directory. With the game and OpenPlanet plugin running, use
|
|
96
|
+
the bounded integration check:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv run trackmaniarl track check
|
|
100
|
+
uv run trackmaniarl smoke run.yaml --transitions 100
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
On Windows (the platform that runs TrackMania), `uv sync` installs the locked
|
|
104
|
+
CUDA PyTorch wheel by default via `[tool.uv.sources]`. On other platforms it
|
|
105
|
+
installs the CPU wheel. The CUDA wheel does not need the same locally installed
|
|
106
|
+
CUDA Toolkit version, and a newer NVIDIA driver remains compatible. ROCm hosts
|
|
107
|
+
require the matching AMD Torch build, while macOS MPS uses the normal PyPI Torch
|
|
108
|
+
wheel. `device: auto` then resolves CUDA, ROCm, MPS or CPU from the installed
|
|
109
|
+
Torch build and fails early when visible accelerator hardware cannot be used.
|
|
110
|
+
|
|
111
|
+
The smoke command starts the same local async learner/actor pair as training,
|
|
112
|
+
checks a live policy refresh, and writes a checkpoint.
|
|
113
|
+
|
|
114
|
+
To start from a published release instead of a checkout, install the package,
|
|
115
|
+
then generate the extension project:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
uv tool install "trackmaniarl[distributed]"
|
|
119
|
+
trackmaniarl init my-trackmania-agent
|
|
120
|
+
cd my-trackmania-agent
|
|
121
|
+
uv sync
|
|
122
|
+
trackmaniarl validate run.yaml
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Runtime
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
run.yaml -> coordinator/learner -> SQLite WAL -> replay -> update -> checkpoint
|
|
129
|
+
^ |
|
|
130
|
+
| +---- safetensors policy snapshot
|
|
131
|
+
|
|
|
132
|
+
+---- local or remote actors -> durable rollout spool
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
There is no global runtime configuration, feature-flag routing or mandatory
|
|
136
|
+
external tracker. A run is fully described by `run.yaml` and its referenced,
|
|
137
|
+
installed Python components.
|
|
138
|
+
|
|
139
|
+
For multiple machines, put the same `TRACKMANIARL_DISTRIBUTED_TOKEN` in `.env` and use
|
|
140
|
+
an encrypted tunnel. The learner intentionally accepts loopback connections
|
|
141
|
+
only, so its bearer token and rollout data never traverse the network in clear
|
|
142
|
+
text:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# training machine
|
|
146
|
+
uv run trackmaniarl learner run.yaml --bind 127.0.0.1:8787
|
|
147
|
+
|
|
148
|
+
# each TrackMania machine: create a tunnel to the training machine first
|
|
149
|
+
ssh -N -L 8787:127.0.0.1:8787 TRAINING_MACHINE
|
|
150
|
+
uv run trackmaniarl actor run.yaml --connect 127.0.0.1:8787 --actor-id PC-1
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Only the learner needs W&B credentials. Training loads `WANDB_API_KEY` from
|
|
154
|
+
the environment or project `.env`; a separate `wandb login` is unnecessary
|
|
155
|
+
when that variable is already present.
|
|
156
|
+
|
|
157
|
+
The handshake rejects mismatched configs, models, feature/action definitions,
|
|
158
|
+
map UIDs and geometry. Rollouts use Protobuf/gRPC with Zstandard compression;
|
|
159
|
+
network model state is encoded with safetensors and never pickle.
|
|
160
|
+
|
|
161
|
+
## Bundled components
|
|
162
|
+
|
|
163
|
+
`trackmaniarl.builtins` is the supported catalogue for components included with TrackmaniaRL:
|
|
164
|
+
|
|
165
|
+
- algorithms: `soft_actor_critic`, `randomized_ensemble_sac`,
|
|
166
|
+
`truncated_quantile_critic`, `implicit_quantile_q_learning` and
|
|
167
|
+
`stable_discrete_soft_actor_critic`;
|
|
168
|
+
- models: replaceable encoders, actor heads and critics;
|
|
169
|
+
- replay: uniform, prioritized, episode-sequence and demonstration-mixing samplers;
|
|
170
|
+
- TrackMania collection adapters plus typed telemetry and track-geometry model inputs.
|
|
171
|
+
|
|
172
|
+
Use `trackmaniarl.trackmania` for the neutral TrackMania collection adapter. Game-specific
|
|
173
|
+
environment factories belong in the local extension project, so offline validation
|
|
174
|
+
does not require a running game or optional game dependencies.
|
|
175
|
+
|
|
176
|
+
Use the learner class directly in a component spec, for example
|
|
177
|
+
`trackmaniarl.algorithms.implicit_quantile_q_learning:ImplicitQuantileQLearning`.
|
|
178
|
+
A learner receives a typed `TrainingBatch`, including n-step bootstrap discounts,
|
|
179
|
+
separate termination/truncation flags, PER weights and stable transition IDs.
|
|
180
|
+
|
|
181
|
+
## Extensions and observability
|
|
182
|
+
|
|
183
|
+
The stable contracts in `trackmaniarl.core` are `Learner`, `Policy`, `ModelFactory`,
|
|
184
|
+
`ReplayStore`, `Sampler`, `FeaturePipeline`, `Evaluator`, `RunLogger` and
|
|
185
|
+
`CheckpointCodec`. Hot-path objects are slots dataclasses and PyTrees;
|
|
186
|
+
Pydantic is only used at the configuration boundary.
|
|
187
|
+
|
|
188
|
+
Every run records a redacted immutable manifest, local JSONL events, checkpoints
|
|
189
|
+
and bounded compressed episode artifacts. W&B, Captum, Gemini and Optuna are
|
|
190
|
+
optional extras:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
uv sync --extra wandb --extra explain --extra orchestrator
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Read the [SDK guide](https://github.com/Palamabron/AITrackmania/blob/main/readme/sdk.md)
|
|
197
|
+
for the component schema and a built-in run example, and the
|
|
198
|
+
[TrackMania workflow](https://github.com/Palamabron/AITrackmania/blob/main/readme/trackmania.md) for the
|
|
199
|
+
optional OpenPlanet/gamepad integration and release smoke checklist.
|
|
200
|
+
|
|
201
|
+
For the concrete `trackmaniarl-test` OpenPlanet installation, telemetry ports,
|
|
202
|
+
map preparation, boundary recording and geometry commands, see the
|
|
203
|
+
[agent OpenPlanet guide](https://github.com/Palamabron/AITrackmania/blob/main/my-trackmania-agent/openplanet/README.md).
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
Use the same commands on Windows and Linux; Poe is installed by the `dev` group:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uv run poe fmt
|
|
211
|
+
uv run poe types
|
|
212
|
+
uv run poe test
|
|
213
|
+
```
|