Skip to content

feat(datasets): delete episodes from a local dataset - #143

Draft
ravediamond wants to merge 2 commits into
huggingface:mainfrom
ravediamond:feat/delete-episodes
Draft

ravediamond wants to merge 2 commits into
huggingface:mainfrom
ravediamond:feat/delete-episodes

Conversation

@ravediamond

Copy link
Copy Markdown
Contributor

Builds on #142; only the last commit (feat(datasets): delete episodes from a local dataset) is new. Draft until #142 lands, then I'll rebase.

Problem

#142 lets you set bad takes aside by moving them into a new dataset. When a take is plainly unusable (arm out of frame, recording started too early), keeping a copy just leaves a dataset to clean up by hand later.

Approach

A "Delete episodes" button next to "Move episodes". It opens the same dialog (renamed EpisodesDialog, with a mode), without the name field and with a red button. The text says the episodes are removed for good and points to Move to keep a copy.

  • POST /datasets/delete-episodes runs LeRobot's delete_episodes into a staging dir and swaps it in for the source, so a failure leaves the source untouched. The episodes left are renumbered.
  • It shares the checks and the swap with move (_load_for_episode_edit, _swap_in_staged_copy): 409 while recording, 422 for empty or negative indices, 400 for out-of-range indices or deleting every episode.

If this is one button too many for the browser, I'm happy to drop it and keep only move.

Testing

  • pytest: a real delete on a LeRobot-written dataset, invalid requests, a failure mid-delete that leaves the source untouched, the 409 while recording, request validation.
  • vitest (delete mode of the dialog), eslint, npm run build, pre-commit run --all-files.
  • Drove both dialogs end to end in headless Chromium on a small recorded video dataset: the deleted episode is gone, the rest renumbered with their own frames, no staging dir left behind.

Tested on Linux (Jetson Orin, aarch64) only. Not tested on macOS, Windows, or a real SO-101 dataset.

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