-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Asynchronous episode saving for faster recording #2555
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
…Saver` class and `async_saving` config option.
fb0eb7e to
86e8d8f
Compare
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 implements asynchronous episode saving to reduce delays between episodes during robot recording. The key change is adding a AsyncEpisodeSaver class that saves episodes in a background thread, allowing the robot/teleoperator to be reset immediately after data collection without waiting for video encoding and stats computation.
Key Changes
- Added
AsyncEpisodeSaverclass that uses a Queue and background Thread to save episodes asynchronously - Added
async_savingboolean flag toRecordConfigto enable/disable the feature - Modified the
record()function to conditionally use async saving based on the configuration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| from queue import Queue | ||
| from threading import Thread |
Copilot
AI
Dec 1, 2025
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.
The new AsyncEpisodeSaver class and async_saving feature lack test coverage. The existing test_record_and_resume in tests/test_control_robot.py should be extended to test async_saving=True to ensure the feature works correctly and doesn't break existing functionality. Consider adding tests that verify: 1) episodes are saved correctly with async_saving enabled, 2) wait_for_stop() completes all pending saves, and 3) error handling works properly.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Naoya Takenaka <[email protected]>
…ng `episode_index` as a NumPy array.
… data on failure.
What this does
This PR implements asynchronous episode saving to reduce the delay (e.g., videos encoding, stats caluculating) between episodes during recording. It adds a new
AsyncEpisodeSaverclass and anasync_savingflag toRecordConfig. When enabled, the episode saving process happens in a separate thread, allowing the robot/teleoperator to be reset or ready for the next episode immediately.How it was tested
I tested this on a real SO-101 using
lerobot-recordwith--async-saving=true. I confirmed that the data was collected and saved correctly.