模型名称: XiaomiRobotics/Xiaomi-Robotics-0-LIBERO
模型链接: HuggingFace
模型描述: MiBoT (Mi Robotics Behavior Transformer) 是一个视觉-语言-动作(Vision-Language-Action, VLA)机器人操作模型,基于 Qwen3-VL-4B 视觉语言模型和 DiT(Diffusion Transformer)动作预测头构建。模型接收机器人第一人称视角图像和自然语言指令,输出机器人动作序列。
模型架构:
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| transformers | >= 4.50.0 | HuggingFace Transformers |
| Pillow | >= 9.0 | 图像处理 |
| numpy | >= 1.20 | 数组处理 |
| huggingface_hub | >= 0.20.0 | 模型下载(注意:需 < 0.36 避免 strict dataclass 兼容问题) |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
NPU 硬件: 2x Ascend910_9362(共 128 GB HBM)
安装命令:
pip install torch torch_npu transformers Pillow numpy huggingface_hub# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:HuggingFace(推荐)
hf download XiaomiRobotics/Xiaomi-Robotics-0-LIBERO --local-dir /path/to/mibot_model方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
https://gitcode.com/gcw_coj3XaOd/XiaomiRobotics_Xiaomi-Robotics-0-LIBERO单条推理:
python inference.py \
--model-path /path/to/mibot_model \
--image /path/to/robot_view.jpg \
--text "pick the red apple from the table"批量推理:
python inference.py \
--model-path /path/to/mibot_model \
--image /path/to/robot_view.jpg \
--text "pick the red apple from the table" \
--batch-size 4| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --image | str | 必填 | 输入图像路径 |
| --text | str | "pick the red apple from the table" | 自然语言指令 |
| --batch-size | int | 1 | 批处理大小 |
| --num-steps | int | 5 | Diffusion 采样步数 |
| --seed | int | 42 | 随机种子 |
| --device | str | "npu:0" | 设备 |
| --dtype | str | "bfloat16" | 数据类型 |
[模型] MiBoTForActionGeneration
[设备] Ascend910_9362 (npu:0)
[参数量] 4,716,274,176 (4.72B)
[NPU内存] 9,071 MB allocated
[状态] SUCCESS[输入] text="pick the red apple from the table", image=224x224, state=(1,32)
[输出] actions=(30, 32), range=[-3.5625, 3.5469], mean=-0.0430
[状态] SUCCESS[输入] text="pick the red apple from the table", image=448x448, state=(1,32)
[输出] actions=(30, 32), range=[-3.6406, 3.5312], mean=-0.0496
[状态] SUCCESS[输入] batch=4, image=448x448
[输出] actions=(4, 30, 32)
sample 0: range=[-3.6406, 3.5312]
sample 1: range=[-4.1250, 4.3438]
sample 2: range=[-3.9844, 4.1250]
sample 3: range=[-4.9688, 3.4375]
[状态] SUCCESS运行命令:
python inference.py \
--model-path /path/to/mibot_model \
--image examples/robot_view_224.jpg \
--text "pick the red apple from the table"输出:
============================================================
TEST: small image 224x224
============================================================
Output shape: (1, 30, 32)
Range: [-3.5625, 3.5469]
Mean: -0.0430
PASS运行命令:
python inference.py \
--model-path /path/to/mibot_model \
--image examples/robot_view_448.jpg \
--text "pick the red apple from the table"输出:
============================================================
TEST: large image 448x448
============================================================
Output shape: (1, 30, 32)
Range: [-3.6406, 3.5312]
Mean: -0.0496
PASS运行命令:
python inference.py \
--model-path /path/to/mibot_model \
--image examples/robot_view_448.jpg \
--text "pick the red apple from the table" \
--batch-size 4输出:
============================================================
TEST: Batch inference (batch_size=4)
============================================================
Output shape: (4, 30, 32)
sample 0: shape=(30, 32), range=[-3.6406, 3.5312]
sample 1: shape=(30, 32), range=[-4.1250, 4.3438]
sample 2: shape=(30, 32), range=[-3.9844, 4.1250]
sample 3: shape=(30, 32), range=[-4.9688, 3.4375]
PASS


MiBoT 的视觉编码器使用 Conv3d 处理时空 patch,要求输入为 5D tensor:
# 正确格式: (B, 3, temporal_patch_size, H, W)
pixel_values = torch.rand(1, 3, 2, 448, 448, device=device, dtype=torch.bfloat16)内部执行:
hidden_states = hidden_states.view(-1, 3, temporal_patch_size, patch_size, patch_size)
# (1*448*448, 3, 2, 16, 16) -> groups of 2 frames each of 16x16 patchesimage_grid_thw 使用 原始 patch 单位(非合并后):
# 对于 448x448 图像, patch_size=16: grid = 28x28 (raw patches)
image_grid_thw = torch.tensor([[1, 28, 28]], device=device, dtype=torch.long)
# 内部会自动计算合并后: 28*28 // (2*2) = 196 tokenstransformers 4.57.x 与 huggingface_hub >= 0.36 存在 strict dataclass 验证冲突(str | None 类型不被支持)。解决方案:
# 从 config.json 中移除 transformers_version 字段
import json
with open("config.json") as f:
cfg = json.load(f)
cfg.pop("transformers_version", None)huggingface_hub >= 0.36 与 transformers 4.57.x 存在 strict dataclass 类型验证冲突,需移除 config.json 中的 transformers_version 字段