
2toINF/X-VLA-Libero (X-VLA 0.9B Libero Edition, Soft-Prompted Transformer VLA, Florence2 backbone)manipulation-vla (观测: 多相机图像 + 语言指令 + proprio -> 连续 action_chunk)input_ids [B,50] (language_max_length 50), image_input [B,3,3,224,224] (num_views=3, CLIP preprocess 224x224 mean [0.485,0.456,0.406] std [0.229,0.224,0.225]), image_mask [B,3] bool, proprio [B,20] float32, domain_id [B] long (embodiment id 0-29, Libero uses 0), steps denoising steps 10, seed 0action_chunk [B,30,20] float32 (horizon 30, dim 20 ee6d: xyz 6D rotation + gripper, gripper channels 9,19 sigmoid)129e71460678b7236cee6fc9707f09d9fa0c3590 (main)npu:0 (Ascend910_9362, CANN 8.5.1, torch_npu 2.9.0.post1)Vision backbone 为 Florence2-large encoder-only (Davit vision + 12+12 language layers, projection_dim 1024), 动作头为 24 层 SoftPromptedTransformer (num_domains 30, soft prompt 32, flow-matching denoising). 训练数据 Bridge V2 + Libero (Franka). 详见 https://huggingface.co/2toINF/X-VLA-Libero
| 组件 | 版本 |
|---|---|
| OS | Linux aarch64 |
| Ascend NPU | Ascend910_9362 (npu:0/npu:1), CANN 8.5.1, SOC ascend910_9391 |
| Python | 3.11.14 |
| torch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1+gitee7ba04 |
| transformers | 4.57.6 |
| Pillow | 11.x |
| numpy | 1.26.4 |
| json_numpy | 2.1.1 |
| opencv-python-headless | 4.11.0.86 |
| fastapi | 0.123.10 |
| safetensors | 0.7.0 |
pip install torch torch_npu transformers huggingface_hub Pillow numpy json_numpy opencv-python-headless fastapi uvicorn safetensors权重约 3.5GB (model.safetensors 3519068172 bytes), 单卡可载. 本仓不提交权重, 由 AutoModel.from_pretrained(..., trust_remote_code=True) 按需下载 (HF_ENDPOINT=https://hf-mirror.com).
已审查 modeling_xvla.py, modeling_florence2.py, configuration_xvla.py, processing_xvla.py, action_hub.py, transformer.py 无网络/子进程/敏感调用, 需 trust_remote_code=True 是因自定义 XVLA 代码.
对 transformers 4.57 的兼容补丁: Florence2PreTrainedModel 的 _supports_sdpa/_supports_flash_attn_2 属性在未初始化 language_model 前返回 True, 及 get_output_embeddings 返回 None 避免 tie_weights 失败; X-VLA 的 x1 生成改为 CPU 随机后搬运, 以消除 CPU/NPU RNG 差异.
# 默认 NPU 推理 (npu:0, steps 10, seed 0, 随机 224x224 三视图 + 指令 "open the top drawer and put the bowl inside")
python inference.py
# 指定设备与步数
python inference.py --device npu:0 --steps 10 --seed 0 --dtype float32默认命令即完成真实 NPU 推理 (warmup 3 + 10 次同步计时), 打印模型/revision/route/backend/device/dtype、输入输出 device/shape、首末动作、统计与 PASS/FAIL, 退出码 0 为通过.
以下为
python inference.py在npu:0上的真实输出摘要 (seed 0, steps 10):
npu:0, dtype torch.float32, shape (2048,1024), params 0.879Binput_ids [1,50] npu:0, image_input [1,3,3,224,224] npu:0, image_mask [[True,True,True]] npu:0, proprio [1,20] npu:0action_chunk [1,30,20] npu:0 float32, finite true, horizon 30, dim 20详见
python inference.py完整日志 (assets/model_result.png).
同一权重 (revision 129e714)、同一观测 (随机 224x224 三视图、指令 "open the top drawer and put the bowl inside"、proprio zeros、domain 0)、同一预处理、seed 0、steps 5/10、dtype float32:
scripts/validate_policy_outputs.py --cpu cpu.json --npu npu.json --atol 1e-4 --rtol 1e-3若 x1 在各设备独立 torch.randn(device=...) 生成, max_abs 约 0.046 (RNG 差异), 故采用 CPU 生成后搬运的确定性策略以满足数值一致性契约, 语义与原始模型一致 (仅随机源位置不同).
torch.npu.synchronize() 前后计时, 预热3次、正式10次:
| 指标 | 值 |
|---|---|
| 首轮 (含编译) | ~210 ms |
| 平均 | 142.8 ms |
| min / max | 139.3 / 147.7 ms |
| p50 / p90 / p95 | 141.8 / 146.5 / 147.1 ms |
| 峰值显存 | ~4.2 GB (HBM) |
| actions/s | 210.07 |
| chunks/s | 7.00 |
| 图像分辨率 | 224x224 x3 |
| horizon | 30 |
| steps | 10 |
预处理不计时; 大模型可减少正式次数并说明. 首轮编译与稳态分开报告.
三张图由 xterm.js 根据本次真实日志 (UTF-8 stdout/stderr, 命令, 退出码, ISO UTC 时间, 日志 SHA256) 渲染, 非截图:
assets/agent_workflow.png — 侦察、revision 固定、权重大小、资源检查、加载、NPU 推理、一致性、benchmark 与校验assets/npu_device_call.png — npu-smi info、torch_npu 可用性、设备名、模型/输入/输出 deviceassets/model_result.png — 默认 python inference.py 的模型、route、真实 ActionPlan、同步耗时与 PASStrust_remote_code=True, 已本地审查无风险.