Skip to main content

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:
Source: src/lerobot/datasets/lerobot_dataset.py:617

Creating a Dataset

Use the LeRobotDataset.create() classmethod to initialize a new dataset:
Source: src/lerobot/datasets/lerobot_dataset.py:499

Recording Episodes

Adding Frames

Record data frame-by-frame:
Source: src/lerobot/datasets/lerobot_dataset.py:1171

Saving Episodes

After collecting all frames, save the episode:
This method:
  1. Encodes video frames (if using videos)
  2. Writes data to parquet files
  3. Computes and stores episode statistics
  4. Updates dataset metadata
Source: src/lerobot/datasets/lerobot_dataset.py:1200

Finalizing

Always call finalize() when done recording:
This ensures all parquet files are properly closed and metadata is written. Source: src/lerobot/datasets/lerobot_dataset.py:1131

Loading a Dataset

From Local Disk

From Hugging Face Hub

The dataset will be automatically downloaded to ~/.cache/huggingface/lerobot/. Source: src/lerobot/datasets/lerobot_dataset.py:566

Loading Specific Episodes

Source: src/lerobot/datasets/lerobot_dataset.py:571

Accessing Data

LeRobotDataset inherits from torch.utils.data.Dataset, so it works with PyTorch DataLoaders:

Single Frame Access

Source: src/lerobot/datasets/lerobot_dataset.py:1082

Dataset Properties

Metadata

Source: src/lerobot/datasets/lerobot_dataset.py:939

Statistics

Datasets include normalization statistics computed from the data:
Source: src/lerobot/datasets/lerobot_dataset.py:169

Tasks

View all tasks in the dataset:
Source: src/lerobot/datasets/lerobot_dataset.py:166

Delta Timestamps

Load temporal sequences of observations/actions:
Source: src/lerobot/datasets/lerobot_dataset.py:676

Image Transforms

Apply transforms to visual modalities:
Source: src/lerobot/datasets/lerobot_dataset.py:674

Pushing to Hub

Share your dataset on Hugging Face Hub:
This will:
  1. Create a dataset repository (if it doesn’t exist)
  2. Upload all parquet files and videos
  3. Generate a dataset card with metadata
  4. Tag the release with the codebase version
Source: src/lerobot/datasets/lerobot_dataset.py:796

Video Encoding

LeRobotDataset supports multiple video encoding options:

Codec Selection

Source: src/lerobot/datasets/lerobot_dataset.py:696

Streaming Encoding

Encode videos in real-time during recording for faster save_episode():
Source: src/lerobot/datasets/lerobot_dataset.py:699

Dataset Info

The info.json file contains essential dataset configuration:
Source: src/lerobot/datasets/lerobot_dataset.py:163

Best Practices

Batch Encoding: Set batch_encoding_size > 1 to encode multiple episodes in parallel, reducing total recording time.
Always finalize: Failing to call dataset.finalize() will result in corrupted parquet files that cannot be loaded.
Version compatibility: Datasets created with v3.0 are not compatible with older versions of LeRobot. Use the conversion script if needed.

Next Steps