gcw_mXoV1I2Z/X-VLA-Libero
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

2toINF/X-VLA-Libero · 昇腾 NPU 适配

X-VLA 0.9B (Libero Edition) — Vision-Language-Action (VLA) 策略模型,昇腾 Ascend910 适配版。

  • 仓库: https://gitcode.com/gcw_mXoV1I2Z/X-VLA-Libero
  • 权重镜像: GitCode HF 镜像 ai.gitcode.com/hf_mirrors/2toINF/X-VLA-Libero
  • 硬件: Ascend910 (2×) · CANN 8.5.1
  • 软件: PyTorch 2.9.0 + torch_npu 2.9.0.post1 + transformers 4.57.6
  • 设备: npu:1
  • 参数量: ≈879.5M
  • action_mode: ee6d (dim_action=20, num_actions=30, 输出末端执行器轨迹)

适配点

  1. 全代码域无 CUDA 调用,模型与输入 tensor 迁移 npu:1。
  2. modeling_florence2.py:
    • _supports_sdpa / _supports_flash_attn_2 property 防御式处理(transformers 4.57 在 language_model 创建前访问 → 返回 True)。
    • get_output_embeddings 返回 getattr(self, "lm_head", None)(XVLA 裁剪掉 lm_head,供 tie_weights 跳过)。
  3. inference.py 双模式(CLI + FastAPI),自包含权重下载器(缓存优先,429 退避)。

用法

CLI 单图推理:

python inference.py --img test_input.png --instruction "place the block on the table" --device npu:1

FastAPI 服务:

python inference.py --serve --port 8001 --device npu:1
curl -F "file=@test_input.png" http://127.0.0.1:8001/predict

推理输出: 30 步 × 20 维 ee6d 动作轨迹 (JSON),含 action_trajectory / inference_ms / npu_name / exit_status。

验证结果

  • CLI: PASS (npu:1, Ascend910_9362, inference_ms≈485ms, exit_status=0)
  • FastAPI: PASS (POST /predict 返回 [1,30,20] 动作轨迹, inference_ms≈492ms)
  • 截图: assets/agent_workflow.png · assets/npu_device_call.png · assets/model_result.png