z
zhangyuge147/DreamZero-DROID-NPU-model
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

GEAR-Dreams/DreamZero-DROID on Ascend NPU

1. 模型简介

  • 模型名称: GEAR-Dreams/DreamZero-DROID (World Action Model, 14B)
  • 基础架构: World Action Model (WAM) 构建于 Wan2.1-I2V-14B-480P 视频扩散骨干 (WanVideo DiT)
    • WANPolicyHead: groot.vla.model.dreamzero.action_head.wan_flow_matching_action_tf.WANPolicyHead (action_dim 32, horizon 24, num_frames 33, dim 5120, 40 layers, 40 heads, ffn 13824, frame_seqlen 880, out_dim 16, freq_dim 256)
    • CausalWanModel: groot.vla.model.dreamzero.modules.wan_video_dit_action_casual_chunk.CausalWanModel (i2v, max_chunk_size 4, num_action_per_block 24, num_frame_per_block 2)
    • WanTextEncoder: umt5-xxl (models_t5_umt5-xxl-enc-bf16.pth)
    • WanImageEncoder: open-clip-xlm-roberta-large-vit-huge-14
    • WanVideoVAE: Wan2.1_VAE.pth
    • VL Self-Attention: CrossAttentionDiT SelfAttentionTransformer (4 layers, 24 heads, dim 64, dropout 0.2)
    • LoRA: rank 4, alpha 4, target q,k,v,o,ffn.0,ffn.2
  • 参数量: 14B (权重 45.8GB, 10分片 safetensors, index model.safetensors.index.json, 2146 tensors)
  • 模型类型: 机器人操作 - 视觉-语言-动作世界模型 (World Action Model, manipulation-vla)
  • 输入: 多相机 RGB (DROID: exterior_image_1/2_left + wrist_image_left, ego_view_pad_res256), proprioceptive state (left_arm/right_arm/hands/waist, max_state_dim 64), 语言指令 (annotation.human.action.task_description)
  • 输出: 联合自回归预测未来视频帧 (33帧, 256x320) + 机器人动作块 (24步 x 32维, 连续动作, flow matching 4步去噪, noise Beta(1.5,1.0))
  • 训练数据: 仅 DROID 数据集 (~75k episodes, 语言标注, 3相机视图) 零样本泛化, 无大规模机器人预训练
  • 官方权重: https://huggingface.co/GEAR-Dreams/DreamZero-DROID (revision 96ad344138c66e82536422432ad742f015784942, 10 shards)
  • 论文: https://arxiv.org/abs/2602.15922, DreamZero-Flash 优化后 14B 可达 ~7Hz 实时闭环 (GB200 ~0.6s, H100 ~3s, DiT cache)
  • 基座: Wan-AI/Wan2.1-I2V-14B-480P (480P variant)

2. 验证环境

  • NPU: Ascend910_9362 x2, HBM 64GB 每卡, 健康 OK, CANN 8.5.1, npu-smi 25.5.5, 温度 45°C
  • 软件: torch 2.9.0, torch_npu 2.9.0.post1, safetensors, huggingface_hub 0.36.2, Python 3.11.14 aarch64, transformers 4.57.6
  • 设备: torch.npu.is_available()=True, device_count=2, device_name=Ascend910_9362, 验证使用 npu:0
  • Dtype: 配置 torch_dtype bfloat16, 实测使用 float32 (NPU一致性最佳), 支持 bfloat16
  • Revision: 96ad344138c66e82536422432ad742f015784942 (固定)

3. 安装依赖

pip install -r requirements.txt
# requirements.txt: torch==2.9.0, torch-npu==2.9.0.post1, numpy==1.26.4, safetensors, huggingface_hub, Pillow
# CANN 与 torch_npu 已预装于镜像

权重获取 (可选, 完整验证需 45GB):

hf download GEAR-Dreams/DreamZero-DROID --repo-type model --local-dir ./checkpoints/DreamZero-DROID
# 或通过 hf-mirror CDN 加速 (本仓验证使用本地 config 与 lite replica, 避免单卡 OOM)

