本仓库是针对昇腾 Ascend NPU(
npu:1)的真实推理交付候选,并非模型原仓库。 This is a real Ascend NPU inference delivery candidate for physicalnpu:1; it is not the upstream model repository.
模型 / Model: 2toINF/X-VLA-WidowX
固定修订 / Pinned revision: 8d7ea1aaa948665d44129a3ff488629b955fc0f9
上游 X-VLA 仓库修订 / Upstream X-VLA repo revision: 6bc2513f5f1cbec715cc668b414392a6cae5c671
许可证 / License: Apache-2.0(见上游模型卡,无猜测)
Pinned real artifact: model.safetensors — 3,519,068,172 bytes — SHA256
fb5e3d58223fe8865b43e3361428de6ef5ac0c3fb656fa69a40649893f6c4a7f
X-VLA 是一个基于 Florence-2 编码器 + flow-matching 动作生成 Transformer 的
Vision-Language-Action(VLA)模型。本候选使用 native XVLA WidowX 路径
(action_mode=ee6d、num_actions=30、dim_action=20、dim_proprio=20、
domain_id=0(Bridge/WidowX)、steps=10、num_views=3),在昇腾 npu:1
上完成一次确定性的完整前向推理,输出完整的动作轨迹张量 [1, 30, 20]。
X-VLA is a Vision-Language-Action model built on a Florence-2 encoder plus a
flow-matching action transformer. This candidate executes the native XVLA WidowX
path with deterministic synthetic image/language/proprio inputs on npu:1 and
emits the full action trajectory.
以下依赖由容器镜像提供,严禁替换/重装(必须与 CANN 匹配): The following are provided by the container image and must never be replaced:
| Package | Version | Note |
|---|---|---|
| Python | 3.11.14 | /usr/local/python3.11.14/bin/python3 |
| torch | 2.9.0+cpu | CANN-matched, container-provided |
| torch_npu | 2.9.0 | CANN-matched, container-provided |
| CANN | 8.5.1 | ASCEND_TOOLKIT_HOME=/usr/local/Ascend/cann-8.5.1 |
| transformers | 5.15.1 | installed via Aliyun mirror |
| numpy | 1.26.4 | installed via Aliyun mirror |
| safetensors | 0.8.0 | installed via Aliyun mirror |
| tokenizers | 0.22.2 | installed via Aliyun mirror |
| einops | >=0.7 | installed via Aliyun mirror |
| opencv-python-headless | 4.9.0.80 | installed via Aliyun mirror |
timm 未完整安装(完整版会引入 torchvision,可能破坏与 CANN 匹配的 torch);
本候选在 timm/ 下提供一个最小 Apache-2.0 shim(DropPath、trunc_normal_)。
timm is intentionally shimmed to avoid pulling torchvision.
本环境已预设:
export PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
export PIP_TRUSTED_HOST=mirrors.aliyun.com从阿里云镜像安装所需依赖(不要安装/替换 torch 与 torch_npu):
python3 -m pip install \
"transformers==5.15.1" "safetensors>=0.4" "numpy==1.26.4" \
"tokenizers>=0.15" "einops>=0.7" "opencv-python-headless==4.9.0.80" \
"Pillow>=9.0"注意:
opencv-python-headless可能把 numpy 升级到 2.x,随后必须python3 -m pip install --force-reinstall numpy==1.26.4并在需要时用--no-deps重装 opencv-python-headless,以保证 CANN/torch_npu 兼容。
在昇腾环境初始化并运行真实推理(物理 npu:1):
cd /root/ascend-model-pipeline/jobs/rl26/x-vla-widowx/x-vla-widowx-npu
source /usr/local/Ascend/ascend-toolkit/set_env.sh
ASCEND_RT_VISIBLE_DEVICES=0,1 python3 inference.py \
--device npu:1 --steps 10 --hold-seconds 90要点:
npu:1,
无 CPU offload / fallback。inference.py 会严格校验 model.safetensors 的字节数与 SHA256、
严格加载全部 903 个 checkpoint 张量(唯一缺键
vlm.language_model.model.encoder.embed_tokens.weight 为权重绑定键,
与 shared.weight 共享存储)、并审计所有参数/缓存/输入/输出均在 npu:1。--hold-seconds 秒,供 npu-smi 关联真实 PID。logs/npu_result.json,原始日志写入 logs/npu_inference.log。完整测试命令(一次真实 NPU 推理):
cd /root/ascend-model-pipeline/jobs/rl26/x-vla-widowx/x-vla-widowx-npu
source /usr/local/Ascend/ascend-toolkit/set_env.sh
ASCEND_RT_VISIBLE_DEVICES=0,1 python3 inference.py --device npu:1 --steps 10 --hold-seconds 90
echo "exit=$?"实际输出(logs/npu_inference.log,最终运行 PID 3805808,exit code 0):
[2026-08-22 09:30:02] === X-VLA WidowX NPU inference ===
[2026-08-22 09:30:02] PID=3805808 device=npu:1 steps=10 seed=0
[2026-08-22 09:30:02] torch=2.9.0+cpu torch_npu=2.9.0
[2026-08-22 09:30:02] torch.npu.is_available=True
[2026-08-22 09:30:02] npu device_count=2
[2026-08-22 09:30:03] current_device_index=1 current_device_name=Ascend910B4-1
[2026-08-22 09:30:46] artifact bytes=3519068172 sha256=fb5e3d58223fe8865b43e3361428de6ef5ac0c3fb656fa69a40649893f6c4a7f
[2026-08-22 09:30:46] ckpt tensors=903 dtype={'F32': 903}
[2026-08-22 09:30:46] params=879482456 load missing=['vlm.language_model.model.encoder.embed_tokens.weight'] unexpected=[]
[2026-08-22 09:30:46] weight load OK (strict: all 903 tensors consumed)
[2026-08-22 09:30:46] input input_ids: shape=(1, 50) dtype=torch.int64 device=npu:1
[2026-08-22 09:30:46] input image_input: shape=(1, 3, 3, 224, 224) dtype=torch.float32 device=npu:1
[2026-08-22 09:30:46] input image_mask: shape=(1, 3) dtype=torch.bool device=npu:1
[2026-08-22 09:30:46] input proprio: shape=(1, 20) dtype=torch.float32 device=npu:1
[2026-08-22 09:30:46] input domain_id: shape=(1,) dtype=torch.int64 device=npu:1
[2026-08-22 09:30:54] forward done in 8.6350s
[2026-08-22 09:30:54] output shape=[1, 30, 20] device=npu:1 dtype=torch.float32
[2026-08-22 09:30:54] output mean_abs=0.153266 min=-0.224736 max=0.991569
[2026-08-22 09:30:54] output gripper0(sigmoid) mean=0.341650 gripper1(sigmoid) mean=0.000000
[2026-08-22 09:30:54] output first_action=[0.134916..., 0.196636..., 0.259522..., 0.990354..., ...]
[2026-08-22 09:30:54] model parameter device types: {'npu'}
[2026-08-22 09:30:54] HOLDING_FOR_NPU_SMI pid=3805808 seconds=90.0
[2026-08-22 09:32:24] result json written: /work/pipeline/jobs/rl26/x-vla-widowx/x-vla-widowx-npu/logs/npu_result.json
[2026-08-22 09:32:24] === SUCCESS ===logs/npu_result.json 顶层字段包括:
engine: torch_npu、exit_code: 0、npu_available: true、
npu_device_name: Ascend910B4-1、source_revision: 8d7ea1aa...、
input_device: npu:1、model_device: npu:1、output_device: npu:1,
并保留输出形状 [1,30,20]、均值/最值、gripper 通道均值、首动作、耗时与 PID 等。
npu-smi PID 关联证据(logs/npu_smi_evidence.log,hold 窗口内实时抓取):
NPU 1 | Chip 0 | Process id 3805808 | python3 | Process memory 4184 MB
Process id:3805808 Process name:python3 Process memory(MB):4184
3805808 3802212 Sl ... python3 inference.py --device npu:1 --steps 10 --hold-seconds 90npu-smi 进程/设备调用证据logs/npu_result.json)logs/npu_inference.log)以上截图全部由真实最终日志/结果渲染,未伪造证据。
generate_actions),
未运行语言模型解码分支(checkpoint 为已裁剪的 XVLA 权重)。timm 为最小 shim,而非完整发行版。seed=0 以保证确定性。npu:1;多卡 hccl 分布式不在本候选范围。python3 -m py_compile inference.py 语法通过。runtime/validate_delivery.py 通过(无缺失文件、无秘密、无 __pycache__、
SHA256SUMS 校验通过、npu_result.json 顶层字段齐全)。0,PID 与 npu-smi 关联一致。