模型: anikitakis/vla_so101_pick_n_place_full_expert —— LeRobot SmolVLA 系列 pick-and-place 专家策略(
so_follower机器人,3 相机)。 本仓库为该模型在 昇腾 910 (torch-npu) 上的适配工程,提供inference.py双模式推理入口(CLI + FastAPI)。
SmolVLA (Vision-Language-Action) 是一个端到端视觉-语言-动作策略,接收 多视角图像 + 语言指令 + 机器人状态, 输出一段 动作轨迹(末端执行器 6 维动作,50 步)。
HuggingFaceTB/SmolVLM2-500M-Video-Instruct(取前 num_vlm_layers=16 层)expert_width_multiplier=0.75)num_steps=10)chunk_size=50 步动作so_follower; 相机: front/annotated/target_patch(480×640)| 项 | 说明 |
|---|---|
| 输入图像 | 3 个相机视角图像(本工程将单张输入图复制到 3 个视角槽位) |
| 输入指令 | 自然语言文本,如 "put the annotated object in the box" |
| 输入状态 | 6 维末端关节位置(默认 [0, 90, -80, 85, 0, 10]) |
| 输出动作 | trajectory: 形状 [50, 6] 的浮点数组(50 步 × 6 维 ee6d 动作) |
.cuda() / torch.cuda.* / device="cuda" / CUDA_VISIBLE_DEVICES / cudnn.*)。npu:0(由 ASCEND_VISIBLE_DEVICES 映射物理卡); 入口 import torch_npu 并 torch.npu.set_device(0)。smolvla_npu/(移植自 huggingface/lerobot v0.5.1 的 smolvla 策略),
移除对完整 lerobot 框架的依赖,仅保留推理所需最小实现:
modeling.py / vlm_with_expert.py / configuration.py —— SmolVLA 策略 + SmolVLM2 VLM + expert(近乎原样移植,无 CUDA);get_safe_dtype 对 npu 将 float64 降级为 float32(Ascend910 不支持 fp64)。safetensors.torch.load_model 从本地 model.safetensors(含完整 VLM + expert 权重)加载;
基础 VLM 以 load_vlm_weights=False 从 config 初始化架构(避免重复下载 ~1GB 基础权重),再整体覆盖为模型权重。pip install -r requirements.txtpython inference.py --img test_input.png --instruction "put the annotated object in the box"输出 JSON,含 trajectory (50×6), last_action, stats, inference_ms, exit_status 等。
python inference.py --serve --port 8000请求:
curl -F "file=@test_input.png" -F "instruction=put the annotated object in the box" http://127.0.0.1:8000/predict返回与 CLI 相同的 JSON 推理结果。
权重自动从 hf-mirror.com(回退 ai.gitcode.com/hf_mirrors)下载并缓存到
./model_weights/anikitakis/vla_so101_pick_n_place_full_expert/(策略权重)与
./model_weights/vlm_backbone/SmolVLM2-500M-Video-Instruct/(VLM 骨干 config/tokenizer)。
已缓存直接复用(打印 [cache-hit])。
assets/agent_workflow.png — NPU 部署依赖安装 + 任务启动总日志assets/npu_device_call.png — CLI 命令行推理成功输出assets/model_result.png — FastAPI 返回推理结果模型 Apache-2.0(来源 anikitakis/vla_so101_pick_n_place_full_expert)。