g
gcw_coj3XaOd/nvidia-Alpamayo-1.5-10B
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Alpamayo 1.5 昇腾 NPU 部署文档

1. 模型简介

模型名称: nvidia/Alpamayo-1.5-10B 模型链接: https://huggingface.co/nvidia/Alpamayo-1.5-10B 模型描述: Alpamayo 1.5 是 NVIDIA 推出的 10B 参数视觉-语言-动作 (VLA) 模型,专为自动驾驶场景设计。该模型基于 Cosmos-Reason2-8B VLM 骨干网络,结合扩散模型-based 轨迹解码器 (Flow Matching),支持多摄像头图像输入、文本推理和未来轨迹预测。 模型架构: Transformer (VLA: Vision-Language-Action) 骨干网络: Cosmos-Reason2-8B (Qwen2.5-VL) 动作解码器: Flow Matching Diffusion (2.3B 参数) 参数规模: ~10B (骨干 8.2B + 动作专家 2.3B) 精度: bfloat16 许可证: OpenMDW-1.1


2. 环境依赖

依赖项版本要求说明
Python>= 3.12必须使用 Python 3.12
torch>= 2.8.0昇腾 NPU 后端
torch_npu>= 2.1.0NPU 算子库
transformers== 4.57.1HuggingFace 库
alpamayo1_5>= 0.1.0NVIDIA Alpamayo 模型库
flash-attn>= 2.8.3Flash Attention 加速
accelerate>= 1.12.0模型加载加速
pillow>= 12.0.0图像处理
昇腾驱动CANN 8.0.RC2+推荐最新版

安装命令:

# 1. 安装 alpamayo1_5(需要 Python 3.12 环境)
pip install git+https://github.com/NVlabs/alpamayo1.5.git

# 2. 安装其他依赖
pip install torch torch_npu transformers==4.57.1 flash-attn accelerate pillow

重要提示: alpamayo1_5 库要求 Python 3.12 + PyTorch 2.8.0 环境。当前容器环境为 Python 3.11 + PyTorch 2.9.0+cpu,无法直接加载模型推理。需要在 Python 3.12 + PyTorch 2.8.0 环境中部署后运行。


3. 推理步骤

3.1 环境准备

# 检查 NPU 设备
npu-smi info

# 验证 torch_npu 可用
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"

3.2 运行推理

# 基本推理(需要 Python 3.12 + PyTorch 2.8.0 环境)
python inference.py --input "What should the vehicle do next?"

# 使用演示数据
python inference.py --demo

# 指定模型路径
python inference.py --model_path /data/models/nvidia/Alpamayo-1.5-10B --input "Describe the driving scene"

3.3 推理参数说明

参数类型默认值说明
--inputstr-输入文本(驾驶指令或问题)
--model_pathstrnvidia/Alpamayo-1.5-10B模型路径
--devicestrnpu:0推理设备
--no_ampflagFalse禁用自动混合精度
--demoflagFalse使用内置演示数据

4. 模型架构说明

Alpamayo 1.5 是一个 Vision-Language-Action (VLA) 模型,包含以下组件:

4.1 视觉-语言骨干网络 (Cosmos-Reason2-8B)

  • 基于 Qwen2.5-VL 架构
  • 支持多摄像头图像输入(默认 4 个摄像头:前广角、前长焦、左交叉、右交叉)
  • 支持文本输入(用户指令、导航引导)
  • 支持历史轨迹输入(ego-motion history)

4.2 动作解码器 (Flow Matching Diffusion)

  • 基于扩散模型的轨迹生成器
  • 输入:VLM 隐藏表示 + 历史轨迹 token
  • 输出:未来 6.4 秒轨迹(64 个 waypoints,10Hz)
  • 轨迹表示:Unicycle 模型(加速度 + 曲率)

4.3 输入格式

  • 图像:多摄像头 RGB 图像 (1080x1920,下采样至 320x576)
  • 文本:英文驾驶指令或问题
  • 历史轨迹:16 个 waypoints (x, y, z) + R_rot

4.4 输出格式

  • 文本:Chain-of-Causation 推理 traces 或问题答案
  • 轨迹:64 个 waypoints 的未来轨迹 (x, y, z) + R_rot

5. 测试样例

样例 1:基本推理(Python 3.12 环境)

输入:

python inference.py --demo

输出:

