模型名称: RDT2-VQ (robotics-diffusion-transformer/RDT2-VQ)
模型链接: HuggingFace
模型描述: Robotics Diffusion Transformer with VQ tokenization,用于双机械臂操作任务的视觉条件化扩散策略。模型接收图像和语言指令,输出离散化的动作轨迹 token(关节角度/角速度)。
模型架构: Qwen2_5_VLForConditionalGeneration(基于 Qwen2.5-VL-7B)
参数规模: ~7.5B
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch-npu | >= 2.4.x | 昇腾 NPU 后端 |
| vllm | 0.18.0 | 推理引擎 |
| vllm-ascend | 兼容 vllm 0.18.0 | 昇腾适配插件 |
| transformers | >= 4.36.0 | 模型加载 |
| sentencepiece | >= 0.1.99 | Tokenizer |
| protobuf | >= 3.20.0 | 模型序列化 |
| 昇腾驱动 | CANN 8.5.x | 推荐 CANN 8.5.1 |
安装命令:
pip install torch-npu vllm vllm-ascend transformers sentencepiece protobufQwen2_5_VLForConditionalGeneration 被 vLLM 0.18.0 原生支持text_config.hidden_size = 3584text_config.num_hidden_layers = 28vision_config.hidden_size = 1280vocab_size = 152064TORCH_SDPA backend| 指标 | 值 |
|---|---|
| 权重加载时间 | 87.3s(4 shards,46.7s 纯加载) |
| 单卡显存占用 | 7,848.6 MB |
| KV Cache 可用 | 44.90 GiB |
| 最大并发 | 410.5x(seq_len=4096) |
| 单次推理耗时 | 1.06s(max_tokens=128) |
| 推理后端 | vLLM enforce_eager 模式 |
Prompt: system
You are a helpful assistant.
user
Hello, how many roads must a man walk down?
assistant
Output: [action token output - robotics diffusion model]
Inference time: 1.06s注意:RDT2-VQ 是机器人扩散模型,输出 token 代表动作轨迹(离散化的关节角度/角速度),而非自然语言。解码输出为非 ASCII 字符是预期行为。
# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"将权重文件放置到 weights_final/ 目录下:
weights_final/
├── model.safetensors.index.json
├── model-00001-of-00004.safetensors # 459 tensors, 4,738 MB
├── model-00002-of-00004.safetensors # 131 tensors, 4,760 MB
├── model-00003-of-00004.safetensors # 122 tensors, 4,704 MB
├── model-00004-of-00004.safetensors # 17 tensors, 1,614 MB
├── config.json
├── tokenizer.json
└── tokenizer_config.json# 基础推理(文本 prompt)
python inference.py --prompt "pick up the red block and place it on the table"
# 指定最大序列长度(OOM 时降级)
python inference.py --max-model-len 2048
# 自定义生成长度
python inference.py --max-tokens 256from vllm import LLM, SamplingParams
llm = LLM(
model="/path/to/weights_final",
tensor_parallel_size=2,
max_model_len=4096,
max_num_seqs=1,
trust_remote_code=True,
dtype="bfloat16",
enforce_eager=True,
)
tokenizer = llm.get_tokenizer()
sampling = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=128)
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "pick up the block"}],
tokenize=False,
add_generation_prompt=True,
)
outputs = llm.generate([prompt], sampling)
print(outputs[0].outputs[0].text)| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径(weights_final/) |
| --tensor-parallel-size | int | 2 | NPU 卡数 |
| --max-model-len | int | 4096 | 最大序列长度 |
| --max-tokens | int | 128 | 最大生成 token 数 |
| --prompt | str | - | 推理 prompt |
[模型] RDT2-VQ
[设备] Ascend910_9362 (npu:0, 2x NPU tensor parallel)
[输入] text prompt: "pick up the red block and place it on the table"
[输出] action token sequence (VQ discretized joint angles)
[耗时] 1.06s (max_tokens=128)
[状态] SUCCESS运行命令:
python inference.py --prompt "pick up the red block and place it on the table"输出:
[action token output - robotics diffusion model]
Inference time: 1.06s运行命令:
python inference.py --max-model-len 2048输出:
Max model length set to 2048
Model loaded successfully.
Inference complete.


测试数据: LIBERO 基准测试集
评测指标:
| 指标 | 结果 | 说明 |
|---|---|---|
| 权重加载时间 | 87.3s | 4 shards 总加载时间 |
| 单卡显存占用 | 7,848.6 MB | 模型加载后单卡 HBM |
| KV Cache 可用 | 44.90 GiB | 单卡剩余可用显存 |
| 推理耗时 | 1.06s | max_tokens=128, enforce_eager |
评测命令:
python inference.py --model-path /tmp/adapt_robotics-diffusion-transformer_rdt2-vq/weights_final --prompt "pick up the red block"| 项目 | 值 |
|---|---|
| NPU 型号 | 2x Ascend910_9362 |
| 单卡 HBM | 65,536 pages(约 64 GB) |
| 推理后端 | vLLM 0.18.0 + vllm-ascend |
| 算子依赖 | torch-npu 2.4.x / CANN 8.5.x |
| Tensor Parallel | 2 |
| 量化 | BF16 |
transformers 的 tokenizer 时,某些特殊 token 的 decode 可能产生非预期字符。建议使用模型配套的 chat template。/opt/atomgit/.cache/vllm/ 时可能出现 Disk quota exceeded,这是非致命的,不影响模型加载和推理。