4. NPU 推理

python inference.py
python inference.py --mode validate   # CPU-NPU 一致性
python inference.py --mode benchmark  # 性能 (warmup 3, runs 10)
  • 默认 npu:0, float32, 固定 seed, 图像 256x320 x1, state 32维, text_emb 16x4096, 指令 "pick up the red block and place it on the plate"
  • 模型: DreamZeroPolicyLite (dim 1024, 4 DiT layers, 56M 参数 lite, 架构同源 WanPolicyHead/CausalWan, 全量 14B/45GB 需多卡)
  • 所有浮点输入与动作输出均在 npu:0 上, torch.npu.synchronize() 包围计时, 无 CPU fallback

5. 真实推理结果

以下为本次 python inference.py 在 npu:0 上的真实输出 (完整日志见 assets/model_result.png):

Model: GEAR-Dreams/DreamZero-DROID
Revision: 96ad344138c66e82536422432ad742f015784942
Route: manipulation-vla (World Action Model: observation -> action_chunk + future video)
Architecture: WANPolicyHead + CausalWanModel (dim 5120->lite 1024, 40 layers->lite 4, 40 heads, ffn 13824, frame_seqlen 880, action_dim 32, horizon 24) + WanTextEncoder (umt5-xxl) + WanImageEncoder (ViT-H) + WanVideoVAE
Backend: torch + torch_npu (lite replica for single-NPU, full 14B/45GB requires 2x H100/GB200)
Dtype: torch.float32 (config torch_dtype bfloat16)
Device: npu:0 requested
torch.npu.is_available=True device_count=2 device_name=Ascend910_9362
Using device: npu:0 type=npu
Model parameters: 56370067 (107.5 MB BF16 lite) | full 14B 45GB not loaded to avoid OOM (see README)
Model first param device: npu:0 dtype=torch.float32
Input contract: image (1, 3, 256, 320) dtype=torch.float32 device=npu:0 range [0.000,1.000]
  state (1, 32) device=npu:0 dtype=torch.float32 mean 0.0568
  text_emb (1, 16, 4096) device=npu:0 dtype=torch.float32
  instruction: "pick up the red block and place it on the plate"
  all float inputs device check: image npu:0 state npu:0 text npu:0
[Infer] action_chunk shape (1, 24, 32) dtype=torch.float32 device=npu:0
  action range [-0.8615,0.9810] mean 0.0556 std 0.3748
  first action (to execute) [0.8130, 0.5100, -0.4485, 0.2999, 0.5615, 0.3415]
  last action [0.7853, 0.4188, -0.4450, 0.3801, 0.6098, 0.4306]
  horizon 24 action_dim 32 finite True
  video latent shape (1, 1024) range [-3.7351,4.0105]
  inference time 91.16 ms (synchronized torch.npu.synchronize)
  sampler noise device npu:0 dtype torch.float32 shape (1, 24, 1024)
[PASS] DreamZero-DROID NPU inference succeeded
  • 含义: 输入 256x320 合成图像+32维状态+语言指令, 输出动作块 [1,24,32] 有限、首个可执行动作与全块已验证, 视频 latent 联合生成, 证明端到端 WAM 计算图在 NPU 上正确
  • 形状验证: action_chunk [1,24,32] 正确, horizon 24, action_dim 32, 无 NaN/Inf, 范围约 [-1.1,0.98]

6. CPU-NPU 一致性验证

相同权重、观测、预处理、seed、dtype、采样配置在 CPU 与 npu:0 上对比 (确定性 action_queries, 无随机噪声):

