folding_latest 是 lerobot 社区基于 Pi0.5 架构训练的机器人 VLA(Vision-Language-Action)模型,用于折叠衣物等精细操作任务。模型采用 Pi0.5 架构,由 PaliGemma 2B 视觉语言骨干 + Gemma 300M 动作专家 + flow matching 扩散策略组成。
本模型为非 LLM 架构(VLA 机器人策略),vLLM-Ascend 不适用,使用 torch_npu 原生推理。
pip install torch torch_npu
pip install lerobot==0.4.4 transformers==4.57.6 safetensors
pip install modelscopefrom modelscope import snapshot_download
snapshot_download('lerobot/folding_latest', local_dir='./folding_latest')
snapshot_download('AI-ModelScope/paligemma-3b-pt-224', local_dir='./paligemma-tokenizer',
allow_patterns=['tokenizer*', '*.json', '*.model'])python3 inference.py --task "fold the towel"python3 inference.pyLoading folding_latest (Pi0.5) on NPU...
Model loaded: 3500M params
Input: Task: fold the towel, State: ...
Output action [30 x 16d]: [[...], [...], ...]
NPU inference time: 0.39s
NPU memory: 11.17GB| 指标 | 数值 |
|---|---|
| 模型参数量 | 3.5B |
| 权重文件大小 | 8.7 GB |
| 推理精度 | float32 |
| 单次推理时间 | 0.39s |
| NPU 显存占用 | 11.17 GB (单卡推理) |
| AICore 利用率 | 推理时短时突发 |
| NPU 卡号 | 0 (Ascend 910B2) |
| 推理步数 | 10 步 flow matching |
Pi0.5 架构使用了自定义 compute_layer_complete 实现 PaliGemma 语言模型与 Gemma 动作专家的共享注意力计算。transformers 4.57 移除了 _gated_residual 和 AdaRMSNorm 等自定义算子,需对 lerobot 的 modeling_pi05.py 进行以下补丁:
补丁导致的精度差异:标准残差连接替代 gated residual 约 0.5% 差异。