模型名称: UnifoLM-VLM-Base (unitreerobotics/UnifoLM-VLM-Base)
模型链接: HuggingFace
模型描述: 统一机器人基础模型(Unified Robotics Foundation Model),基于 Qwen2.5-VL-7B 架构的视觉-语言-动作(VLA)模型,用于机器人操作任务。
模型架构: Qwen2.5-VL(Vision Transformer + Qwen2.5 LLM backbone)
参数规模: ~7.7B 参数(Qwen2.5-VL-7B base)
架构详情:
| 组件 | 配置 |
|---|---|
| 语言模型 hidden_size | 3584 |
| 语言模型层数 | 28 |
| 注意力头数 | 28 (GQA, 4 KV heads) |
| FFN intermediate_size | 18944 |
| 视觉编码器 hidden_size | 1280 |
| 视觉 patch_size | 14 |
| 最大位置长度 | 128,000 tokens |
权重格式: safetensors, bfloat16, 4 shards (~15.6 GB total)
| 组件 | 要求 |
|---|---|
| NPU | Ascend 910 (Ascend910_9362) |
| 显存 | ≥ 16 GB HBM(单卡) |
| CANN | 8.5.1 |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| transformers | >= 4.56.0 | HF transformers(需 >= 4.56 以支持 Gemma3Config) |
| vllm | 0.18.0 | vLLM-Ascend(模型架构已内置支持) |
| vllm-ascend | latest | vLLM Ascend 插件 |
| sentencepiece | >= 0.1.99 | Tokenizer 依赖 |
| Pillow | >= 9.0 | 图像处理 |
| numpy | < 2 | 数值计算 |
| accelerate | >= 0.25.0 | 模型加载加速 |
安装命令:
pip install torch torch_npu
pip install transformers>=4.56.0
pip install vllm==0.18.0 vllm-ascend
pip install sentencepiece Pillow numpy<2 accelerate# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"
# 验证 CANN acl 模块
python3 -c "import acl; print('acl OK')"方式一:HuggingFace(推荐)
mkdir -p /tmp/unifolm_model_full
huggingface-cli download unitreerobotics/UnifoLM-VLM-Base \
--local-dir /tmp/unifolm_model_full方式二:AtomGit 镜像(HuggingFace 下载慢时使用) <AtomGit 镜像链接待补充>
# 设置环境变量(CANN site-packages + thread safety patch)
export PYTHONPATH="/tmp/python_patch:/usr/local/Ascend/cann-8.5.1/python/site-packages:$PYTHONPATH"
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
# 文本推理
python inference.py --model-path /tmp/unifolm_model_full
# 仅文本推理(跳过图像测试)
python inference.py --model-path /tmp/unifolm_model_full --text-only
# 指定测试图像
python inference.py --model-path /tmp/unifolm_model_full --image /path/to/image.png该模型架构(Qwen2_5_VLForConditionalGeneration)已由 vLLM-Ascend 原生支持。
vLLM EngineCore 的多进程 spawned worker 可能存在 acl 模块导入问题,
如遇此问题,请使用 transformers-native 推理路径(inference.py)。
vllm serve /tmp/unifolm_model_full \
--dtype bfloat16 \
--tensor-parallel-size 1 \
--max-model-len 8192 \
--max-num-seqs 16 \
--trust-remote-code false \
--port 8000| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --text-only | flag | false | 仅文本推理,跳过图像 |
| --image | str | /tmp/test_image.png | 测试图像路径 |
| --max-new-tokens | int | 128 | 最大生成长度 |
[NPU] Device: Ascend910_9362
[NPU] Before load - Allocated: 0 MB
[Step] Model loaded in 7.6s
[NPU] After load - Allocated: 15866 MB
[Test 1] Text-only inference (chat format)
Prompt: Hello, who are you? Please introduce yourself briefly.
Response: Hello! I am an AI digital assistant designed to provide information and answer questions to the best of my ability based on my programming and available data. How can I assist you today?
Time: 1.57s, Tokens: 37
[Test 2] Robotics domain question
Prompt: What skills does a robot need to manipulate objects?
Response: To manipulate objects, a robot would require a variety of skills. These include understanding and grasping the object's structure, using precise movements to move or rotate it, and applying force to exert control over the object. The robot should also have the ability to anticipate changes in the object's state...
Time: 3.31s, Tokens: 98[Test 3] Image understanding
Input shape: torch.Size([1, 98])
Image grid: tensor([[ 1, 16, 16]], device='npu:0')
Response: The image features a bright red square centered against a solid red background. The square is a smaller blue square that is perfectly positioned in the middle of the larger red square. This creates a striking contrast between the vibrant red and the cool blue tones, with the blue square serving as a focal point in the center of the composition.
Time: 2.68s, Tokens: 66运行命令:
python inference.py --model-path /tmp/unifolm_model_full --text-only输出:
[Input] Hello, who are you? Please introduce yourself briefly.
[Output] Hello! I am an AI digital assistant designed to provide information and answer questions to the best of my ability based on my programming and available data. How can I assist you today?
[Stats] 37 tokens, 1.57s (23.6 tok/s)运行命令:
python inference.py --model-path /tmp/unifolm_model_full --text-only输出:
[Input] What skills does a robot need to manipulate objects?
[Output] To manipulate objects, a robot would require a variety of skills. These include understanding and grasping the object's structure, using precise movements to move or rotate it, and applying force to exert control over the object...
[Stats] 98 tokens, 3.31s (29.6 tok/s)运行命令:
python inference.py --model-path /tmp/unifolm_model_full --image /tmp/test_image.png输出:
[Input Image] /tmp/test_image.png
[Input Text] Describe what you see in this image.
[Output] The image features a bright red square centered against a solid red background. The square is a smaller blue square that is perfectly positioned in the middle of the larger red square...
[Stats] 66 tokens, 2.68s (24.6 tok/s)


acl 模块,导致 EngineCore 崩溃。使用 transformers-native API 作为替代推理路径已验证可用。torch.set_num_threads 可能在 multiprocessing spawn 模式下触发 pool INTERNAL ASSERT FAILED。已在 inference.py 中内置 monkey-patch 修复。