pi0.5 export to ExecuTorch with TensorRT: how to reproduce from source
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 文件
- 描述清晰度
- 需要釐清
- 活躍度
- 活躍
研究方向
Start with benchmarks/pi05_compare/README.md on the LeRobot pi05-repro branch, then follow its install, export, and benchmark commands to reproduce the reported results. The issue describes a reproduction guide and measured results but does not state a specific change needed in ExecuTorch. Done would require a clearer, actionable task; no target file or expected change is identified.
由索引模型根據 Issue 內容生成。
描述
pi0.5, the open vision-language-action model from Physical Intelligence, compiled with TensorRT through Torch-TensorRT and ExecuTorch (PyTorch's solution for deploying models on devices), runs faster than openpi, Physical Intelligence's reference implementation, on an H100. It uses less GPU memory, its action error stays small (between openpi's own PyTorch and JAX paths), and it runs without loading PyTorch. It needs only the released packages and a LeRobot branch. Below are the numbers, measured the same way for each path, and how to reproduce them.
Results
One H100, batch 1, openpi's pi05_libero weights in bfloat16, 10 denoising steps, 10 actions per chunk:
| Path | Time per chunk | Time saved by ExecuTorch + TensorRT | GPU memory | Max / mean error vs float32 |
|---|---|---|---|---|
| ExecuTorch + TensorRT | 20.5 ms | 5.7 GiB | 0.0058 / 0.0007 | |
openpi PyTorch, torch.compile |
28.1 ms | 27% | 8.0 GiB | 0.0036 / 0.0004 |
| openpi JAX | 36.0 ms | 43% | 8.6 GiB | 0.0063 / 0.0008 |
How it was measured: every path ran on the same GPU, with the same 16 real LIBERO frames, the same prompt, the same starting noise and the same work per chunk (two cameras and a 73-token prompt). For openpi the timer covers the model call, with the inputs already on the GPU. For ExecuTorch it also covers copying the frame to the GPU and the actions back. Every timer waits for the GPU. Each run is a fresh process that times 30 chunks after warm-up, and the runs of the three paths were interleaved. Each time is the median of 3 or more runs. GPU memory is what nvidia-smi reports for the card after the timed chunks, with only that process on it. The error is against openpi's PyTorch model in float32 on the same frames and noise.
Notes:
- openpi is at commit
215abfb, run with two cameras andmax_token_len=73, so that it does the same work as the exported program. As it ships, openpi also fills a third camera with zeros and pads its prompt to 200 tokens, which is more work per chunk. - LeRobot's pi0.5 writes the robot state into its prompt and openpi's
pi05_liberodoes not. So the exported program is compared with a float32 reference that has the state in its prompt, and openpi with one that does not. - openpi's own
infer_msfield does not wait for the GPU, so it reads lower than the real time, most of all for JAX. The timer here waits on every path. - A100 and DGX Spark will follow here, measured on the same branch.
Jetson Orin Nano 8 GB (this branch)
LeRobot's public lerobot/pi05_libero_finetuned_v044 checkpoint in bfloat16, 50 actions per chunk, the default chain (--one_program=true does not fit in 8 GB at export). Timed with lerobot-rollout --bundle.path, which does not load PyTorch: 3 warm-up chunks, then 3 runs of 32, median of the run medians.
| Path | Time per chunk | Memory (CPU and GPU together) |
|---|---|---|
| ExecuTorch + TensorRT, default chain | 423 ms | 5.4 GiB |
| Plain PyTorch | does not fit |
The export took 12 minutes on the board, with a peak of 5.7 GB of host memory.
Jetson AGX Thor (this branch)
LeRobot's public lerobot/pi05_libero_finetuned_v044 checkpoint in bfloat16, 50 actions per chunk. Timed with lerobot-rollout: the ExecuTorch rows with --bundle.path, which does not load PyTorch, and plain PyTorch with --policy.path. 3 warm-up chunks, then 3 runs of about 32 chunks, median of the run medians. The two ExecuTorch rows alternated, and the PyTorch runs followed in the same session.
| Path | Time per chunk | Time saved by ExecuTorch + TensorRT | GPU memory | Memory (CPU and GPU together) |
|---|---|---|---|---|
ExecuTorch + TensorRT, --one_program=true |
80.5 ms | 5.2 GiB | 5.6 GiB | |
| ExecuTorch + TensorRT, default chain | 80.8 ms | 5.3 GiB | 5.6 GiB | |
| Plain PyTorch | 236.0 ms | 66% | 9.4 GiB | 11.3 GiB |
GPU memory is what nvidia-smi reports for the process. The last column is how much the board's used memory grew during the run, since Thor's CPU and GPU share one memory. Both bundles pass the export's own check against the PyTorch policy (largest difference 0.017, tolerance 0.075).
A second session on the same board later that night, with the same bundle settings, gave 77.5 ms for --one_program=true, so times on this board move by a few percent from session to session. The table keeps the first session, where all three paths ran together.
The exports took 7.5 minutes (default chain) and 10 minutes (--one_program=true) on the board, with a peak of 10.6 and 12.1 GiB of host memory.
What it needs on top of the releases
Nothing in ExecuTorch or Torch-TensorRT: the released ExecuTorch 1.6.0 and Torch-TensorRT 2.15.0 are enough.
LeRobot. The lerobot-export command and the pi0.5 recipe, on branch pi05-repro of github.com/shoumikhin/lerobot. Two changes there make pi0.5 faster on the H100 and the DGX Spark:
- The action expert's attention reuses one key/value head across many query heads. The recipe now tells TensorRT so on the H100 and the DGX Spark too, which lets it pick a faster kernel.
--one_program=truecompiles pi0.5 as the fewest programs: one for the images and the prompt, one for the whole language model, one that runs all ten denoising steps, and small ones for the starting noise and the actions. Without it, the export keeps a chain of small programs that builds on an 8 GB board.
The branch pins these and the changes it builds on as they were when it was built. They will go upstream as pull requests.
How to reproduce
| Project | Branch | Commit |
|---|---|---|
| LeRobot | pi05-repro |
434dfad796 |
1. Install, with Python 3.12. The export also needs nvcc from CUDA 12.8 or newer on PATH:
pip install "torch_tensorrt[executorch]"
pip install "lerobot[pi,export] @ git+https://github.com/shoumikhin/lerobot@434dfad796dd2563899d5cdb813a590f727026f5"
2. Get the weights and frames. Follow benchmarks/pi05_compare/README.md on the branch: it downloads openpi's pi05_libero checkpoint, converts it to PyTorch with openpi's own converter, picks the 16 LIBERO frames, and makes a LeRobot policy folder pi05_openpi_libero with openpi's weights.
3. Export and run:
lerobot-export --policy.path=pi05_openpi_libero --backend.type=executorch_tensorrt \
--policy.dtype=bfloat16 --one_program=true --output_dir=bundles/one \
--task="pick up the book and place it in the back compartment of the caddy"
# on a robot, the bundle runs without PyTorch:
lerobot-rollout --bundle.path=<bundle> --robot.type=<your robot>
The export takes about 8 minutes on an H100 and up to about 13 GiB of host memory.
4. Time it against openpi, from benchmarks/pi05_compare (the README there sets up openpi and the variables):
bash run_ab.sh 0 out 1 ref_state ref # float32 references
bash run_ab.sh 0 out 3 jax585 pt585 bundle:one # 3 rounds on GPU 0, the order rotates each round
python compare.py out/ref_state.npz out/one_r1.npz # ExecuTorch error
python compare.py out/ref.npz out/pt585_r1.npz # openpi PyTorch error (jax585_r1.npz for JAX)
Questions, and results on other GPUs, are welcome here.
cc @simpleton
- 主要語言
- Python
- 星號
- 5.2k
- 分支
- 1.3k
- 平均合併
- 1 天 7 小時
- 30 天內合併 PR
- 644
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
pytorch/executorch 的其他 Issue
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decomposition可能已有人在做 @Eureka-Zhang 於 7 天前認領。 未關閉module: exir
難度 2/5 1-3 小時 新手友好度 66/100
pytorch/executorch#25620 ·
維護者通常 1 天內回覆
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_norm可能已有人在做 @psiddh 於 21 天前認領。 未關閉bug module: qnn partner: qualcomm
難度 2/5 1-3 小時 新手友好度 74/100
pytorch/executorch#24434 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
enhancement triaged
難度 2/5 半天 新手友好度 68/100
pytorch/executorch#21640 ·
維護者通常 1 天內回覆
-
quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scale可能已有人在做 @AxelNoun 今天認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
pytorch/executorch#25873 ·
維護者通常 1 天內回覆
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 Max可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug module: quantization module: xnnpack
難度 4/5 3-5 天 新手友好度 43/100
pytorch/executorch#25854 ·
維護者通常 1 天內回覆
查看 pytorch/executorch 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
trezor/trezor-user-env#421 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 1/5 1-3 小時 新手友好度 91/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
tangentcode/tangentswarm#167 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