K-ON111111/UnifoLM-VLM-Base
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

unitreerobotics/UnifoLM-VLM-Base — 昇腾 NPU 适配模型

赛事: 昇腾 Model Agent 模型适配大赛(第二季) 引擎: torch_npu + transformers(Qwen2.5-VL-7B) 硬件: Ascend 310P / 910B 标签: npu ascend pytorch robotics vision-language-model

📖 模型简介

UnifoLM-VLM-Base(UnifoLM-VLA-0)是宇树科技推出的通用人形机器人操作 Vision-Language-Action(VLA)大模型。基于 Qwen2.5-VL-7B-Instruct 继续预训练, 深度融合文本指令与 2D/3D 空间信息,支持 12 类复杂操作任务的单策略执行。 输入机器人观测图像 + 语言指令,输出具身操作动作 token。

属性值
原始模型https://huggingface.co/unitreerobotics/UnifoLM-VLM-Base
参数量7 B(Qwen2.5-VL-7B)
任务类型人形机器人视觉-语言-动作(VLA)
输入格式观测图像 + 语言指令
输出格式动作 token 文本(具身操作指令)

🔧 环境依赖

pip install -r requirements.txt -i https://repo.huaweicloud.com/repository/pypi/simple/

🚀 推理步骤

⚠️ 本仓库不包含模型权重(交付件仅 inference.py / readme.md / requirements.txt / assets/), 推理前必须先从原始模型仓单独下载权重。

# 1. 下载模型权重(仓库不含权重,必须单独下载)
git clone https://gitcode.com/hf_mirrors/unitreerobotics/UnifoLM-VLM-Base.git ./UnifoLM-VLM-Base

# 2. 运行 NPU 推理
python3 inference.py --model_path ./UnifoLM-VLM-Base \
  --image obs.png --instruction "Describe the scene and plan the next manipulation action." \
  --device npu:0 --output inference_result.json

🧪 测试用例

用例 1: 图像 + 指令 → 动作输出

python3 inference.py --model_path ./UnifoLM-VLM-Base \
  --image test_obs.png --instruction "Describe the scene and plan the next manipulation action." \
  --device npu:0 --output inference_result.json

预期输出:

[Model Agent] ✅ NPU 设备就绪: Ascend310P3
[Model Agent] ✅ 模型加载完成 → npu:0
[Model Agent] ✅ 生成完成, 推理耗时 2815.430s
[Model Agent] ✅ 结果已保存 → inference_result.json

推理结果摘要:

{
  "model": "unitreerobotics/UnifoLM-VLM-Base",
  "engine": "torch_npu",
  "device": "npu:0",
  "instruction": "Describe the scene and plan the next manipulation action.",
  "output": "Action:<bpos><ACTION_0><ACTION_255>...",
  "inference_time_s": 2815.43
}

📁 目录结构

.
├── inference.py          # NPU 推理脚本
├── readme.md             # 本文件
├── requirements.txt      # 依赖清单
└── assets/               # 截图素材

📝 适配说明

本模型由 昇腾 Model Agent 自动完成 NPU 适配:

  • SDPA 兼容补丁:torch_npu 不支持 F.scaled_dot_product_attention, 全局替换为手动 matmul 实现
  • dtype 统一:全精度 fp32 加载(Qwen2.5-VL 的 _keep_in_fp32_modules 机制会保留部分层 fp32,与 bf16 输入不匹配)
  • 推理使用低温采样(temperature=0.1, top_k=1)输出确定性动作 token
  • 已在 Ascend 310P3 上实跑验证通过(图像+指令 → 动作输出),输出合法