LeRobot 如何用 lerobot-annotate 为数据集自动填充语言标注列?
发布时间:2026/9/13 16:45:23 作者:尧图编辑部 阅读量:1,286

LeRobot 如何用 lerobot-annotate 为数据集自动填充语言标注列【免费下载链接】lerobot LeRobot: Making AI for Robotics more accessible with end-to-end learning项目地址: https://gitcode.com/GitHub_Trending/le/lerobotlerobot-annotate是 LeRobot 提供的标注管线它用视觉语言模型VLM逐集观看每个 episode 的视频把自然语言标注直接写回数据集的data/chunk-*/file-*.parquet填充language_persistent和language_events两个语言列。管线包含plan、interjections、vqa三个模块共享同一个 VLM 服务每个模块先把原始输出暂存到root/.annotate_staging/经StagingValidator校验后由 writer 原地重写数据集的 parquet 分片同时把语言特征和say工具 schema 同步进meta/info.json。适用前提数据集为 LeRobot v3.1 格式且包含observation.images.*相机视频机器上能起一个 vLLM 服务需要 GPU或使用 Hugging Face Jobs 远程 GPU。本文基于仓库中 annotation_pipeline.mdx 与 lerobot_annotate.py 的说明。准备条件按 安装文档 配置环境Python 3.12 环境conda 或 uv 均可# conda 方式 conda create -y -n lerobot python3.12 conda activate lerobot # 或 uv 方式 uv python install 3.12 uv venv --python 3.12 source .venv/bin/activate安装ffmpeg视频解码依赖。conda 环境用conda install ffmpeg -c conda-forge所有 PyTorch 版本可用系统级ffmpeg仅在 PyTorch 2.10 时受支持。安装 LeRobot。标注脚本属于核心 CLIpyproject.toml 中声明lerobot-annotatelerobot.scripts.lerobot_annotate:main若从 PyPI 安装建议带datasetextradatasets、av、torchcodec、jsonlines因为推送结果到 Hub 时会用到datasetspip install lerobot[dataset] # 或从源码 git clone https://github.com/huggingface/lerobot.git cd lerobot pip install -e .[all]数据集本身二选一本地目录--root指向它或 Hub 上的--repo_id--root未设置时会自动下载到本地缓存。本地执行标注最简命令本地数据集管线会自动拉起 vLLM 服务并逐阶段执行uv run lerobot-annotate \ --root/path/to/dataset \ --vlm.model_idQwen/Qwen2.5-VL-7B-Instruct/path/to/dataset替换为你的数据集根目录含meta/、data/的 LeRobot 数据集。--vlm.model_id指定要服务和提示的模型默认值是Qwen/Qwen3.6-27B小显存机器可换成上例的 7B 模型。几个常用参数参数默认用途--only_episodes全部只标注指定 episode 索引适合先做小规模试跑--seed1729固定 interjection 时间戳与 VQA 问题类型的随机种子--vlm.auto_servetruefalse表示不自动起服务、直接连--vlm.api_base默认http://localhost:8000/v1--vlm.serve_ready_timeout_s600.0vLLM 就绪超时大模型加载慢时调高--new_repo_id/--push_to_hub— /false标注后把结果推送到新仓库源仓库不动推送需要--repo_id或--new_repo_id至少一个注意本地运行时结果直接写回--root指向的目录原地重写 parquet 分片并更新meta/info.json只有 Hub 路径 --push_to_hub才是结果另存。建议先试跑uv run lerobot-annotate \ --root/path/to/dataset \ --only_episodes0 \ --vlm.model_idQwen/Qwen2.5-VL-7B-Instruct结果验证运行结束时日志会给出每阶段统计和分片数量判断顺序如下终端汇总。脚本会打印[annotate] N episodes total、每个模块的phasename processed... skipped...、validator: summary最后wrote N shard(s)与annotate: wrote N shard(s)见 lerobot_annotate.py 中的日志逻辑。校验出现 warning 时会逐条打印。确认 parquet 里出现了两个语言列python -c import pyarrow.parquet as pq; print(pq.read_table(/path/to/dataset/data/chunk-000/file-000.parquet).column_names)分片列名中应包含language_persistent与language_events。 3. 检查meta/info.jsonfeatures中新增了语言列特征tools列表中包含规范sayschema管线会保留你预先声明的其他工具。工具目录位于meta/info.json[tools]而非 parquet 列详见 Tools 文档。 4. 中间产物在root/.annotate_staging/episode_{N:06d}/module.jsonl可查看各模块的原始输出。如果日志出现the vqa module is enabled but no cameras were resolved — it will produce zero VQA rows的警告说明未解析到任何相机检查meta/info.json的observation.images.*特征或显式传--vlm.camera_keykey指定相机。写入前StagingValidator会检查事件行必须精确落在真实帧时间戳上、speech/interjection 配对不能孤立、plan在每个 interjection 时间戳被刷新、memory 行位于 subtask 边界仅 warning、VQA assistantcontent是合法的 bbox / keypoint / count / attribute / spatial 形状 JSON、每行按column_for_style(style)路由到正确列。任何 error 都会中止 writer调试时可传--skip_validationtrue跳过。迭代单个模块与关键调参每个模块都默认开启可独立关闭设为false即跳过。由于重跑某模块只覆盖它自己的 staging JSONL随后 writer 重新组合最终 parquet改 prompt 或调参数时的迭代成本很低# 只重跑 plan 模块subtasks plan memory task_aug uv run lerobot-annotate --root/path/to/dataset \ --plan.enabledtrue --interjections.enabledfalse --vqa.enabledfalse高频参数完整列表见lerobot-annotate --help与 config.py默认值面向短时长操作类 episode 调过参数默认作用--plan.frames_per_second2.0时间戳联系表的抽帧密度0.5s 一帧--plan.max_frames_per_prompt60每次 VLM 调用的帧预算超出自动按同密度分窗再拼接--plan.subtask_describe_firsttrue先 describe 后 segment子任务质量最好1 次调用/episode--plan.subtask_seeded_relabelfalse对每个子任务做二次改写1 次调用/subtask--plan.emit_plan/--plan.emit_memorytrue控制是否输出plan/memory行--interjections.max_interjections_per_episode3每 episode 的 interjection/speech 对上限--vqa.vqa_emission_hz1.0VQA 对的输出频率--executor.episode_parallelism16每个阶段内并发处理的 episode 数按文档的估算默认配置8 个 subtask、1 次 interjection、1 Hz × 3 对下一个 30 秒 episode 约消耗 50 次 VLM 调用可用于评估整体开销。大数据集提交到 Hugging Face Jobs本地没有足够 GPU 时给同一条命令加--job.targetflavor即可提交到 HF Jobs与lerobot-train相同机制。pod 从vllm/vllm-openai镜像启动、在其上安装 lerobot、按 GPU 起 vLLM 服务然后跑三个模块文档中的生产示例hf auth login # 一次 uv run lerobot-annotate \ --repo_iduser/my_dataset \ --new_repo_iduser/my_dataset_annotated \ --push_to_hubtrue \ --vlm.model_idQwen/Qwen3.6-27B \ --vlm.num_gpus1 \ --vlm.serve_commandvllm serve Qwen/Qwen3.6-27B --tensor-parallel-size 1 \ --max-model-len 32768 --gpu-memory-utilization 0.8 \ --uvicorn-log-level warning --port {port} \ --vlm.serve_ready_timeout_s1800 \ --vlm.chat_template_kwargs{enable_thinking: false} \ --job.targeth200其中{port}是文档原样保留的占位符自动起服务时每个 server 副本会替换为实际端口。命令会流式打印 job 日志Ctrl-C只是断开而不会取消任务hf jobs hardware可列出可用 flavor 与价格。两点必须注意Qwen3.6 默认开启 thinking会占掉标注 JSON 答案所需的 token 预算所以上例显式传--vlm.chat_template_kwargs{enable_thinking: false}。没有--push_to_hubtrue时标注结果在 pod 退出时即被丢弃。Job 相关选项--job.image默认vllm/vllm-openai:latest、--job.timeout默认2h大数据集调高如--job.timeout8h、--job.detach提交后立即返回、--job.lerobot_refpod 上安装的 lerobot git ref默认main可指向分支测试改动、--job.tags。更大的数据集可换h200x4并同步调高--vlm.parallel_servers/--vlm.num_gpus。远程运行必须提供--repo_idpod 从 Hub 拉取数据集--root只是本机目录仅存在于本地缓存的数据集会先推到一个私有仓库。限制与下一步事件行的时间戳直接取自源 parquet从不重新计算配方侧的精确事件匹配也没有容差窗口这保证标注能落在确切帧上。标注完成后language_persistent/language_events的行如何被消费subtask/plan/memory 分支、interjection 应答分支、VQA 分支由 recipe YAML 声明见 Language Columns and Recipes未带这两列的数据集行为保持不变。要新增标注模块或调整 prompt模块代码在 src/lerobot/annotations/steerable_pipeline/modules/prompt 模板在同目录的prompts/下改动模块时调模板而不是重写。【免费下载链接】lerobot LeRobot: Making AI for Robotics more accessible with end-to-end learning项目地址: https://gitcode.com/GitHub_Trending/le/lerobot创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考