- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.9k
          feat(policies): Allow users to register 3rd party policies - pip install lerobot_policy_mypolicy
          #2308
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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()toregister_third_party_plugins()and added support forlerobot_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 addedlerobot_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.
There was a problem hiding this 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.
| 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. | 
| 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. | 
What this does
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:
Looking forward for your feedback! 🤗