Create a LeRobot Dataset
SUMMARY
Use LeRobotDataset.create() to define a new LeRobot v3 dataset and return a writable dataset ready to receive frames and episodes.
Method
Use LeRobotDataset.create() to initialize a writable dataset:
from telekinesis.dataengine import datasets
dataset = datasets.LeRobotDataset.create(
repo_id="user/my_dataset",
local_path="results/user/my_dataset",
fps=30,
features=features,
)This is the lower-level dataset creation workflow. After creation, you can write frames and episodes directly to the dataset or use LeRobotDatasetLogger when you want a managed recording lifecycle.
Parameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
repo_id | str | required | Repository identifier, usually organization/dataset. |
fps | int | required | Capture frame rate written to metadata. |
features | dict | required | Feature names mapped to dtype, shape, and dimension names. |
local_path | str | Path | None | None | Dataset directory; otherwise uses the default LeRobot home. |
robot_type | str | None | None | Robot name stored in metadata. |
use_videos | bool | True | Encode visual streams as video instead of individual images. |
Writer and encoder tuning parameters are listed in Configuration.
Feature Schema
features maps each recorded feature key to its data type, shape, and optional dimension names. Every frame added to the dataset must match this schema.
features = {
"observation.images.camera1": {
"dtype": "video",
"shape": [64, 64, 3],
"names": ["height", "width", "channels"],
},
"observation.state": {
"dtype": "float32",
"shape": [6],
"names": None,
},
"action": {
"dtype": "float32",
"shape": [6],
"names": None,
},
}See the Feature Schema reference for complete understanding and naming conventions.
Example
"""Example script demonstrating how to create a LeRobot dataset using the Telekinesis Data Engine."""
from pathlib import Path
import shutil
from loguru import logger
from telekinesis.dataengine import datasets
def create_lerobot_dataset_example():
"""Create a new writable LeRobot dataset."""
# 1. Define the dataset identity, local storage path, and features.
repo_id = "user/my_create_example"
local_path = (
Path(__file__).resolve().parent.parent.parent.parent
/ "results"
/ repo_id
)
# Remove any previous example dataset so this script can be rerun.
if local_path.exists():
shutil.rmtree(local_path)
features = {
"observation.images.camera1": {
"dtype": "video",
"shape": [480, 640, 3],
"names": ["height", "width", "channels"],
},
"observation.depths.camera1": {
"dtype": "depth",
"shape": [480, 640],
"names": ["height", "width"],
},
"observation.state": {
"dtype": "float32",
"shape": [6],
"names": [
"shoulder_pan_joint.pos",
"shoulder_lift_joint.pos",
"elbow_joint.pos",
"wrist_1_joint.pos",
"wrist_2_joint.pos",
"wrist_3_joint.pos",
],
},
"action": {
"dtype": "float32",
"shape": [6],
"names": [
"shoulder_pan_joint.pos",
"shoulder_lift_joint.pos",
"elbow_joint.pos",
"wrist_1_joint.pos",
"wrist_2_joint.pos",
"wrist_3_joint.pos",
],
},
"language_persistent": {
"dtype": "text",
"shape": [],
"names": None,
},
}
# 2. Create the LeRobot dataset.
dataset = datasets.LeRobotDataset.create(
repo_id=repo_id,
local_path=local_path,
fps=30,
features=features,
robot_type="dummy_ur10e",
use_videos=True,
)
logger.info("LeRobot dataset created successfully.")
logger.info(dataset)
logger.info(f"Local path: {local_path}")
# 3. Finalize the dataset when no more data will be written.
dataset.finalize()
return dataset
if __name__ == "__main__":
create_lerobot_dataset_example()Next Steps
Write to a LeRobot Dataset
Add frames, save episodes, and finalize the writable dataset.
Write data →Configure Dataset Writing
Configure buffering, video encoding, streaming, and shard sizes.
View configuration →Record with the Dataset Logger
Use the managed episode lifecycle for live robot data collection.
Start recording →Inspect Dataset Metadata
Review the dataset schema, frame rate, episodes, statistics, and storage metadata.
Inspect metadata →