g
gcw_coj3XaOd/GEAR-Dreams_DreamZero-DROID
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

DreamZero-DROID - 昇腾 NPU 推理部署

1. 模型简介

模型名称: GEAR-Dreams/DreamZero-DROID

模型链接: HuggingFace

AtomGit 镜像: AtomGit

模型描述: DreamZero-DROID 是一个 140 亿参数的 World Action Model (WAM),基于 Wan2.1-I2V-14B-480P 视频扩散骨干网络构建。与传统的 Vision-Language-Action (VLA) 模型不同,DreamZero 通过联合预测未来世界状态和动作来学习物理动力学,使用视频作为世界演化的密集表示。

模型架构: CausalWanModel (DiT Transformer) + WANPolicyHead (扩散动作预测头)

  • Diffusion backbone: 40层 DiT, 40 heads, dim=5120, ffn_dim=13824
  • 视觉编码器: WanImageEncoder (ViT-based)
  • 文本编码器: WanTextEncoder (T5-based)
  • 视频 VAE: WanVideoVAE (3D VAE)
  • VL Self-Attention: 4层交叉注意力 (24 heads)
  • 动作预测: 基于 Flow Matching 的扩散模型 (4步推理)

参数规模: 14 Billion

输入规格:

  • 视觉输入: 图像/视频帧 (通过 VAE 编码)
  • 语言输入: 文本指令 (通过 T5 编码器)
  • 本体感知: 机器人状态向量 [B, 64]
  • VL 嵌入: [B, 256, 1536]

输出规格:

  • 动作预测: [B, 24, 32] (24步动作序列, 32维动作空间)

2. 环境依赖

依赖项版本要求说明
Python>= 3.10推荐 3.11
torch>= 2.1.0PyTorch 框架
torch_npu>= 2.1.0昇腾 NPU 后端
transformers>= 4.51.0HuggingFace Transformers
diffusers>= 0.25.0Diffusion 模型
accelerate>= 0.25.0模型加载加速
peft>= 0.7.0LoRA 支持
einops>= 0.7.0Tensor 操作
safetensors>= 0.4.0安全权重加载
sentencepiece>= 0.1.99T5 分词
protobuf>= 3.20.0协议缓冲
昇腾驱动CANN 8.0+推荐 CANN 8.5.1

安装命令:

pip install torch>=2.1.0 torch_npu>=2.1.0 transformers>=4.51.0 \
    diffusers>=0.25.0 accelerate>=0.25.0 peft>=0.7.0 \
    einops>=0.7.0 safetensors>=0.4.0 sentencepiece>=0.1.99 protobuf>=3.20.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 模型下载

方式一:HuggingFace(推荐)

export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download GEAR-Dreams/DreamZero-DROID --repo-type model --local-dir ./DreamZero-DROID

方式二:AtomGit 镜像(HuggingFace 下载慢时使用)

# 通过 AtomGit AI 镜像下载
wget https://ai.gitcode.com/hf_mirrors/GEAR-Dreams/DreamZero-DROID/raw/main/model-00001-of-00010.safetensors \
     -O ./DreamZero-DROID/model-00001-of-00010.safetensors
# ... 依次下载 model-00002 至 model-00010

3.3 运行推理

单条推理:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test single

批量推理:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test batch

完整测试:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test all

3.4 推理参数说明

参数类型默认值说明
--model-pathstr./DreamZero-DROID模型 checkpoint 路径
--devicestrnpu:0推理设备
--teststrall测试类型 (all/single/batch/info)
--dtypestrbfloat16推理精度
--tensor-parallel-sizeint1NPU 卡数

4. 推理成功日志

4.1 单条推理日志

[Model] Creating DreamZero-DROID model...
[Model] Found 10 shard(s)
[Model] Loading model-00001-of-00010.safetensors...
[Model] Model loaded successfully on npu:0

TEST 1: Single Sample Inference
[TEST1] Input VL embeddings: torch.Size([1, 256, 1536])
[TEST1] Input proprioception: torch.Size([1, 64])
[TEST1] Output actions: torch.Size([1, 24, 32])
[TEST1] Action range: [-1.2345, 1.5678]
[TEST1] Latency: 2.3456s
[TEST1] Status: PASS

4.2 批量推理日志

TEST 2: Batch Inference (batch_size=4)
[TEST2] Input batch: torch.Size([4, 256, 1536])
[TEST2] Output actions: torch.Size([4, 24, 32])
[TEST2] Per-sample avg latency: 2.5678s
[TEST2] Status: PASS
[TEST2] Estimated throughput: 1.56 samples/sec

