waylong/vla_so101_pick_n_place_full_expert
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

SmolVLA SO101 Pick-n-Place (Ascend NPU)

Model: anikitakis/vla_so101_pick_n_place_full_expert
Revision: adda798b270742f820834daea0fc37718745f025
Route: manipulation-vla (SmolVLA)
Backend: torch_npu on Ascend910_9362 (npu:0)
Device: npu:0 validated, dtype torch.float32 (cast from BF16 for Ascend bucketize compatibility)

模型任务

紧凑型 Vision-Language-Action 模型,基于 HuggingFaceTB/SmolVLM2-500M-Video-Instruct (16 层 VLM + 0.75x expert),通过 flow matching (num_steps=10) 将多相机观测与语言指令映射为连续动作块,用于 SO101 机械臂 put the annotated object in the box 任务。训练数据 anikitakis/pick_n_place_dagger_3cam_dagger_only (21 episodes, 127k frames)。

观测与动作契约

  • 输入 (n_obs_steps=1):
    • observation.state: STATE shape (6,) (6-DoF joint)
    • observation.images.camera1 (annotated) / camera2 (front) / camera3 (target_patch): VISUAL shape (3,480,640) -> 内部 resize_with_padding 至 512x512, IDENTITY 归一化
    • observation.language.tokens / attention_mask: 长度 48, 来自 HuggingFaceTB/SmolVLM2-500M-Video-Instruct tokenizer, 布尔 mask
  • 输出:
    • action: ACTION shape (6,) horizon chunk_size=50 -> 每次推理输出 shape [1,50,6] (50 步未来动作), max_state_dim=32 max_action_dim=32 填充后截断
  • 采样: 流匹配去噪, 固定 noise shape [1,50,32] seed 1234, min_period 0.004 max_period 4.0, cross_attn

真实结果 (NPU)

  • 模型加载: SmolVLAPolicy.from_pretrained("/tmp/vla_so101_full") 本地 revision, VLM 权重离线缓存 /data/adapt-npu-hf/hub/models--HuggingFaceTB--SmolVLM2-500M-Video-Instruct
  • NPU 设备: torch.npu.is_available()=True, device_count=2, device_name=Ascend910_9362, npu-smi 确认 NPU 6 正常
  • Device Proof: model_param device npu:0 dtype torch.float32, input state npu:0, input images npu:0, sampler noise npu:0, output action_chunk npu:0 (全链路无 CPU fallback)
  • 同步计时: torch.npu.synchronize() 包围, warmup 3, timed 10, avg 283.7 ms (run 280.8-295 ms), p50 281.8 ms p90 285.1 ms, 176.2 actions/s / 3.52 chunks/s (50 actions/ chunk)
  • 输出示例 (seed 1234): first_action [1.1619, 0.1032, -0.0257, -0.1562, 0.9542, 1.5248] last_action [0.5980, -0.6516, 0.3385, -0.2488, 0.9226, -0.7543] shape [1,50,6] finite true bounds内

CPU-NPU 一致性

  • 对比对象: 去归一化前原始 action_chunk 连续值 (有策略语义)
  • 条件: 共享本地权重 (model.safetensors 906M), 相同观测 (state/3相机 float32, 相同语言 tokens 48), 相同 noise (seed 1234), 相同 preprocessing/flow steps, 同 dtype float32 (CPU 也 cast float)
  • 结果: max_abs 2.44e-05, tolerance 1.62e-03 (FP32 atol 1e-4 rtol 1e-3), count 300, finite true -> PASS; 同时验证 atol 5e-3 rtol 5e-2 也通过。未使用文本非空/top-5/reward 替代。

性能

  • Batch 1, 3 相机 480x640 -> 512x512, horizon 50, num_steps 10, dtype float32, 含预处理
  • avg 283.7 ms, min 280.8 ms, max 294.9 ms, p50 281.8 ms, p90 285.1 ms, p95 294.9 ms
  • actions_per_s 176.2, chunks_per_s 3.52
  • 首轮编译与预热后延迟已分离报告 (warmup 3 不计)

环境限制

  • 需 torch==2.9.0 torch_npu==2.9.0.post1 Ascend CANN 8.5.1 驱动, 单卡 Ascend910 64GB (实测 HBM 3109/65536 MB)
  • 原始 BF16 torch.bucketize 在 NPU 不支持 (错误 DT_BFLOAT16 not supported), 已统一转 float32 (记录于推理日志), 不影响一致性阈值
  • 权重未提交, 推理需联网或本地缓存 HuggingFaceTB/SmolVLM2-500M-Video-Instruct, 离线可用 HF_HUB_OFFLINE=1
  • 任务为单步开环验证, 闭环 rollout 为额外评估不替代块级一致性

复现

python inference.py

默认打印 model/revision/route/backend/device/dtype/输入摘要/动作摘要/同步耗时与 PASS/FAIL。

证据

  • agent workflow
  • npu device call
  • model result

日志 SHA256 嵌入对应 PNG, 详见各图底部 source_sha256。