Skip to content

feat(envs): add envs pre-post processor#2474

Merged
jadechoghari merged 23 commits into
mainfrom
refactor/env-libero
Nov 19, 2025
Merged

feat(envs): add envs pre-post processor#2474
jadechoghari merged 23 commits into
mainfrom
refactor/env-libero

Conversation

@jadechoghari
Copy link
Copy Markdown
Contributor

@jadechoghari jadechoghari commented Nov 18, 2025

What this does

With this refactor, Libero environments now expose the full set of state features rather than a fixed subset. The VLA preprocessor is responsible for selecting and formatting the states it needs. This separation of concerns simplifies the pipeline, makes adding new VLA variants much easier, and enables experimentation with richer or alternative state representations without requiring changes to the environment code.

You can now either implement your own custom Libero preprocessor or use the default one, LiberoProcessorStep, which assumes the policy was trained on the dataset at HuggingFaceVLA/libero.

We introduce a new make_env_pre_post_processors function in lerobot/envs/factory.py that creates environment-specific observation processors. This function follows the same factory pattern as make_pre_post_processors for policies, but is specifically designed for environment observation transformations.

Copilot AI review requested due to automatic review settings November 18, 2025 14:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the LIBERO environment integration to use a more structured observation format. Instead of a flat agent_pos state vector, observations now use a nested robot_state dictionary containing detailed end-effector, gripper, and joint information. A new LiberoProcessorStep is introduced to transform these structured observations into the format expected by LeRobot policies.

Key changes:

  • Replaced flat agent_pos with nested robot_state structure containing eef, gripper, and joints data
  • Added LiberoProcessorStep to process LIBERO observations, including quaternion-to-axis-angle conversion and image flipping
  • Updated environment configuration to define features for all robot state components

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/processor/test_libero_processor.py Adds test for the new LiberoProcessorStep (note: test should be converted to proper pytest function)
src/lerobot/scripts/lerobot_eval.py Whitespace normalization
src/lerobot/processor/observation_processor.py Implements LiberoProcessorStep for processing LIBERO observations with quaternion conversion and image flipping
src/lerobot/envs/utils.py Adds handling for nested robot_state structure in preprocess_observation (note: needs recursive conversion fix)
src/lerobot/envs/libero.py Updates observation space definition and _format_raw_obs to return structured robot_state instead of flat agent_pos
src/lerobot/envs/configs.py Updates feature definitions and mappings for the new robot_state structure
eval.sh Adds evaluation script (note: contains user-specific path, should not be committed)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/envs/utils.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
@jadechoghari jadechoghari requested a review from Copilot November 18, 2025 15:14
@jadechoghari jadechoghari changed the title Refactor/env libero refactor(libero): expose full robot_state and simplify VLA preprocessing Nov 18, 2025
@jadechoghari jadechoghari self-assigned this Nov 18, 2025
@jadechoghari jadechoghari added refactor evaluation For issues or PRs related to environment evaluation, and benchmarks. labels Nov 18, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lerobot/envs/libero.py
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Comment thread src/lerobot/processor/observation_processor.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lerobot/envs/factory.py
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@jadechoghari jadechoghari changed the title refactor(libero): expose full robot_state and simplify VLA preprocessing refactor(envs): expose full robot_state and simplify VLA preprocessing Nov 18, 2025
@jadechoghari jadechoghari changed the title refactor(envs): expose full robot_state and simplify VLA preprocessing feat(envs): add envs pre-post processor Nov 18, 2025
Copy link
Copy Markdown
Contributor

@michel-aractingi michel-aractingi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @jadechoghari !

minor nits required.

The biggest part is adding constants for the feature names of libero config rather than hardcoding them .

Comment thread src/lerobot/envs/configs.py Outdated
Comment thread src/lerobot/envs/configs.py Outdated
Comment thread src/lerobot/envs/libero.py
Comment thread src/lerobot/processor/env_processor.py
Comment thread src/lerobot/envs/factory.py Outdated
Comment thread docs/source/env_processor.mdx
jadechoghari and others added 2 commits November 19, 2025 16:34
Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
Signed-off-by: Jade Choghari <chogharijade@gmail.com>
Copy link
Copy Markdown
Contributor

@michel-aractingi michel-aractingi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jadechoghari jadechoghari merged commit 6e86a69 into main Nov 19, 2025
12 checks passed
@jadechoghari jadechoghari deleted the refactor/env-libero branch November 19, 2025 17:36
XHAKA3456 pushed a commit to XHAKA3456/lerobot that referenced this pull request Dec 12, 2025
* more changes

* working changes

* more changes

* more fixes

* fix style

* more

* clean

* put axis-1

* more fixes

* more styling fixes:

* iterate on review:

* more changes

* add env processor

* style

* more changes

* add docs

* fix imports

* fix test, add to train

* Update src/lerobot/envs/factory.py

Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
Signed-off-by: Jade Choghari <chogharijade@gmail.com>

* iterate on review

---------

Signed-off-by: Jade Choghari <chogharijade@gmail.com>
Co-authored-by: jade.choghari@huggingface.co <“chogharijade@gmail.com”>
Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
sandhya-cb pushed a commit to sandhya-cb/lerobot-clutterbot that referenced this pull request Jan 28, 2026
* more changes

* working changes

* more changes

* more fixes

* fix style

* more

* clean

* put axis-1

* more fixes

* more styling fixes:

* iterate on review:

* more changes

* add env processor

* style

* more changes

* add docs

* fix imports

* fix test, add to train

* Update src/lerobot/envs/factory.py

Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
Signed-off-by: Jade Choghari <chogharijade@gmail.com>

* iterate on review

---------

Signed-off-by: Jade Choghari <chogharijade@gmail.com>
Co-authored-by: jade.choghari@huggingface.co <“chogharijade@gmail.com”>
Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
lu391see pushed a commit to lu391see/lerobot_tactile that referenced this pull request Mar 24, 2026
* more changes

* working changes

* more changes

* more fixes

* fix style

* more

* clean

* put axis-1

* more fixes

* more styling fixes:

* iterate on review:

* more changes

* add env processor

* style

* more changes

* add docs

* fix imports

* fix test, add to train

* Update src/lerobot/envs/factory.py

Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
Signed-off-by: Jade Choghari <chogharijade@gmail.com>

* iterate on review

---------

Signed-off-by: Jade Choghari <chogharijade@gmail.com>
Co-authored-by: jade.choghari@huggingface.co <“chogharijade@gmail.com”>
Co-authored-by: Michel Aractingi <michel.aractingi@huggingface.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

evaluation For issues or PRs related to environment evaluation, and benchmarks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants