Skip to content

Conversation

@danielsanjosepro
Copy link

@danielsanjosepro danielsanjosepro commented Oct 24, 2025

What this does

  • It allows new users to register their own policies, similar to how users can now register 3rd party devices and can be used as:
conda activate lerobot
pip install lerobot_policy_<my_amazing_policy_name>
lerobot-train --policy.type <my_amazing_policy_name> --env.type pusht

Why?

It will promote sharing policies without having to fork LeRobot and become incompatible with the ecosystem in a few weeks. It is also easier to maintain policies externally instead of cluttering the default policies of LeRobot, reducing the maintenance effort for the main contributors.

How it was tested

It was tested by running the train and evaluation scripts of LeRobot with lerobot_policy_ditflow on pusht and on our Franka Robotics FR3. It was also tested with other policies that are (for now) not publicly available.

How to checkout & try? (for the reviewer)

The easiest would be to check out test_lerobot_policy_ditflow.

To train DiTFlow on pusht just try this:

git clone https://github.com/danielsanjosepro/lerobot_policy_ditflow.git
git clone https://github.com/danielsanjosepro/lerobot.git
git clone https://github.com/danielsanjosepro/test_lerobot_policy_ditflow.git

cd test_lerobot_policy_ditflow
pixi shell  # similar to conda, it activates the environment and installs lerobot as well as lerobot_policy_ditflow
bash scripts/train.sh  # train DiTFlow and Diffusion on pusht

Looking forward for your feedback! 🤗

Copilot AI review requested due to automatic review settings October 24, 2025 11:02
Copy link
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 enables users to register and use third-party policy implementations as pip-installable plugins, following the pattern lerobot_policy_<policy_name>. This allows the community to contribute policies without forking LeRobot, similar to the existing device plugin system.

Key changes:

  • Renamed register_third_party_devices() to register_third_party_plugins() and added support for lerobot_policy_* packages
  • Integrated plugin registration into training and evaluation scripts
  • Added dynamic import mechanisms in policy factory to support third-party policies
  • Created documentation for policy plugin development

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lerobot/utils/import_utils.py Renamed function to register_third_party_plugins() and added lerobot_policy_ prefix to plugin discovery
src/lerobot/scripts/lerobot_train.py Added plugin registration call in main entry point
src/lerobot/scripts/lerobot_eval.py Added plugin registration call in main entry point
src/lerobot/scripts/lerobot_teleoperate.py Updated import to use renamed register_third_party_plugins() function
src/lerobot/scripts/lerobot_replay.py Updated import to use renamed register_third_party_plugins() function
src/lerobot/scripts/lerobot_record.py Updated import to use renamed register_third_party_plugins() function
src/lerobot/scripts/lerobot_calibrate.py Updated import to use renamed register_third_party_plugins() function
src/lerobot/policies/factory.py Added dynamic import helpers for third-party policy classes and processors
docs/source/bring_your_own_policies.mdx Added comprehensive guide for creating third-party policy plugins
docs/source/_toctree.yml Added new documentation page to table of contents

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@imstevenpmwork imstevenpmwork self-assigned this Oct 24, 2025
@imstevenpmwork imstevenpmwork added enhancement Suggestions for new features or improvements policies Items related to robot policies labels Oct 24, 2025
Copy link
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 10 out of 10 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@HuggingFaceDocBuilderDev

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.

@imstevenpmwork
Copy link
Collaborator

Gracias, @danielsanjosepro! That's an excellent idea; I'm surprised policies didn't occur to me in the original PR.

This is looking good. I'll hold this PR until next week, as the current focus is on bug fixes and documentation updates for the 0.4.1 release.

@imstevenpmwork imstevenpmwork self-requested a review October 26, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Suggestions for new features or improvements policies Items related to robot policies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants