feat(dataset tools): add trim_episode_start operation#3096
Open
feat(dataset tools): add trim_episode_start operation#3096
Conversation
Add a dataset edit operation to trim the first N seconds from episodes while rebuilding frame and episode indices and metadata consistently. Skip episodes that are too short to trim and cover parsing plus metadata invariants with focused tests. Made-with: Cursor
Member
|
It might be worth checking this work as well since it has the same intended use: #3024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
feat(datasets): add trim_episode_start edit operation
Type / Scope
Summary / Motivation
This PR adds a new dataset edit operation,
trim_episode_start, to remove the first N seconds from episodes while keeping dataset invariants intact (frame indices, global indices, episode metadata, and stats). This is useful for removing startup/warm-up frames from collected data without manual dataset surgery. It also skips episodes that are too short to trim, so one short episode does not fail the full run.Related issues
What changed
trim_episode_start(...)insrc/lerobot/datasets/dataset_tools.py.trim_episode_startoperation wiring insrc/lerobot/scripts/lerobot_edit_dataset.py.tests/scripts/test_edit_dataset_parsing.py.tests/datasets/test_dataset_tools.py:Breaking changes: none.
How was this tested (or how to run locally)
Tests added:
tests/datasets/test_dataset_tools.pytests/scripts/test_edit_dataset_parsing.pySyntax checks run:
Suggested local test run:
Example CLI usage:
Checklist (required before merge)
pre-commit run -a)pytest)Reviewer notes
trim_episode_startindex/metadata invariants and the skip-too-short behavior.