Skip to main content
The lerobot-edit-dataset command provides tools for modifying datasets including deleting episodes, splitting, merging, removing features, modifying tasks, and converting image datasets to video format.

Command

Location: src/lerobot/scripts/lerobot_edit_dataset.py

Overview

Supported operations:
  • delete_episodes: Remove specific episodes from dataset
  • split: Split dataset into train/val/test sets
  • merge: Combine multiple datasets into one
  • remove_feature: Delete camera or sensor features
  • modify_tasks: Update task descriptions
  • convert_image_to_video: Convert image dataset to video format
  • info: Display dataset statistics

Key Options

Dataset Options

str
Input dataset repository ID. Required for all operations except merge.
str
Local path to input dataset. Defaults to $HF_LEROBOT_HOME/{repo_id}.
str
Output dataset repository ID. Required for merge, optional for others.
str
Local path for output dataset. Defaults to $HF_LEROBOT_HOME/{new_repo_id}.
bool
default:"false"
Upload result to Hugging Face Hub.

Operation Configuration

str
required
Operation to perform: delete_episodes, split, merge, remove_feature, modify_tasks, convert_image_to_video, or info.
Additional options depend on operation type (see examples below).

Usage Examples

Delete Episodes

Remove specific episodes from a dataset:
This creates a backup at pusht_old and modifies the dataset in-place.

Save to New Dataset

Split Dataset

Split into train/val sets by fractions:
Creates:
  • lerobot/pusht_train (80% of episodes)
  • lerobot/pusht_val (20% of episodes)

Split by Episode Indices

Custom Output Location

Creates splits in /path/to/splits/train, /path/to/splits/val, /path/to/splits/test.

Merge Datasets

Combine multiple datasets:

Merge from Local Paths

Merge and Push to Hub

Remove Feature

Delete camera or sensor features:
Removes the observation.images.top camera from the dataset.

Remove Multiple Features

Modify Tasks

WARNING: Modifies dataset in-place! Back up first.

Set Single Task for All Episodes

Set Different Tasks per Episode

Set Default with Overrides

Convert Image to Video

Convert image-based dataset to video format for smaller storage:

Custom Video Settings

Convert and Push to Hub

Dataset Info

Display dataset statistics:
Output:

Show Feature Details

Shows full feature schema in JSON format.

Video Encoding Options

For convert_image_to_video operation:
str
default:"libsvtav1"
Video codec: h264, hevc, libsvtav1, h264_nvenc, h264_videotoolbox, etc.
str
default:"yuv420p"
Pixel format for compatibility.
int
default:"2"
GOP size (keyframe interval).
int
default:"30"
Constant rate factor (lower = higher quality, larger file).
int
default:"4"
Number of parallel encoding workers.

In-Place vs New Dataset

In-Place Modification

When new_repo_id and new_root are not specified:
  • Creates backup: pusht_old/
  • Modifies original dataset location
  • Use for permanent changes

New Dataset Creation

When new_repo_id or new_root is specified:
  • Original dataset unchanged
  • Creates new dataset at new_root or $HF_LEROBOT_HOME/new_repo_id
  • Use when preserving original

Path Semantics

Default Paths

Explicit Paths

Programmatic Usage

Best Practices

  1. Backup First: Always backup before in-place modifications
  2. Test on Subset: Test operations on small datasets first
  3. Verify Output: Check result before pushing to Hub
  4. Use New Dataset: Prefer new_repo_id over in-place for safety
  5. Document Changes: Record what operations were performed

See Also