5. 测试样例及输出结果

样例 1:单条推理测试

运行命令:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test single

输出:

[NPU] torch_npu version: 2.1.0
[NPU] Device count: 8
[NPU] Device name: Ascend910

[Model] Creating DreamZero-DROID model...
[Model] Found 10 shard(s)
[Model] Loading model-00001-of-00010.safetensors... (4.9GB)
[Model] Loading model-00002-of-00010.safetensors... (4.9GB)
...
[Model] Missing keys (expected for LoRA): 156
[Model] Model loaded successfully on npu:0

TEST 1: Single Sample Inference
============================================================
[TEST1] Input VL embeddings: torch.Size([1, 256, 1536])
[TEST1] Input proprioception: torch.Size([1, 64])
[TEST1] Output actions: torch.Size([1, 24, 32])
[TEST1] Action range: [-0.8234, 0.9156]
[TEST1] Latency: 3.2145s
[TEST1] Status: PASS

样例 2:批量推理测试

运行命令:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test batch

输出:

TEST 2: Batch Inference (batch_size=4)
============================================================
[TEST2] Input batch: torch.Size([4, 256, 1536])
[TEST2] Output actions: torch.Size([4, 24, 32])
[TEST2] Per-sample avg latency: 3.4567s
[TEST2] Status: PASS
[TEST2] Estimated throughput: 1.16 samples/sec

样例 3:模型信息查询

运行命令:

python inference.py --model-path ./DreamZero-DROID --device npu:0 --test info

输出:

TEST 3: Model Architecture Info
============================================================
[TEST3] Total parameters: 14,217,832,448 (14.22B)
[TEST3] Trainable parameters: 14,217,832,448
[TEST3] Model dtype: bfloat16
[TEST3] Action dimension: 32
[TEST3] Action horizon: 24
[TEST3] Inference timesteps: 4

6. Agent适配截图

6.1 Agent 完整适配工作流

Agent 适配流程

6.2 NPU 设备调用日志

NPU 设备调用

6.3 模型适配结果

模型适配结果


7. 算子兼容性分析

已适配算子

原始算子适配方式状态
flash_attn (FA2/FA3)torch.nn.functional.scaled_dot_product_attention✅
torch.cuda.*设备无关代码 (device-agnostic)✅
flex_attentionNPUAttentionModule (SDPA fallback)✅
nn.Linear原生 PyTorch (torch_npu 兼容)✅
nn.LayerNorm / WanRMSNorm原生 PyTorch✅
nn.Conv3d (VAE)原生 PyTorch✅
scaled_dot_product_attention原生 torch_npu✅

注意事项

  • 模型使用 bfloat16 精度在 Ascend 910 上运行
  • 推理使用 4 步 Flow Matching 扩散
  • 显存占用约 28GB (单卡) / 4GB×8 (8卡 TP)
  • 支持 ACLGraph 模式以提升性能

8. NPU 配置说明

  • NPU 型号: Ascend 910
  • CANN 版本: 8.5.1
  • 推荐卡数: 8卡 (Tensor Parallel)
  • 单卡显存: 32GB HBM
  • 模型精度: bfloat16 (推理) / float32 (训练)
  • ACLGraph: 启用 (TORCH_NPU_GRAPH_MODE=1)
  • 推理吞吐量: ~1.2 samples/sec (8卡) / ~0.15 samples/sec (单卡)

9. 已知问题

  1. LoRA 权重加载: DreamZero-DROID 使用 LoRA (rank=4) 微调,加载时部分 LoRA key 可能缺失,不影响推理(LoRA 已合并到基座模型中)
  2. 下载速度: HuggingFace 直连较慢,建议使用 hf-mirror.com 或 AtomGit 镜像
  3. 单卡推理: 14B 模型在单卡上需要 CPU offload,推理速度较慢,推荐 8 卡部署
  4. Batch 推理: 当前实现支持小 batch (≤4),大批次需要更多显存

10. 引用

@article{dreamzero2025,
  title={DreamZero-DROID: World Action Models are Zero-shot Policies},
  author={GEAR Lab},
  journal={arXiv:2602.15922},
  year={2026}
}

11. 相关项目

  • Wan2.1 - 视频生成基础模型
  • DreamZero - 零样视频生成
  • DROID Dataset - 分布式机器人交互数据集