fine-tuning-serving-openpi
它能做什么
这项技能涵盖 Physical Intelligence 公司的 OpenPI 机器人控制模型的适配和运行,从设置直到上线的推理服务器。适合希望在自己的数据上训练或部署这些策略的机器人工程师。
适用场景
- ✓当你想让 OpenPI 机器人模型适配你自己的机器人数据集的时候。
- ✓当你需要把 JAX 检查点转换为 PyTorch 检查点的时候。
- ✓当你想运行一个策略服务器,供机器人请求动作的时候。
技能链接
https://github.com/Orchestra-Research/AI-Research-SKILLs/blob/main/18-multimodal/openpi/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在自己的数据集上微调 pi0 机器人模型,然后部署它,让我的机器人可以请求动作?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会安装公开的 OpenPI 项目,准备你的数据和归一化统计信息,使用 JAX 或 PyTorch 设置运行训练,并启动一个返回动作预测的服务器。它也会帮助解决归一化和 GPU 内存等常见问题。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
OpenPI Fine-Tuning and Serving
End-to-end workflows for fine-tuning and serving Physical Intelligence's OpenPI models (pi0, pi0-fast, pi0.5) on robot manipulation tasks from the public openpi repository. Covers blank-machine setup, JAX training, PyTorch training, checkpoint conversion, and policy inference serving.
Quick start
Clone the public repo, install the workspace, then serve a pretrained policy:
git clone --recurse-submodules https://github.com/Physical-Intelligence/openpi.git
cd openpi
GIT_LFS_SKIP_SMUDGE=1 uv sync
GIT_LFS_SKIP_SMUDGE=1 uv pip install -e .
uv run scripts/serve_policy.py --env DROID
from openpi_client import websocket_client_policy
client = websocket_client_policy.WebsocketClientPolicy(host="localhost", port=8000)
result = client.infer(observation)
actions = result["actions"] # numpy array of shape (chunk_size, action_dim)
Core concepts
Model family: OpenPI implements three model variants from Physical Intelligence:
| Model | Architecture | Speed | Quality | Typical use |
|---|---|---|---|---|
| pi0 | Flow-matching VLA | Baseline | Highest | Research, complex tasks |
| pi0-fast | Autoregressive action tokens | 2-5x faster | Good | Real-time control |
| pi0.5 | pi0 + improved vision encoder | Baseline | Best | Latest default |
Key design choices:
- Dual backend: JAX (primary, official training) and PyTorch (community, deployment-friendly)
- Config-driven: All training/serving parameters defined in
src/openpi/training/config.py - Norm stats: Every config requires precomputed normalization statistics before training
- WebSocket serving: Policy servers expose a WebSocket API for low-latency inference
Training loop invariant: After every config or dataset change, always re-run this cycle:
- Compute norm stats → 2. Train → 3. Serve checkpoint → 4. Validate inference
Compute requirements
| Task | GPU | VRAM | Notes |
|---|---|---|---|
| Serve pi0.5 (inference) | 1x A100/H100 | ~24 GB | Single GPU sufficient |
| Fine-tune pi0.5 (JAX) | 1x A100 80GB | ~60 GB | Use fsdp_devices for multi-GPU |
| Fine-tune pi0 (JAX) | 1x A100 80GB | ~40 GB | Smaller model footprint |
| Fine-tune (PyTorch DDP) | 1-8x A100 | ~40 GB/GPU | torchrun launcher |
| Compute norm stats | CPU or 1x GPU | ~8 GB | Fast, can run on login node |
Workflow 0: Blank-machine setup
Copy this checklist and track progress:
Setup Progress:
- [ ] Step 1: Clone the public openpi repo with submodules
- [ ] Step 2: Install uv and sync the workspace
- [ ] Step 3: Install the editable package
- [ ] Step 4: Verify core imports and serving entrypoint
Step 1: Clone repo
git clone --recurse-submodules https://github.com/Physical-Intelligence/openpi.git
cd openpi
If you already cloned without submodules:
git submodule update --init --recursive
Step 2: Sync dependencies
GIT_LFS_SKIP_SMUDGE=1 uv sync
Step 3: Install editable package
GIT_LFS_SKIP_SMUDGE=1 uv pip install -e .
Step 4: Verify installation
uv run python -c "from openpi.training import config as _config; print(_config.get_config('pi05_droid').name)"
uv run scripts/serve_policy.py --help
When to use vs alternatives
Use this skill when:
- Fine-tuning pi0, pi0-fast, or pi0.5 on LeRobot or RLDS datasets
- Serving OpenPI policies for ALOHA, DROID, or LIBERO evaluation
- Converting JAX checkpoints to PyTorch format
- Debugging OpenPI training issues (norm stats, memory, config)
Use fine-tuning-openvla-oft instead when:
- Fine-tuning OpenVLA with continuous action heads and LoRA
- Reproducing OpenVLA-OFT paper results on LIBERO or ALOHA
Use evaluating-cosmos-policy instead when:
- Evaluating NVIDIA Cosmos Policy on simulation benchmarks
Workflow 1: JAX fine-tuning on LeRobot data
Copy this checklist and track progress:
JAX Fine-Tuning Progress:
- [ ] Step 1: Select and copy closest training config
- [ ] Step 2: Update dataset mapping and base checkpoint
- [ ] Step 3: Compute normalization statistics
- [ ] Step 4: Launch JAX training
- [ ] Step 5: Serve checkpoint and run inference sanity check
Step 1: Select config
Copy the closest config from src/openpi/training/config.py:
| Config | Use case |
|---|---|
pi05_libero |
pi0.5 LIBERO fine-tuning |
pi0_libero |
pi0 full fine-tuning on LIBERO |
| `pi |
常见问题
它支持哪些模型?
技能涵盖 Physical Intelligence 的 pi0、pi0-fast 和 pi0.5。
文中提到了哪些机器人环境?
ALOHA、DROID 和 LIBERO 环境。
它能帮忙解决 GPU 内存问题吗?
能。训练和部署期间的内存问题是它涵盖的问题之一。
详情
作者的原始描述
Fine-tune and serve Physical Intelligence OpenPI models (pi0, pi0-fast, pi0.5) using JAX or PyTorch backends for robot policy inference across ALOHA, DROID, and LIBERO environments. Use when adapting pi0 models to custom datasets, converting JAX checkpoints to PyTorch, running policy inference servers, or debugging norm stats and GPU memory issues.
热度
- GitHub 星标
- 14k
- 排名
- #11166
- 许可证
- MIT
- 更新时间
- 2026/10/10
评论
- …
同一仓库的更多技能
autoresearch
14k引导你的智能体完成一个完整的 AI 研究项目,从文献综述到实验和写作,并通过反复的测试与审查循环推进。
prompt-guard
14k让你的智能体在文本进入你的 AI 应用之前,使用 Meta 的小型分类器检查其中是否含有提示注入和越狱尝试。
pytorch-fsdp2
14k向你的智能体展示如何在训练脚本中加入 PyTorch FSDP2,使大型模型能被拆分到多张 GPU 上并正确保存。
ml-training-recipes
14k为你的智能体提供经过验证的神经网络训练方案,涵盖模型选择、优化器、学习率以及处理损失骤升的方法。