-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Feature] Create inference script without encode video for fast test policy on hardware #2487
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?
[Feature] Create inference script without encode video for fast test policy on hardware #2487
Conversation
Additional NotesCurrent inference is using the
This PR addresses all of the above by introducing a lightweight inference-only script with instant start/stop control, keyboard-based safety interruption, and optional teleoperation for recovery. |
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 introduces a new fast inference script (lerobot_infer.py) designed for testing robot policies on hardware without the overhead of video encoding or dataset recording. The script provides a streamlined workflow with real-time keyboard controls for policy execution, teleoperation switching, and episode management.
Key Changes
- Adds
lerobot-inferCLI command for pure inference mode without recording - Implements keyboard-driven control flow (play/pause policy, toggle teleoperation, reset episodes, exit)
- Supports optional real-time visualization via rerun when
--display_data=true
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/lerobot/scripts/lerobot_infer.py | New inference script with policy execution loop, keyboard listener, temporary dataset handling for policy metadata, and support for single/multi-teleop configurations |
| pyproject.toml | Adds CLI entry point lerobot-infer to project scripts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What this does
This PR adds a new script,
lerobot_infer.py, providing a fast, pure inference mode for running robot policies without video encoding or dataset recording overhead.Key features:
lerobot-inferp/Space,t,r,Esc)--display_data=trueThis improves the workflow for quickly testing robot policies on hardware.
How it was tested
The script was validated using a generic configuration with robot, teleop, and at least one camera stream, which is required for most vision-based policies.
Testers must use their own robot IDs, teleop IDs, ports, and camera setup.
Example test command (replace with your own devices):
uv run lerobot-infer \ --robot.type=<ROBOT_TYPE> \ --robot.port=<ROBOT_PORT> \ --robot.id=<ROBOT_ID> \ --robot.cameras="<YOUR_CAMERA_CONFIG>" \ --policy.path=<POLICY_PATH> \ --task=<TASK_NAME> \ --teleop.type=<TELEOP_TYPE> \ --teleop.port=<TELEOP_PORT> \ --teleop.id=<TELEOP_ID>Observed results:
How to checkout & try? (for the reviewer)
Minimal example:
uv run lerobot-infer \ --robot.type=<ROBOT_TYPE> \ --robot.port=<ROBOT_PORT> \ --robot.id=<ROBOT_ID> \ --robot.cameras="<YOUR_CAMERA_CONFIG>" \ --policy.path=<POLICY_PATH>With teleop:
uv run lerobot-infer \ --robot.type=<ROBOT_TYPE> \ --robot.port=<ROBOT_PORT> \ --robot.id=<ROBOT_ID> \ --robot.cameras="<YOUR_CAMERA_CONFIG>" \ --teleop.type=<TELEOP_TYPE> \ --teleop.port=<TELEOP_PORT> \ --teleop.id=<TELEOP_ID> \ --policy.path=<POLICY_PATH>Optional visualization:
Keyboard controls:
p/ Space → start/stop inferencet→ toggle teleoperationr→ reset episodeEsc→ exit