Skip to content

LeRobot Configuration

SUMMARY

Configure dataset reading with LeRobotDatasetConfig, recording with LeRobotDatasetWriterConfig, and video output with dedicated RGB and depth encoder configurations.

Choose a Configuration

ConfigurationUse
LeRobotDatasetConfigLoading, episode selection, temporal sampling, transforms, and decoding.
LeRobotDatasetWriterConfigRecording, buffering, streaming encoding, and shard sizes.
RGBEncoderConfigRGB video codec, quality, pixel format, and performance.
DepthEncoderConfigDepth video codec, quality, pixel format, range, and logarithmic encoding.

Dataset Read Configuration

Use LeRobotDatasetConfig when loading an existing dataset.

Parameter Configuration

KeyTypeDefaultDescription
rootstr | Path | NoneNoneLocal dataset root.
revisionstr | NoneNoneHub branch, tag, or commit.
tolerance_sfloat1e-4Timestamp synchronization tolerance.
video_backendstr | NoneNoneVideo decoder backend.
depth_output_unitstr"mm"Decoded depth unit, "m" or "mm".
episode_indiceslist[int] | NoneNoneEpisodes to load.
episode_filterCallable | NoneNoneMetadata predicate applied to candidate episodes.
image_transformsCallable | NoneNoneTransform applied after image decoding.
delta_timestampsdict[str, list[float]] | NoneNoneTemporal offsets requested per feature.
force_cache_syncboolFalseRefresh cached Hub data.
return_uint8boolFalseReturn visual values as uint8 rather than normalized tensors.
download_videosboolTrueDownload video assets when fetching from the Hub.
tokenstr | bool | NoneNoneHugging Face authentication token behavior.

Example

python
from telekinesis.dataengine import datasets

config = datasets.LeRobotDatasetConfig(
    episode_indices=[0, 1],
    delta_timestamps={"action": [0.0, 0.1, 0.2]},
    depth_output_unit="m",
)

dataset = datasets.LeRobotDataset(
    repo_id="lerobot/pusht",
    local_path="results/lerobot/pusht",
    config=config,
)

Dataset Writer Configuration

Pass LeRobotDatasetWriterConfig to LeRobotDatasetLogger when recording episodes.

Parameter Configuration

KeyTypeDefaultDescription
tolerance_sfloat1e-4Timestamp tolerance.
image_writer_processesint0Async image-writer processes.
image_writer_threadsint0Async image-writer threads.
video_backendstr | NoneNoneVideo backend.
batch_encoding_sizeint1Episodes accumulated before video encoding.
rgb_encoderRGBEncoderConfig | NoneNoneRGB codec configuration.
depth_encoderDepthEncoderConfig | NoneNoneDepth codec and range configuration.
streaming_encodingboolFalseEncode camera frames during capture.
encoder_queue_maxsizeint30Buffered frames per streaming camera.
encoder_threadsint | NoneNoneGlobal encoding thread count.
metadata_buffer_sizeint10Episode metadata records buffered before flush.
max_video_files_size_in_mbint | NoneNoneMaximum video shard size.
max_data_files_size_in_mbint | NoneNoneMaximum Parquet shard size.

Example

python
from telekinesis.dataengine import data_loggers, datasets

write_config = datasets.LeRobotDatasetWriterConfig(
    tolerance_s=1e-4,
    streaming_encoding=True,
    encoder_queue_maxsize=60,
)

logger = data_loggers.LeRobotDatasetLogger(
    repo_id="user/my_dataset",
    local_path="results/user/my_dataset",
    mode="create",
    fps=30,
    features=features,
    config=write_config,
)

RGB Encoder Configuration

Use RGBEncoderConfig to control RGB video encoding.

INFO

Please note this in in active development. And the parameter will be updated freqeuntly.

Parameter Configuration

KeyTypeDefaultDescription
vcodecstr"libsvtav1"Video codec, or "auto" for automatic selection.
pix_fmtstr"yuv420p"Encoded pixel format.
gint | None2Group-of-pictures size.
crfint | float | None30Quality level; lower values generally increase quality and file size.
presetint | str | NoneCodec-specificEncoding speed and quality preset.
fast_decodeint0Codec-specific fast-decoding tuning.
video_backendstr"pyav"Encoding backend.
extra_optionsdict[str, Any]{}Additional codec options.

Example

python
from telekinesis.dataengine import datasets
from telekinesis.dataengine.datasets.lerobot.configs import RGBEncoderConfig

rgb_encoder = RGBEncoderConfig(
    vcodec="libsvtav1",
    pix_fmt="yuv420p",
    crf=24,
)

write_config = datasets.LeRobotDatasetWriterConfig(
    rgb_encoder=rgb_encoder,
)

Depth Encoder Configuration

Use DepthEncoderConfig to control depth video encoding and represented depth range.

INFO

Please note this in in active development. And the parameter will be updated freqeuntly.

Parameter Configuration

KeyTypeDefaultDescription
vcodecstr"hevc"Video codec, or "auto" for automatic selection.
pix_fmtstr"gray12le"Encoded pixel format.
gint | None2Group-of-pictures size.
crfint | float | None30Quality level; lower values generally increase quality and file size.
presetint | str | NoneCodec-specificEncoding speed and quality preset.
fast_decodeint0Codec-specific fast-decoding tuning.
video_backendstr"pyav"Encoding backend.
extra_optionsdict[str, Any]{}Additional codec options.
depth_minfloat0.01Minimum represented depth.
depth_maxfloat10.0Maximum represented depth.
shiftfloat3.5Shift used by depth encoding.
use_logboolTrueEncode depth values logarithmically.

Example

python
from telekinesis.dataengine import datasets
from telekinesis.dataengine.datasets.lerobot.configs import DepthEncoderConfig

depth_encoder = DepthEncoderConfig(
    vcodec="hevc",
    pix_fmt="gray12le",
    crf=24,
    depth_min=0.01,
    depth_max=10.0,
    use_log=True,
)

write_config = datasets.LeRobotDatasetWriterConfig(
    depth_encoder=depth_encoder,
)

Next Steps