nitish-r-g/skills-i-use/fine-tuning-serving-openpi
Claude Code and agent skill by nitish-r-g/skills-i-use
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install nitish-r-g/skills-i-use/fine-tuning-serving-openpiSKILL.md
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:
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:
Step 1: Clone repo
If you already cloned without submodules:
Step 2: Sync dependencies
Step 3: Install editable package
Step 4: Verify installation
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:
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 | |
pi0_fast_libero | pi0-fast on LIBERO | |
pi0_aloha_pen_uncap | ALOHA custom data | |
pi05_droid_finetune | Small custom DROID dataset (LeRobot format) | |
pi05_full_droid_finetune | Full DROID RLDS large-scale training |
Step 2: Update dataset and transforms
Set repo_id for your dataset and ensure weight_loader matches the model type (pi0 vs pi0.5).
Step 3: Compute normalization statistics
This must run before every training launch when config, dataset, or transforms change.
Step 4: Launch JAX training
For full DROID RLDS training, add the rlds dependency group:
Step 5: Serve and validate
Verify with a test client:
Workflow 2: PyTorch training and checkpoint conversion
Copy this checklist and track progress:
Step 1: Sync dependencies
Step 2: Apply required patches
OpenPI PyTorch requires custom modifications to the installed transformers package:
Step 3: Convert JAX checkpoint
Step 4: Train or serve
Single GPU training:
Multi-GPU distributed training:
Programmatic inference with converted checkpoint:
Checkpoints follow the convention: checkpoints/<config_name>/<exp_name>/<step>/.
Workflow 3: Policy inference serving
Copy this checklist and track progress:
Step 1: Choose environment
Default environment presets:
| Environment | Config | Default checkpoint | |
|---|---|---|---|
ALOHA | pi05_aloha | gs://openpi-assets/checkpoints/pi05_base | |
ALOHA_SIM | pi0_aloha_sim | gs://openpi-assets/checkpoints/pi0_aloha_sim | |
DROID | pi05_droid | gs://openpi-assets/checkpoints/pi05_droid | |
LIBERO | pi05_libero | gs://openpi-assets/checkpoints/pi05_libero |
Step 2: Start server
Default mode (uses preset checkpoint):
Explicit checkpoint mode (custom or local model):
Add --default_prompt "task description" when runtime observations omit a prompt.
Step 3: Verify connectivity
Step 4: Embed remote client in robot code
Install the lightweight client in your robot environment:
Full integration example:
Common issues
Issue: Missing norm stats error
Fix: run scripts/compute_norm_stats.py --config-name <config_name> before training.
Issue: Out of memory during JAX training
Fix: set XLA_PYTHON_CLIENT_MEM_FRACTION=0.9, lower batch size, or configure fsdp_devices:
Issue: OOM while loading PyTorch checkpoints
Fix: export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Issue: Config not found
Fix: ensure config name exists in src/openpi/training/config.py (exact match from _CONFIGS dict).
Issue: PyTorch training diverges after library changes
Fix: reapply the transformer patch. Run uv cache clean transformers to reset, then reapply.
Issue: `serve_policy.py` crashes with `ModuleNotFoundError`
Fix: resync the public workspace first:
If the missing module is simulator-related, install the extra runtime dependencies called for by that example:
Issue: `uv sync` fails with `rerun-sdk` wheel mismatch
Fix:
Issue: Checkpoint download times out
Fix: install gsutil and prefetch manually:
Remove stale .lock files if a previous download was interrupted.
Issue: Policy server exits with code `137`
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/fine-tuning-serving-openpi/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nitish-r-g/skills-i-use/fine-tuning-serving-openpi)