Commit 15de4dd
committed
[Feature] mujoco_playground wrapper review fixes
- CI: install `playground` (PyPI name) instead of import name
`mujoco_playground`; the previous `pip install mujoco_playground` was the
root cause of the current `unittests-mujoco-playground` CI failure.
- CI: drop the broken try/except JAX-init fallback in run_test.sh — it ran
in a subprocess that exited immediately, so `JAX_PLATFORM_NAME` never
reached pytest and any real "GPU not visible" error was hidden.
- Wrapper: docstrings no longer advertise a `state` field that the env
never emits; the JAX state is intentionally kept on
`self._current_state` rather than round-tripped through TensorDict (this
is now documented as a `.. note::` block).
- Wrapper: freeze `MujocoPlaygroundAgentSpec` /
`MujocoPlaygroundAgentMapping` dataclasses and deep-copy
`KNOWN_MARL_MAPPINGS` entries on string lookup so users cannot mutate
the module-level mapping by accident.
- Wrapper: emit a `UserWarning` when resolving a string against
`KNOWN_MARL_MAPPINGS`, since those indices target Brax's observation
layout and may not be semantically equivalent for mujoco_playground envs.
- Wrapper: document the policy contract for `homogenization_mode='max'`
and `'concat'` (which action/obs entries are real vs padding/discarded).
- Wrapper: align `_MujocoPlaygroundMeta` num_workers handling with
`_BraxMeta`; make `agent_mapping` and `config`/`config_overrides`
keyword-only; accept `seed=None` in `_set_seed` (defaults to 0, matching
the `_reset` fallback) instead of raising bare `Exception`; document
`_listerize`'s inclusive-range semantics; drop unused
`pixels_only`/`camera_id`/`render_kwargs` from `_build_env`.
- Example: rewrite `save_visualization` in
`profile_mujoco_playground_collector.py` to snapshot
`env._current_state` during a manual rollout, removing dependencies on
non-existent `env._state_example` and `td["state"]`.
- Config: drop stale `categorical_action_encoding` field on
`MujocoPlaygroundEnvConfig`; add `agent_mapping` and `num_workers` so
the MARL and parallel-process knobs are reachable from the config
system.
- Tests: replace three duplicated `_setup_jax` fixtures with a single
module-level autouse fixture; introduce a session-scoped
`marl_env_sizes` fixture to avoid constructing a throwaway env in every
MARL test; expect the new MABrax warning on string lookups; add a
new `TestMujocoPlaygroundDictObs` class covering reset /
`check_env_specs` and a negative test that
`homogenization_mode != 'none'` raises `NotImplementedError` for
dict-obs envs; make `test_no_mapping_regression` actually exercise the
MARL env it constructs.
- Docs: keep the `MOGymEnv` / `MOGymWrapper` pair adjacent in
`envs_libraries.rst`; `__repr__` now uses `env_name=` to match the
constructor kwarg.1 parent 39e43d7 commit 15de4dd
7 files changed
Lines changed: 400 additions & 306 deletions
File tree
- .github/unittest/linux_libs/scripts_mujoco_playground
- docs/source/reference
- examples/collectors
- test/libs
- torchrl
- envs/libs
- trainers/algorithms/configs
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
Lines changed: 5 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
58 | 38 | | |
59 | 39 | | |
60 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | | - | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
Lines changed: 27 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
266 | 270 | | |
267 | 271 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
271 | 275 | | |
272 | 276 | | |
273 | 277 | | |
| 278 | + | |
274 | 279 | | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
278 | 292 | | |
279 | 293 | | |
280 | 294 | | |
| 295 | + | |
| 296 | + | |
281 | 297 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
405 | | - | |
| 406 | + | |
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
| |||
0 commit comments