rerun-lerobot
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRerun LeRobot ingestion
Rerun LeRobot 数据导入
Rerun has a built-in LeRobot importer: point (or the viewer, or on the CLI) at the dataset directory and it ingests episodes, camera videos, and state/action tables with no conversion code.
There is no chunk-level ; the chunk-processing route is to import first, then reprocess the resulting RRD with .
log_file_from_pathrerun <dir>LeRobotReaderRrdReaderThe download step needs
.
huggingface_hubRerun 内置了LeRobot 导入器:只需将 (或查看器,或CLI命令 )指向数据集目录,即可无需转换代码直接导入剧集、摄像头视频以及状态/动作表。
目前没有针对块级别的 ;如需进行块处理,需先导入数据集,再使用 重新处理生成的RRD文件。
log_file_from_pathrerun <dir>LeRobotReaderRrdReader下载步骤需要依赖 。
huggingface_hubStep 1: dataset -> one combined RRD
步骤1:将数据集转换为单个合并RRD文件
python
from huggingface_hub import snapshot_download
import rerun as rr
dataset_dir = snapshot_download(repo_id="rerun/so101-pick-and-place", repo_type="dataset", local_dir=dest)
with rr.RecordingStream("rerun_example_lerobot") as rec:
rec.save(str(combined_rrd))
rec.log_file_from_path(str(dataset_dir)) # the built-in importerThe importer emits one recording per episode (recording ids like ), plus a metadata-only root recording, all into the single RRD.
episode_1rr.RecordingStreamlog_file_from_pathRecordingStreamrr.logRrdReaderrerun-chunk-processingpython
from huggingface_hub import snapshot_download
import rerun as rr
dataset_dir = snapshot_download(repo_id="rerun/so101-pick-and-place", repo_type="dataset", local_dir=dest)
with rr.RecordingStream("rerun_example_lerobot") as rec:
rec.save(str(combined_rrd))
rec.log_file_from_path(str(dataset_dir)) # 内置导入器该导入器会为每个剧集生成一个录制文件(录制ID类似 ),再加上一个仅包含元数据的根录制文件,所有内容都存入单个RRD文件中。
episode_1此处的 + 是导入器启动流程——这是在导入流水线中使用 的正确场景(它驱动内置导入器,而非逐消息日志记录)。不要将其推广到逐消息调用 的循环中;导入完成后的所有操作,都需使用 + 透镜重新处理RRD文件(详见 :块API vs 日志API)。
rr.RecordingStreamlog_file_from_pathRecordingStreamrr.logRrdReaderrerun-chunk-processingStep 2: split into per-episode RRDs
步骤2:分割为单剧集RRD文件
Catalog segments are one-recording-per-file, and becomes the segment id on registration.
Split with :
recording_idRrdReaderpython
reader = rr.experimental.RrdReader(str(combined_rrd))
for entry in reader.recordings():
store = reader.store(store=entry)
if not store.schema().entity_paths(): # skip the metadata-only root recording
continue
episode_id = zero_pad(entry.recording_id) # episode_1 -> episode_00001
with rr.RecordingStream("rerun_example_lerobot", recording_id=episode_id, send_properties=False) as rec:
rec.save(str(rrd_dir / f"{episode_id}.rrd"))
rec.send_chunks(store)Two non-obvious moves:
- Zero-pad the episode id. sorts before
episode_10lexicographically; segment tables and viewers sort lexicographically. Pad to a fixed width when re-assigningepisode_2.recording_id - on the new stream, so the copy doesn't inject fresh recording properties on top of the copied chunks.
send_properties=False
send_chunksrecording_idIf episodes need cleanup (drop topics, fix data, add derived components), run the store through lenses between read and write: then (see ).
reader.stream(store=entry).drop(...).lenses(...)collect().write_rrd(..., recording_id=episode_id)rerun-chunk-processingComputed layers and per-episode properties then follow the standard patterns in (layer must equal the episode segment id).
rerun-data-modelrecording_id目录中的片段是“单录制文件对应单个片段”, 会在注册时成为片段ID。
使用 进行分割:
recording_idRrdReaderpython
reader = rr.experimental.RrdReader(str(combined_rrd))
for entry in reader.recordings():
store = reader.store(store=entry)
if not store.schema().entity_paths(): # 跳过仅含元数据的根录制文件
continue
episode_id = zero_pad(entry.recording_id) # episode_1 -> episode_00001
with rr.RecordingStream("rerun_example_lerobot", recording_id=episode_id, send_properties=False) as rec:
rec.save(str(rrd_dir / f"{episode_id}.rrd"))
rec.send_chunks(store)有两个容易忽略的细节:
- 为剧集ID补零。按字典序排序时,会排在
episode_10之前;片段表和查看器均按字典序排序。重新分配episode_2时,需将其补零至固定长度。recording_id - 新流设置 ,这样在复制块时不会在已复制的块上注入新的录制属性。
send_properties=False
send_chunksrecording_id如果需要清理剧集(删除主题、修复数据、添加派生组件),可在读取和写入之间通过透镜处理存储: 然后调用 (详见 )。
reader.stream(store=entry).drop(...).lenses(...)collect().write_rrd(..., recording_id=episode_id)rerun-chunk-processing计算层和单剧集属性需遵循 中的标准模式(层的 必须与剧集片段ID一致)。
rerun-data-modelrecording_idGotchas
注意事项
- must target the dataset root directory, not a file inside it.
log_file_from_path - Unpadded episode ids sort incorrectly downstream; pad before registering.
- The combined RRD contains a metadata-only root recording; skip stores with no entity paths or you register an empty segment.
- 必须指向数据集根目录,而非目录内的单个文件。
log_file_from_path - 未补零的剧集ID在后续流程中排序会出错;注册前需补零。
- 合并后的RRD文件包含一个仅含元数据的根录制文件;需跳过没有实体路径的存储,否则会注册一个空片段。
References
参考资料
https://github.com/rerun-io/rerun/tree/main/examples/python/dataloader(download → import → split → register, complete and runnable) andprepare_dataset.py(training-side consumption viatrain.py)rerun.experimental.dataloader
- 中的
https://github.com/rerun-io/rerun/tree/main/examples/python/dataloader(完整可运行的下载→导入→分割→注册流程)和prepare_dataset.py(通过train.py在训练侧消费数据) ",rerun.experimental.dataloader