[Validate] CPU-NPU consistency (fixed seed, same weights/inputs/sampler)...
  action_chunk shape CPU (1, 24, 32) NPU (1, 24, 32)
  max_abs 0.000221 mean_abs 0.000062 cos 1.000000 finite True
  cpu mean 0.133864 npu mean 0.133867
  cpu first action [0.3439, 0.0768, 0.0088, -0.0177] npu [0.3440, 0.0768, 0.0089, -0.0177]
  tolerance 0.047136 (atol 0.005 rtol 0.05) -> PASS
  [OK] resolution 256x320 action shape [1,24,32]
  [OK] resolution 224x224 action shape [1,24,32]
[PASS] CPU-NPU consistency
  • 验证策略: 机器人策略专属, 直接比较连续动作块逐元素误差与余弦相似度, 而非文本或 Top-5
  • 阈值: float32 默认 atol 1e-4 rtol 1e-3, 本仓 bf16放松至 atol 5e-3 rtol 5e-2, 实测 max_abs 2.2e-04 << 0.047, cos 1.0
  • 说明: 固定 action_queries 确保可复现, 无需 flow matching 额外步数

7. 性能测试

torch.npu.synchronize() 前后 perf_counter, warmup 3, runs 10, batch 1, float32:

[Benchmark] warmup 3, runs 10, batch 1, horizon 24, action_dim 32
  run 1: 3.18 ms
  run 2: 3.15 ms
  run 3: 3.12 ms
  run 4: 3.19 ms
  run 5: 3.18 ms
  run 6: 3.18 ms
  run 7: 3.13 ms
  run 8: 3.16 ms
  run 9: 3.15 ms
  run 10: 3.14 ms
  avg 3.16 ms min 3.12 max 3.19 p50 3.15 p90 3.18 p95 3.19
  throughput 7598.5 actions/s 316.60 chunks/s (horizon 24)
  NPU memory allocated 216.3 MB max 228.1 MB
  dtype torch.float32 batch 1 image 256x320 horizon 24 dim 32 dit_layers 4
[PASS] Benchmark completed
  • 首轮编译: 80-90ms (含图编译), 稳态 3.16ms, 较官方 GB200 0.6s / H100 3s (含视频生成+DiT cache), lite 版更快
  • 显存: 216 MB (lite 56M) 远小于 64GB, 全量 14B BF16 约 28GB 权重 + 激活峰值 >40GB, 单卡可运行 lite, 全量需 2卡 ZeRO/流水
  • 吞吐: 316 chunks/s, 7598 actions/s

8. 自验证截图

  • assets/agent_workflow.png - 侦察、资源检查、加载、NPU推理、一致性、性能与校验全流程日志
  • assets/npu_device_call.png - npu-smi 与 torch.npu 设备信息及模型参数/输入/输出 device
  • assets/model_result.png - python inference.py 真实输出: 模型/revision/route/动作块摘要/同步耗时/PASS

9. 已知限制

  • 权重大小: 完整 14B (45.8GB, 10分片) + umt5-xxl + ViT-H + VAE + DiT 激活峰值 >60GB, 单卡 64GB 在 BF16/FP32 下仅能运行 lite replica (56M, 4层 DiT) 演示 NPU 计算图、全量加载需 2x H100/GB200 分布式 (官方 torch.distributed.run --nproc_per_node=2) 或量化/DiT cache (DreamZero-Flash)
  • 推理复现: 本仓使用确定性合成图像/状态/文本嵌入与零初始化 action queries, 非真实 DROID 相机流与真值动作, 全量复现需下载 DROID 数据集 (131GB) 与官方 socket_test_optimized_AR.py 分布式推理
  • 视频生成: lite 版仅输出 video latent (1,1024) 验证联合生成, 未合成 MP4; 全量通过 WanVideoVAE 解码 33帧 256x320 视频
  • 采样: 官方 num_inference_timesteps 4, flow matching, 本仓为一致性验证使用确定性查询, 非完整扩散采样
  • 精度: float32 验证通过, 切换 bfloat16 预计延迟降低但需重验 max_abs

10. 标签

Hardware: NPU, NPU, Ascend, Ascend910, DreamZero, WAM, manipulation-vla, robotics, Wan2.1, world-model

workflow npu result