w
gcw_uQ09W7jl/X-VLA-Pt
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

X-VLA-Pt Ascend NPU

Base Model: 2toINF/X-VLA-Pt — X-VLA 0.9B Foundation Edition (Soft-Prompted Transformer, Flow-Matching VLA)

Revision: c1c4a64a7e03ac5b95c468bf1578f3d03651b53b
Route: manipulation-vla — 图像/状态/语言 → 连续动作块
Hardware: Ascend 910 (npu:0) via torch_npu, single-card

任务

  • Observations: 3-view RGB 224x224, observation.state is implicit proprio (20-dim ee6d), language instruction (max 50 tokens)
  • Processor: XVLAProcessor (CLIPImageProcessor + BartTokenizerFast), num_views=3, image mean/std 0.485/0.456/0.406 / 0.229/0.224/0.225
  • Outputs: action_chunk shape [1, 30, 20] (horizon 30, ee6d 20-dim with gripper channels sigmoid), dtype float32, horizon是真实可执行动作块
  • Sampler: Flow-matching denoising steps=10, soft-prompted transformer depth 24, hidden 1024, linear schedule, CPU RNG for x1 to guarantee CPU-NPU identical noise

真实结果(NPU:0)

  • CPU action shape [1,30,20] min -0.442 max 0.574 mean 0.0225, finite true, first action [-0.0405, -0.1200, 0.259, 0.138, -0.186]
  • NPU action shape [1,30,20] finite true, same stats, first action [-0.04049, -0.12003, 0.25931, 0.13847, -0.18609]
  • CPU-NPU consistency: max_abs 0.00017, mean_abs 0.000045, max_ref 0.574, tolerance 0.00067 (atol 1e-4 rtol 1e-3) → PASS (relaxed 5e-3/5e-2 also PASS)
  • Latency (synchronized, torch.npu.synchronize): 158.04 ms avg (10 runs, 3 warmup), min 157.33 max 161.05, p50 157.52 p90 158.25 p95 161.05
  • Throughput: 189.82 actions/s, 6.33 chunks/s (30 actions per chunk, batch 1, 224x224x3, dtype float32, steps 10)
  • Device proof: model param npu:0, inputs npu:0 (input_ids, image_input, image_mask, proprio, domain_id), output npu:0, synchronize用于计时
  • Weights: 3.5 GB safetensors (879M params), not bundled — runtime downloads via snapshot_download with HF_ENDPOINT=https://hf-mirror.com

复现

pip install -r requirements.txt
python inference.py

默认 python inference.py 从本地 /tmp/models/X-VLA-Pt 或 HF mirror 加载,打印 model/revision/route/backend/device/dtype、输入摘要、动作摘要、同步耗时和 PASS/FAIL。

适配说明

  • 修复 transformers 5.9 兼容:Florence2LanguageConfig forced_bos_token_id, XVLA._supports_sdpa/all_tied_weights_keys/tie_weights, processing pad_token, 同步缓存哈希缺失文件
  • 修复 NPU随机性:x1 在 cpu 上生成再 .to(device) 保证 CPU-NPU 同噪声,精度对齐
  • 单卡 Ascend910 64GB 显存充足(峰值 <6GB),未删减视觉塔/语言塔/动作头,实现端到端真实 npu:0 推理

证据

  • assets/agent_workflow.png — 侦察、资源、加载、NPU推理、一致性、性能
  • assets/npu_device_call.png — npu-smi、NPU availability、device name、model/inputs/output device
  • assets/model_result.png — python inference.py 真实 ActionPlan与耗时

workflow device result

限制

  • 依赖 torch_npu 2.9 + CANN 8.5.1, transformers 5.9 patched via local model dir
  • 仅验证单步动作块;闭环 rollout需环境(未替代数值一致性)
  • 首轮编译约 40s (CPU cold) vs 158ms (NPU warm),后续稳定