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
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.Usage Examples
Delete Episodes
Remove specific episodes from a dataset:pusht_old and modifies the dataset in-place.
Save to New Dataset
Split Dataset
Split into train/val sets by fractions:lerobot/pusht_train(80% of episodes)lerobot/pusht_val(20% of episodes)
Split by Episode Indices
Custom Output Location
/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: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:Show Feature Details
Video Encoding Options
Forconvert_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
Whennew_repo_id and new_root are not specified:
- Creates backup:
pusht_old/ - Modifies original dataset location
- Use for permanent changes
New Dataset Creation
Whennew_repo_id or new_root is specified:
- Original dataset unchanged
- Creates new dataset at
new_rootor$HF_LEROBOT_HOME/new_repo_id - Use when preserving original
Path Semantics
Default Paths
Explicit Paths
Programmatic Usage
Best Practices
- Backup First: Always backup before in-place modifications
- Test on Subset: Test operations on small datasets first
- Verify Output: Check result before pushing to Hub
- Use New Dataset: Prefer
new_repo_idover in-place for safety - Document Changes: Record what operations were performed
See Also
- LeRobotDataset - Dataset format and structure
- lerobot-record - Record new datasets
- lerobot-dataset-viz - Visualize datasets