liuhongwei-2026/vla_so101_pick_n_place_full_expert
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

vla_so101_pick_n_place_full_expert

{hardware NPU}

SO-101 桌面机械臂「抓取-放置」专家策略(VLA, Vision-Language-Action)在华为昇腾 NPU 上的推理适配。

  • 原始模型:anikitakis/vla_so101_pick_n_place_full_expert
  • 架构:SmolVLA(SmolVLM2-500M-Video-Instruct VLM + Flow-Matching 动作专家头,约 500M 参数)
  • 任务:强化学习训练得到的 pick-and-place 专家策略,输入 3 路相机图像 + 机器人状态 + 语言指令,输出 50 步动作 chunk(每步 6 维:4 关节 + 2 夹爪)
  • 适配方式:torch_npu 直接推理(VLA 非纯 LLM,不走 vLLM-Ascend),vendor 官方 lerobot 源码为自包含 smolvla/ 包,权重从 checkpoint 严格加载

环境

组件版本
昇腾芯片Ascend 910 (62GB HBM)
torch2.9.0
torch_npu2.9.0.post1
CANN8.5.1
transformers4.57.6

注意:SmolVLM2 视觉塔与专家注意力均使用 eager attention(纯 matmul + softmax 实现),在 NPU 上避免 aclnnFlashAttentionScore 报错。

模型文件

文件说明
model.safetensors全部权重(vlm + lm_expert + action head,约 906MB)
policy_preprocessor_step_5_normalizer_processor.safetensorsstate/action 归一化统计量
policy_postprocessor_step_0_unnormalizer_processor.safetensorsaction 反归一化统计量
config.jsonSmolVLA 推理配置

快速开始

# 1. 准备权重(huggingface 直连不通时走 hf-mirror 或 gitcode LFS)
#    https://hf-mirror.com/anikitakis/vla_so101_pick_n_place_full_expert/resolve/main/model.safetensors
#    https://gitcode.com/hf_mirrors/anikitakis/vla_so101_pick_n_place_full_expert.git (LFS)

# 2. 准备 SmolVLM2 config + tokenizer(模型架构依赖,非权重)
#    ModelScope: HuggingFaceTB/SmolVLM2-500M-Video-Instruct (config.json + tokenizer 文件)

# 3. 安装依赖
pip install -r requirements.txt

# 4. 单端推理(CPU 或 NPU)
python inference.py --checkpoint /path/to/checkpoint --device npu:0

# 5. CPU vs NPU 精度对比
python inference.py --checkpoint /path/to/checkpoint --compare --device npu:0

验证结果

合成观测(3×480×640 平滑渐变图像 + 6 维状态 + 语言指令 put the annotated object in the box),固定同一 flow-matching noise:

指标值
cosine_similarity (CPU vs NPU)0.999997
max_abs_diff4.32e-01(动作幅值 ~30,属 flow-matching 正常数值差)
NPU 单次推理约 2~4 s(含 10 步 denoise)

项目结构

vla_so101_pick_n_place_full_expert/
├── inference.py        # 推理脚本(CPU/NPU + --compare 精度对比)
├── README.md           # 本文件
├── requirements.txt    # 环境依赖
├── smolvla/            # vendor 自包含模型包(改造自 lerobot 0.4.4)
│   ├── configuration_smolvla.py   # 精简 config(去掉 lerobot.configs 依赖)
│   ├── modeling_smolvla.py        # VLAFlowMatching(去掉 PreTrainedPolicy 依赖)
│   ├── smolvlm_with_expert.py     # VLM + 动作专家交错注意力(官方源码,仅依赖 transformers)
│   └── __init__.py
└── assets/
    ├── agent_workflow.png     # 部署/推理流程图(截图待补)
    ├── npu_device_call.png    # NPU 设备调用证据(截图待补)
    └── model_result.png       # 推理结果输出(截图待补)

输入输出

  • 输入:
    • observation.images.camera1/2/3:三路相机图像 (3, 480, 640),float [0,1]
    • observation.state:6 维机器人状态
    • task:语言指令(如 "put the annotated object in the box")
  • 输出:动作 chunk (1, 50, 6),50 步 × 6 维(4 关节角 + 2 夹爪),反归一化后为真实动作值

参考

  • SmolVLA 论文:Hugging Face SmolVLA(SmolVLM2 + Flow Matching 动作专家)
  • lerobot:https://github.com/huggingface/lerobot (policy/smolvla)