Overview
LeRobotDataset is LeRobot’s standardized format for storing, sharing, and loading robot learning data. It provides:- Efficient storage: Chunked parquet files and compressed videos
- Hub integration: Built-in support for Hugging Face Hub
- Flexible access: Load full datasets or individual episodes
- Rich metadata: Statistics, task labels, and feature descriptions
Dataset Structure
A LeRobotDataset has the following directory structure:src/lerobot/datasets/lerobot_dataset.py:617
Creating a Dataset
Use theLeRobotDataset.create() classmethod to initialize a new dataset:
src/lerobot/datasets/lerobot_dataset.py:499
Recording Episodes
Adding Frames
Record data frame-by-frame:src/lerobot/datasets/lerobot_dataset.py:1171
Saving Episodes
After collecting all frames, save the episode:- Encodes video frames (if using videos)
- Writes data to parquet files
- Computes and stores episode statistics
- Updates dataset metadata
src/lerobot/datasets/lerobot_dataset.py:1200
Finalizing
Always callfinalize() when done recording:
src/lerobot/datasets/lerobot_dataset.py:1131
Loading a Dataset
From Local Disk
From Hugging Face Hub
~/.cache/huggingface/lerobot/.
Source: src/lerobot/datasets/lerobot_dataset.py:566
Loading Specific Episodes
src/lerobot/datasets/lerobot_dataset.py:571
Accessing Data
LeRobotDataset inherits fromtorch.utils.data.Dataset, so it works with PyTorch DataLoaders:
Single Frame Access
src/lerobot/datasets/lerobot_dataset.py:1082
Dataset Properties
Metadata
src/lerobot/datasets/lerobot_dataset.py:939
Statistics
Datasets include normalization statistics computed from the data:src/lerobot/datasets/lerobot_dataset.py:169
Tasks
View all tasks in the dataset:src/lerobot/datasets/lerobot_dataset.py:166
Delta Timestamps
Load temporal sequences of observations/actions:src/lerobot/datasets/lerobot_dataset.py:676
Image Transforms
Apply transforms to visual modalities:src/lerobot/datasets/lerobot_dataset.py:674
Pushing to Hub
Share your dataset on Hugging Face Hub:- Create a dataset repository (if it doesn’t exist)
- Upload all parquet files and videos
- Generate a dataset card with metadata
- Tag the release with the codebase version
src/lerobot/datasets/lerobot_dataset.py:796
Video Encoding
LeRobotDataset supports multiple video encoding options:Codec Selection
src/lerobot/datasets/lerobot_dataset.py:696
Streaming Encoding
Encode videos in real-time during recording for fastersave_episode():
src/lerobot/datasets/lerobot_dataset.py:699
Dataset Info
Theinfo.json file contains essential dataset configuration:
src/lerobot/datasets/lerobot_dataset.py:163
Best Practices
Version compatibility: Datasets created with v3.0 are not compatible with older versions of LeRobot. Use the conversion script if needed.
Next Steps
- Learn how to use datasets with Policies
- Understand Processors for data normalization
- Explore the Robot interface for recording data