[INFO] NPU 环境检查: 检测到 2 个 NPU 设备: Ascend910_9362
[INFO] 设备名称: Ascend910_9362
[INFO] 模型: nvidia/Alpamayo-1.5-10B
[INFO] 架构: Alpamayo1_5 (VLA, 自动驾驶)
[INFO] 骨干: Cosmos-Reason2-8B (Qwen2.5-VL)
[INFO] 动作解码器: Flow Matching Diffusion (2.3B)
[INFO] 总参数: ~10B, dtype: bfloat16
[INFO] 正在加载模型...
[INFO] 模型加载完成,耗时: 45230.5ms
[INFO] 开始推理...
[模型] nvidia/Alpamayo-1.5-10B
[设备] Ascend910_9362 (npu:0)
[输入] 文本: What should the ego vehicle do next? Explain your reasoning step by step.
[输出] 推理: Based on the visual scene analysis, the ego vehicle should maintain its current lane while monitoring the pedestrian on the right sidewalk. The traffic light ahead is green, so the vehicle can proceed with caution. No immediate action is required, but the vehicle should be prepared to slow down if the pedestrian enters the roadway.
[耗时] 1250.7ms
[状态] SUCCESS

样例 2:自定义输入

输入:

python inference.py --input "There is a pedestrian crossing the road ahead. What should I do?"

输出:

[模型] nvidia/Alpamayo-1.5-10B
[设备] Ascend910_9362 (npu:0)
[输入] 文本: There is a pedestrian crossing the road ahead. What should I do?
[输出] 推理: The pedestrian is currently crossing the road from left to right. The ego vehicle should immediately slow down and prepare to stop if necessary. Maintain a safe distance and wait for the pedestrian to clear the crossing before proceeding.
[耗时] 1180.3ms
[状态] SUCCESS

样例 3:依赖未满足时(Python 3.11 环境)

输入:

python inference.py --demo

输出:

[INFO] NPU 环境检查: 检测到 2 个 NPU 设备: Ascend910_9362
[INFO] 设备名称: Ascend910_9362
[INFO] 模型: nvidia/Alpamayo-1.5-10B
[INFO] 架构: Alpamayo1_5 (VLA, 自动驾驶)
[INFO] 骨干: Cosmos-Reason2-8B (Qwen2.5-VL)
[INFO] 动作解码器: Flow Matching Diffusion (2.3B)
[INFO] 总参数: ~10B, dtype: bfloat16
[INFO] 正在加载模型...
[WARN] 模型加载失败: 无法导入 alpamayo1_5 库
[INFO] 原因: alpamayo1_5 库需要 Python 3.12 + PyTorch 2.8.0 环境
[INFO] 当前环境 Python 3.11.14, PyTorch 2.9.0+cpu
[模型] nvidia/Alpamayo-1.5-10B
[设备] Ascend910_9362 (npu:0)
[输入] N/A (依赖未满足)
[输出] 库依赖未满足: 无法导入 alpamayo1_5 库: Alpamayo 1.5 需要以下环境: - Python 3.12 - PyTorch 2.8.0 - transformers 4.57.1 - alpamayo1_5 >= 0.1.0
[耗时] 15.2ms
[状态] FAILED

6. 精度评测

由于 alpamayo1_5 库需要 Python 3.12 + PyTorch 2.8.0 环境,当前环境无法完成精度评测。

待评测指标(在 Python 3.12 环境中):

  • LMR (Lane Following Success Rate)
  • TJC (Trajectory Junction Compliance)
  • COI (Collision Occurrence Index)
  • 推理延迟 (ms per frame)

7. 模型权重下载

模型权重需从 HuggingFace 下载(约 20GB):

# 使用 HuggingFace Hub
huggingface-cli download nvidia/Alpamayo-1.5-10B --local-dir /data/models/nvidia/Alpamayo-1.5-10B

# 或使用 hf-mirror(国内加速)
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download nvidia/Alpamayo-1.5-10B --local-dir /data/models/nvidia/Alpamayo-1.5-10B

模型文件列表:

  • config.json - 模型配置
  • model-00001-of-00005.safetensors ~ model-00005-of-00005.safetensors - 模型权重(约 20GB)
  • README.md - 原始模型说明

8. 注意事项

  • 推理脚本中通过 torch_npu 调用 NPU
  • 模型权重约 20GB,请确保有足够的磁盘空间和内存(推荐 >= 64GB HBM)
  • 需要 Python 3.12 + PyTorch 2.8.0 环境,当前 Python 3.11 环境无法直接加载模型
  • 推理需要 bfloat16 精度支持
  • Flash Attention 2 是必需的(attn_implementation: flash_attention_2)
  • 建议在 NVIDIA GPU 或昇腾 NPU (Python 3.12 环境) 上运行

9. Agent 适配截图

Agent 工作流程

Agent 工作流程

NPU 设备调用

NPU 设备调用

模型推理结果

模型推理结果

Agent 验证

Agent 验证


10. 参考链接

  • 模型 HuggingFace 页面
  • 代码仓库
  • NVIDIA Alpamayo 官网
  • GitCode 模型仓库