模型: 2toINF/X-VLA-Pt — 0.9B 视觉-语言-动作 (Vision-Language-Action, VLA) 策略模型。 本仓库为该模型在 昇腾 910 (torch-npu) 上的适配工程, 提供
inference.py双模式推理入口 (CLI + FastAPI)。
X-VLA-Pt 是一个端到端 VLA (Vision-Language-Action) 模型, 接收 图像 与 语言指令, 输出机器人的 动作轨迹 (end-effector 位姿 + 夹爪)。
ee6d (end-effector xyz + 6D 旋转 + 夹爪), dim_action = 20num_actions = 30| 项 | 说明 |
|---|---|
| 输入图像 | 1 张或多张视角图像 (PIL / JPEG), 预处理至 224×224, 归一化 (CLIP mean/std) |
| 输入指令 | 自然语言文本, 如 "pick up the red block" |
| 输出动作 | actions: 形状 [30, 20] 的浮点数组 (30 步 × 20 维 ee6d 动作) |
| 动作语义 | 通道 0-2/10-12: xyz 位置(缩放 500); 3-8/13-18: 6D 旋转(缩放 10); 9/19: 夹爪开合(sigmoid) |
.cuda() / torch.cuda.* / device="cuda" / CUDA_VISIBLE_DEVICES / cudnn.*)。npu:N; 入口 import torch_npu 并 torch.npu.set_device(N)。modeling_xvla.py / modeling_florence2.py / processing_xvla.py / transformer.py /
action_hub.py 经审查不含任何 CUDA 代码; Florence2 的 flash-attn 为条件导入, 未安装时自动回落到 eager/SDPA 注意力。AutoModel.from_pretrained(..., trust_remote_code=True, torch_dtype=torch.bfloat16)。pip install -r requirements.txtpython inference.py --img test_input.png --text "pick up the red block" --device npu:1输出 JSON, 含 actions (30×20), last_action, last_gripper, exit_status, inference_ms 等。
python inference.py --serve --port 8000 # 默认 device=npu:1请求:
curl -F "file=@test_input.png" -F "text=pick up the red block" http://127.0.0.1:8000/predict返回与 CLI 相同的 JSON 推理结果。
权重自动从 hf-mirror.com (回退 ai.gitcode.com/hf_mirrors) 下载并缓存到 ./model_weights/X-VLA-Pt/,
已缓存直接复用 (打印 [cache-hit]), 可用 --force_download 强制重下。
assets/agent_workflow.png — NPU 部署依赖安装 + 任务启动总日志assets/npu_device_call.png — CLI 命令行推理成功输出assets/model_result.png — FastAPI 返回推理结果模型 Apache-2.0 (来源 2toINF/X-VLA-Pt)。