Skip to content

Conversation

@0xNOY
Copy link

@0xNOY 0xNOY commented Dec 1, 2025

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 AsyncEpisodeSaver class and an async_saving flag to RecordConfig. 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-record with --async-saving=true. I confirmed that the data was collected and saved correctly.

Copilot AI review requested due to automatic review settings December 1, 2025 09:33
@0xNOY 0xNOY force-pushed the feat/async_episode_saving branch from fb0eb7e to 86e8d8f Compare December 1, 2025 09:35
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 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 AsyncEpisodeSaver class that uses a Queue and background Thread to save episodes asynchronously
  • Added async_saving boolean flag to RecordConfig to 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.

Comment on lines +66 to +67
from queue import Queue
from threading import Thread
Copy link

Copilot AI Dec 1, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant