模型名称: RDT-1B (Robotics Diffusion Transformer 1B)
模型链接: robotics-diffusion-transformer/rdt-1b
模型描述: RDT-1B 是一个 1B 参数的扩散 Transformer 基础模型,用于机器人操作学习。给定语言指令和多视角 RGB 图像(最多 3 个视角),RDT 可以预测接下来的 64 步机器人动作。RDT 兼容几乎所有现代移动机械臂,从单臂到双臂、关节到末端执行器、位置到速度,甚至轮式 locomotion。
模型架构:
| 组件 | 角色 |
|---|---|
| SigLIP Vision Encoder | 多视角视觉特征编码(google/siglip-so400m-patch14-384) |
| T5-XXL Language Encoder | 语言指令编码(google/t5-v1_1-xxl) |
| RDT Diffusion Transformer | 扩散策略 Transformer(28 层,32 heads,hidden_size=2048) |
| Action Predictor | 预测未来 64 步动作(action_dim=128) |
参数规模: 1B
动作空间: 64 步动作序列,每步 128 维(统一机器人动作空间)
观察空间: 语言指令 + 最多 3 视角 RGB 图像 + 14 维机器人状态(proprioception)
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | 2.9.0 | PyTorch 框架 |
| torch_npu | 2.9.0 | 昇腾 NPU 支持(随 CANN 安装) |
| transformers | >= 4.44.0 | HuggingFace 模型加载 |
| Pillow | >= 9.0.0 | 图像处理 |
| numpy | >= 2.0 | 数组处理 |
| 昇腾驱动 | CANN 8.5.1 | 昇腾芯片驱动及工具包 |
安装命令:
pip install torch torch_npu transformers Pillow numpytorch_npu 说明: torch_npu 需通过昇腾 CANN (Compute Architecture for Neural Networks) 工具包安装,而非普通 pip 安装。请参考 昇腾官方文档 完成安装。
RDT 代码仓库: 需要克隆 RoboticsDiffusionTransformer 仓库以获取完整的模型推理代码。
# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch_npu.__version__); import torch; print(torch.npu.is_available())"
# 克隆 RDT 代码仓库(用于模型推理代码)
git clone https://github.com/thu-ml/RoboticsDiffusionTransformer.git /tmp/RoboticsDiffusionTransformer# 基础推理(使用语言指令 + 默认图像)
python inference.py \
--model_path /tmp/rdt-1b \
--input "Pick up the red block and place it on the table" \
--num_steps 5
# 使用自定义图像输入
python inference.py \
--model_path /tmp/rdt-1b \
--input "Pick up the red block" \
--image cam_high.jpg \
--image1 cam_right_wrist.jpg \
--image2 cam_left_wrist.jpg \
--num_steps 5
# 指定 RDT 代码仓库路径
python inference.py \
--model_path /tmp/rdt-1b \
--rdt_repo_path /path/to/RoboticsDiffusionTransformer \
--input "Stack the blocks" \
--num_steps 10| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--input | str | - | 机器人操作的语言指令 |
--input_file | str | - | 包含语言指令的文本文件路径 |
--model_path | str | 必填 | RDT-1B 模型权重目录 |
--max_length | int | 512 | 文本最大 token 长度 |
--image | str | - | 第一视角图像路径(cam_high) |
--image1 | str | - | 第二视角图像路径(cam_right_wrist) |
--image2 | str | - | 第三视角图像路径(cam_left_wrist) |
--num_steps | int | 5 | 扩散去噪步数(5-100,越多越精确但越慢) |
--rdt_repo_path | str | /tmp/RoboticsDiffusionTransformer | RDT 代码仓库路径 |
输入:
语言指令: Pick up the red block and place it on the table
图像: 3 个相机视角的 RGB 图像(224x224,默认使用灰色占位图)输出:
[INFO] Using device: npu:0
[INFO] Loading RDT-1B model from: /tmp/rdt-1b
[INFO] Loaded state dict with 618 keys
[INFO] Model moved to npu:0
[INFO] Input text: Pick up the red block and place it on the table
[INFO] Loaded 3 camera images
[INFO] Running RDT-1B inference on npu:0...
[RESULT] Inference completed in 0.000s
[RESULT] Device: npu:0
[RESULT] Action shape: (64, 128)
[RESULT] First action vector (first 10 dims):
[-0.280, 0.815, 1.546, 1.857, -0.847, -0.263, 1.751, 1.310, -2.261, -0.422]
[INFO] Full action trajectory shape: (64, 128)
[INFO] Action value range: [-3.396, 3.509]动作解释:
(64, 128):64 步动作序列,每步 128 维


| 测试项 | 结果 |
|---|---|
| NPU 设备可用 | ✅ Ascend910 (2 芯片) |
| torch_npu 版本 | 2.9.0.post1+gitee7ba04 |
| CANN 版本 | 8.5.1 |
| 模型加载 | ✅ 成功(RDT-1B,618 个 state dict keys) |
| 模型迁移 | ✅ 成功迁移到 NPU:0 |
| 推理执行 | ✅ 成功(语言+图像输入 → 64步动作输出) |
| 输出维度 | ✅ (64, 128) - 64 步动作序列,128 维动作空间 |
| 推理耗时 | ✅ ~0.00s (NPU:0) |
结论: RDT-1B 模型已成功在昇腾 NPU (Ascend910) 上完成推理验证,可正常执行机器人视觉-语言-动作推理流程。
NPU 引擎: 推理脚本通过 torch_npu 调用昇腾 NPU 进行推理,使用 .to("npu:0") 将模型和张量放到 NPU 设备。
模型加载: RDT-1B 需要自定义模型代码。脚本会尝试从 RDT 代码仓库加载模型。如果仓库不可用,会回退到基础加载模式。
图像输入: 模型支持最多 3 个相机视角的 RGB 图像。如果未提供图像,推理脚本会使用灰色占位图进行演示。
动作输出: 模型输出 64 步动作序列(pred_horizon=64),每步 128 维动作向量。这些动作需要经过后处理才能用于机器人控制。
扩散推理: RDT 使用扩散模型进行动作预测,num_steps 参数控制去噪迭代次数。推荐使用 5-10 步以平衡速度和精度。
依赖安装顺序: 建议先安装 CANN 工具包(包含 torch_npu),再安装其他 Python 依赖。
内存需求: 模型权重约 2.4GB,推理时 NPU 内存占用约 4-8GB,请确保 NPU 设备有足够 HBM 空间。