-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add API Examples #2289
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
Add API Examples #2289
Conversation
* fix: expose a function explicitly building a frame for inference * fix: first make dataset frame, then make ready for inference * fix: reducing reliance on lerobot record for policy's ouptuts too * fix: encapsulating squeezing out + device handling from predict action * fix: remove duplicated call to build_inference_frame and add a function to only perform data type handling (whole conversion is: keys matching + data type conversion) * refactor(envs): add custom-observation-size (#2167) * fix: add MockMotorBus to MockRobot * rl: first drafts * add: all components of HIL SERL * fix: actor block works * fix: less friction, less friction * add: hil-serl complete example * fix: dataset names * fix: restructuring example folder * fix: act works but found bug in how ACT works * fix: same path for both pre and postprocessors * fix: paths * add: example usage for act * add: using ACT example * fix: training examples * fix: using examples * fix: camera index * fix: rename workflows into tutorial so that the path of the files is lerobot/examples/tutorial/... * fix: upload everything in one repo * fix: model name * fix: simplify model path * add: VLAs example --------- Signed-off-by: Francesco Capuano <[email protected]>
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 adds tutorial examples demonstrating how to use and train various LeRobot policies, including ACT, Diffusion, PI0, SmolVLA, reward classifiers, HIL-SERL reinforcement learning, and asynchronous inference. These examples are designed to accompany an upcoming tutorial release and make the library more accessible to researchers and users.
Key changes:
- Addition of complete code examples for policy inference and training
- Implementation of HIL-SERL dual-buffer RL system with reward classifiers
- Examples for asynchronous inference using client-server architecture
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/tutorial/act/act_training_example.py | Training example for ACT policy |
| examples/tutorial/act/act_using_example.py | Inference example for ACT policy |
| examples/tutorial/diffusion/diffusion_training_example.py | Training example for Diffusion policy |
| examples/tutorial/diffusion/diffusion_using_example.py | Inference example for Diffusion policy |
| examples/tutorial/pi0/using_pi0_example.py | Inference example for PI0 policy |
| examples/tutorial/smolvla/using_smolvla_example.py | Inference example for SmolVLA policy |
| examples/tutorial/rl/reward_classifier_example.py | Training example for reward classifier |
| examples/tutorial/rl/hilserl_example.py | HIL-SERL reinforcement learning example |
| examples/tutorial/async-inf/robot_client.py | Asynchronous inference client example |
| examples/tutorial/async-inf/policy_server.py | Asynchronous inference server example |
| actor_learner_example.py | Comprehensive actor-learner example with reward classifier testing |
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.
LGTM, thanks !
Part of PR stack (the lower, the closer to main)
build_inference_frame/make_robot_actionutil to easily allow API-based Inference #2143What this does
The tutorial will be released very shortly (~tomorrow), and this PR adds the examples I have added in it to the library. Happy to tweak them, although they have all been tested end-to-end for functionality! Together with the behavior conversion and tutorial, I hope this is a good step towards making the library more hackable (and researcher friendly, 😉!)
FYI, I won't be able to change these examples in the tutorial but for second edition. That can be released soon (TBD), and I'd be happy to add there whatever ends up landing on
main