eardoi/vla_so101-pick-n-place-full-expert-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

vla_so101_pick_n_place_full_expert(昇腾 NPU 适配)

anikitakis/vla_so101_pick_n_place_full_expert 是 LeRobot SmolVLA(视觉-语言-动作)策略 (450M,3 相机,基于 HuggingFaceTB/SmolVLM2-500M-Video-Instruct 骨干), 输入 3 路相机图像 + 机器人状态 + 语言指令,输出动作轨迹。

本项目完成其在**华为昇腾 NPU(Ascend 910B)**上的推理适配与验证。

模型规格

项目说明
模型架构SmolVLAPolicy(SmolVLM2-500M-Video 骨干 + VLAFlowMatching 扩散头)
参数量450M
输入3 相机图像[1,3,480,640] + state[1,6] + 语言指令
输出action [B, act_dim=6](单步,扩散采样)
权重格式model.safetensors(906MB)+ pre/postprocessor

环境要求

# lerobot 0.4.4 + VLM 骨干本地化(SmolVLM2-500M-Video-Instruct 17G)
/usr/local/python3.11.14/bin/pip install lerobot==0.4.4 json_numpy
# VLM 骨干(参考实现目录)
HF_ENDPOINT=https://hf-mirror.com HF_HUB_DISABLE_XET=1 python3 -c \
  "from huggingface_hub import snapshot_download; snapshot_download('HuggingFaceTB/SmolVLM2-500M-Video-Instruct', local_dir='/tmp/ascend-weights/smolvlm2-500m-video')"

推理

cd /workspace/vla_so101
/usr/local/python3.11.14/bin/python3 inference.py \
    --model_path /workspace/vla_so101_pick_n_place_full_expert_src \
    --vlm_dir /tmp/ascend-weights/smolvlm2-500m-video --device npu:0

参数

参数说明默认值
--model_path权重目录/workspace/vla_so101_pick_n_place_full_expert_src
--vlm_dirVLM 骨干本地目录/tmp/ascend-weights/smolvlm2-500m-video
--instruction语言指令put the annotated object in the box
--device推理设备(npu:0 / cpu)npu:0
--output输出动作 npystdout

验证结果(Ascend 910B, npu:0)

输入:3 相机图像 + state + 语言指令(确定性合成输入,参考实现方案)

[info] model loaded: SmolVLAPolicy (450.0M)
[info] 输入: 3相机图像[1,3,480,640] + state[1,6] + 语言指令
============================================================
[info] 输出动作形状: (1, 6)
[info] finite=True | 前5维: [...]
============================================================

vla_so101 在 NPU 上完成动作预测(输出 (1,6)、全 finite), NPU 确定性前向链路完整跑通。

适配说明(参考社区 vla_so101-NPU 方案)

  • policy.float() 先转 FP32:解决 aclnnSearchSorted 对 BF16 不支持 (policy.float().to(device) 而非 .to(dtype=...))。
  • 固定噪声 [B, 50, 32]:select_action(batch, noise=...) 传 [B, chunk=50, max_action_dim=32](非 [B, act_dim])。
  • reset + seed 确定性:policy.reset() + torch.manual_seed(42)。
  • VLM 骨干本地化:config 的 vlm_model_name 指向本地 SmolVLM2 目录。
  • 设备解析 resolve_device():NPU 可用性检测,失败自动回退 CPU。
  • 模型权重不推送到仓库:*.safetensors 已加入 .gitignore。

目录结构

.
├── README.md          # 模型卡片(本文件)
├── inference.py       # NPU 推理脚本
└── assets/            # 适配过程截图素材

引用

  • 模型:https://huggingface.co/anikitakis/vla_so101_pick_n_place_full_expert
  • 参考实现:https://ai.gitcode.com/Lemuel_/vla_so101_pick_n_place_full_expert-NPU