gcw_mXoV1I2Z/SimVLA-LIBERO
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

SimVLA-LIBERO · 昇腾 NPU 适配

SimVLA (LIBERO Edition) — Vision-Language-Action (VLA) 策略模型,昇腾 NPU 适配推理工程。

  • 仓库:YuankaiLuo/SimVLA-LIBERO(HuggingFace 权重镜像)
  • 源码:LUOyk1999/SimVLA(GitHub)
  • 架构:SmolVLM-500M-Instruct 视觉语言骨干 + SmolVLMActionTransformer(flow-matching 动作去噪器)
  • 动作空间:libero_joint(8 维 proprio → 7 维动作,num_actions=10)
  • 设备:Ascend 910 (npu:0),框架 PyTorch + torch_npu

适配说明

  1. CUDA 全量清理:推理入口与模型代码全代码域无任何 CUDA 调用,模型与输入 Tensor 全部迁移 npu:0。
  2. NPU 初始化:import torch_npu + torch.npu.set_device(0),失败时抛异常退出(不做 CPU/CUDA 回退)。
  3. 离线 base 骨干:SmolVLM-500M-Instruct 基础模型由本地 smolvlm_base/(idefics3 config + processor)经 AutoModelForImageTextToText.from_config 构建骨架,完整权重由 checkpoint(model.safetensors)加载, 无需联网下载 1GB 基础模型。
  4. 双模式推理:CLI 单图推理 + FastAPI POST /predict 服务。
  5. 自定义模型代码:configuration/modeling/processing_smolvlm_vla.py、action_hub.py、 transformer_smolvlm.py 来自官方源码仓库,一并缓存于权重目录。

使用

# 环境
export ASCEND_VISIBLE_DEVICES=14

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

# CLI 单图推理(自动下载/复用权重)
python inference.py --img test_input.png

# 自定义语言指令
python inference.py --img test_input.png --instruction "pick up the red block and place it in the bowl"

# FastAPI 服务
python inference.py --serve --port 8000
curl -F "file=@test_input.png" -F "instruction=pick up the red block and place it in the bowl" http://127.0.0.1:8000/predict

权重缓存

权重缓存于 ./model_weights/YuankaiLuo/SimVLA-LIBERO/(模型全名),已缓存则直接复用([cache-hit]), 避免重复下载。缺失文件自动从 https://hf-mirror.com 补全。

推理输出

返回 action_trajectory JSON:形状 [1, 10, 7] 的动作轨迹(delta_xyz(3) + delta_euler(3) + gripper_cmd(1)), 含均值/标准差/最值等统计。

验证截图

  • assets/agent_workflow.png:NPU 环境检查 / 依赖安装 / 任务启动总日志
  • assets/npu_device_call.png:python inference.py --img test_input.png 成功输出
  • assets/model_result.png:FastAPI curl -F 返回的推理结果 JSON

License

Apache-2.0(与上游模型一致)