Skip to content

Fix MetaWorld named image observation contract - #2

Merged
Chaoqi-LIU merged 1 commit into
mainfrom
metaworld-contract-fix
May 23, 2026
Merged

Chaoqi-LIU merged 1 commit into
mainfrom
metaworld-contract-fix

Conversation

@Chaoqi-LIU

Copy link
Copy Markdown
Owner

Summary

Fix the MetaWorld observation contract so the source behavior matches the public EnvContract and documentation.

MetaWorld advertised observation.images.<camera>, but its raw Gym observation exposed pixels as a single ndarray. LeRobot preprocesses that shape into the singleton observation.image key, so policies could receive a different key than the contract promised.

This PR changes MetaWorld to expose pixels as a camera-keyed dict, derives the feature map from camera_name, and passes camera_name through the dummy env path used for vector/async space inference. The docs now call out the default observation.images.corner2 key and the custom-camera convention.

Validation

  • PYTHONPATH=src /projects/bhba/cliu35/praxis/.venv/bin/python -m pytest tests/src/praxis_eval/envs/metaworld/test_metaworld_factory.py tests/src/praxis_eval/envs/test_env_factory.py tests/test_api.py tests/test_verify_scripts.py -q
  • /projects/bhba/cliu35/praxis/.venv/bin/pre-commit run --files docs/benchmarks/metaworld.md src/praxis_eval/envs/metaworld/__init__.py src/praxis_eval/envs/metaworld/config.py src/praxis_eval/envs/metaworld/env.py src/praxis_eval/envs/metaworld/eval.py src/praxis_eval/envs/metaworld/registration.py src/praxis_eval/envs/metaworld/runtime.py tests/src/praxis_eval/envs/metaworld/test_metaworld_factory.py
  • PATH=/projects/bhba/cliu35/praxis/.venv/bin:$PATH npm --prefix docs run docs:check && PATH=/projects/bhba/cliu35/praxis/.venv/bin:$PATH npm --prefix docs run docs:build
  • PYTHONPATH=src MUJOCO_GL=egl /projects/bhba/cliu35/praxis/.venv/bin/python -m praxis_eval.scripts.verify metaworld --task reach-v3 --max-episode-steps 1 --image-size 64 --output-dir /tmp/praxis-eval-metaworld-contract-verify

MetaWorld advertised observation.images.<camera> in its public EnvContract, but its raw pixels observation was a single ndarray. LeRobot preprocesses that shape as observation.image, so the public contract and the policy-facing rollout observation could diverge.

Represent MetaWorld pixels as a camera-keyed dict, derive default feature keys and feature maps from camera_name, and pass camera_name through dummy env construction used for async/vector space inference. Update the public docs to name the default corner2 key and add regression coverage at the vector-env preprocessing boundary.

Verification:

- PYTHONPATH=src /projects/bhba/cliu35/praxis/.venv/bin/python -m pytest tests/src/praxis_eval/envs/metaworld/test_metaworld_factory.py tests/src/praxis_eval/envs/test_env_factory.py tests/test_api.py tests/test_verify_scripts.py -q

- /projects/bhba/cliu35/praxis/.venv/bin/pre-commit run --files docs/benchmarks/metaworld.md src/praxis_eval/envs/metaworld/__init__.py src/praxis_eval/envs/metaworld/config.py src/praxis_eval/envs/metaworld/env.py src/praxis_eval/envs/metaworld/eval.py src/praxis_eval/envs/metaworld/registration.py src/praxis_eval/envs/metaworld/runtime.py tests/src/praxis_eval/envs/metaworld/test_metaworld_factory.py

- PATH=/projects/bhba/cliu35/praxis/.venv/bin:$PATH npm --prefix docs run docs:check && PATH=/projects/bhba/cliu35/praxis/.venv/bin:$PATH npm --prefix docs run docs:build

- PYTHONPATH=src MUJOCO_GL=egl /projects/bhba/cliu35/praxis/.venv/bin/python -m praxis_eval.scripts.verify metaworld --task reach-v3 --max-episode-steps 1 --image-size 64 --output-dir /tmp/praxis-eval-metaworld-contract-verify
@Chaoqi-LIU
Chaoqi-LIU merged commit 42215f4 into main May 23, 2026
4 checks passed
@Chaoqi-LIU
Chaoqi-LIU deleted the metaworld-contract-fix branch May 23, 2026 02:33

This branch was previously deployed

1 inactive deployment
github-pages — 04e62d04 Deployed May 23, 2026 by Chaoqi-LIU via Deploy Pages #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant