Fix MetaWorld named image observation contract - #2
Merged
Merged
Conversation
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
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the MetaWorld observation contract so the source behavior matches the public
EnvContractand documentation.MetaWorld advertised
observation.images.<camera>, but its raw Gym observation exposedpixelsas a single ndarray. LeRobot preprocesses that shape into the singletonobservation.imagekey, so policies could receive a different key than the contract promised.This PR changes MetaWorld to expose
pixelsas a camera-keyed dict, derives the feature map fromcamera_name, and passescamera_namethrough the dummy env path used for vector/async space inference. The docs now call out the defaultobservation.images.corner2key 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.pyPATH=/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:buildPYTHONPATH=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