RLDS 与 Lance 互转
更新时间:2026-11-23
简介
RLDS / TFDS(如 Open X-Embodiment)数据集与「一帧一行」Lance 表之间的双向转换,以 LeRobot v3.0 为中转。Lance 表结构与「LeRobot 与 Lance 互转」相同;反向输出 LeRobot v3.0,不回写 .tfrecord。
功能描述
- to_lance:
dataset_name填 TFDS builder 名,fps / robot_type 不传时从 OXE 配置推断 - 只转
train切分,键名含image/rgb的观测作为相机 - from_lance:行为同「LeRobot 与 Lance 互转」的 from_lance
算子参数
输入
| 输入 | 含义 |
|---|---|
| input_col | to_lance:TFDS data_dir(本地 / bosfs);from_lance:Lance 表路径 |
| output_col | to_lance:Lance 表路径;from_lance:LeRobot 输出目录 |
输出
| 输出 | 含义 |
|---|---|
| out | 输出位置(large_string) |
参数
| 参数名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| direction | str | "to_lance" | to_lance / from_lance |
| dataset_name | str | "dataset" | TFDS builder 名 |
| version | str | "" | TFDS 版本,留空自动选择 |
| repo_id | str 或 None | None | lerobot repo_id |
| video_root | str 或 None | None | upload_bos 模式的视频发布根 |
| video_mode | str | "reference" | reference / upload_bos |
| fps | int 或 None | None | 帧率,留空自动推断 |
| robot_type | str 或 None | None | 机器人类型,留空自动推断 |
| use_videos | bool | True | 相机是否存成视频 |
| vcodec | str | "h264" | 视频编码器 |
| encoder_threads | int 或 None | None | from_lance 编码线程数 |
| staging_dir | str 或 None | None | from_lance 从 BOS 取 mp4 的暂存目录 |
| tmp_root | str 或 None | None | to_lance 的 LeRobot 中转目录 |
调用示例
Python
1from __future__ import annotations
2
3import os
4
5import daft
6from daft import col
7
8from daft.aihc.common.udf import aihc_udf
9from daft.aihc.functions.embodied.rlds_lance_udf import RldsLanceConverter
10
11if __name__ == "__main__":
12 if os.getenv("DAFT_RUNNER", "native") == "ray":
13 import ray
14 ray.init(dashboard_host="0.0.0.0", ignore_reinit_error=True)
15 daft.set_runner_ray()
16 daft.set_execution_config(actor_udf_ready_timeout=6000, min_cpu_per_task=0)
17
18ds = daft.from_pydict({
19 "src": ["/data/oxe"],
20 "dst": ["/data/lake/cmu_play_fusion.lance"],
21 })
22 ds = ds.with_column(
23 "out",
24 aihc_udf(
25 RldsLanceConverter,
26 construct_args={
27 "direction": "to_lance",
28 "dataset_name": "cmu_play_fusion",
29 "tmp_root": "/data/tmp/cmu_play_fusion_lerobot",
30 },
31 num_cpus=1,
32 num_gpus=0,
33 concurrency=1,
34 batch_size=1,
35 )(col("src"), col("dst")),
36 )
37 ds.show()
评价此篇文章
