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

UnifoLM-VLM-Base · 昇腾 NPU 适配

Unitree UnifoLM-VLM-Base 机器人视觉-语言-动作 (VLA) 基础模型的昇腾 NPU (Ascend910 + torch-npu) 推理适配。

模型信息

项目值
模型unitreerobotics/UnifoLM-VLM-Base
架构Qwen2.5-VL (Qwen2_5_VLForConditionalGeneration)
参数量8.29B (bf16, ~16.6GB)
输入图像 + 语言指令/文本
输出文本 (VLM 理解/指令跟随)

适配要点

  • 全代码域删除 CUDA 调用, 模型与输入 Tensor 迁移 npu:0
  • 入口顶部 import torch_npu + torch.npu.set_device(0), 带 try-except NPU 初始化异常捕获
  • 权重自动下载缓存到 ./model_weights/unitreerobotics/UnifoLM-VLM-Base/ (hf-mirror 优先, GitCode 镜像兜底, 429 指数退避)
  • bf16 + torch.inference_mode() 推理, 适配 64GB 卡显存
  • 无自定义 remote code, 直接使用 transformers AutoModelForVision2Seq / AutoProcessor

使用

CLI 模式

python inference.py --img test_input.png [--instruction "Describe this scene and the objects on the table."]

FastAPI 模式

python inference.py --serve --port 8000
curl -F "file=@test_input.png" -F "instruction=Describe this scene" http://127.0.0.1:8000/predict

依赖

见 requirements.txt (torch==2.9.0, torch_npu==2.9.0.post1, transformers==4.57.6, fastapi, uvicorn, pillow)。