Views
No views yet
float32.robotics-diffusion-transformer/RVQActionTokenizer| Mode | RAM | VRAM | Example GPU |
|---|---|---|---|
| Inference | ≥ 32 GB | ≥ 16 GB | RTX 4090 |
| LoRA FT | – | ≥ 32 GB | A100 40GB |
| Full FT | – | ≥ 80 GB | A100 80GB / H100 / B200 |
For deployment on real robots, follow your platform’s end-effector + camera choices and perform hardware setup & calibration (camera stand/pose, flange, etc.) before running closed-loop policies.
1# Run under repository: https://github.com/thu-ml/RDT2
2
3import torch
4from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
5
6from vqvae import MultiVQVAE
7from models.normalizer import LinearNormalizer
8from utils import batch_predict_action
9
10# assuming using gpu 0
11device = "cuda:0"
12
13
14processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
15model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
16 "robotics-diffusion-transformer/RDT2-VQ"
17 torch_dtype=torch.bfloat16,
18 attn_implementation="flash_attention_2",
19 device_map=device
20).eval()
21vae = MultiVQVAE.from_pretrained("robotics-diffusion-transformer/RVQActionTokenizer").eval()
22vae = vae.to(device=device, dtype=torch.float32)
23
24valid_action_id_length = (
25 vae.pos_id_len + vae.rot_id_len + vae.grip_id_len
26)
27# TODO: modify to your own downloaded normalizer path
28# download from http://ml.cs.tsinghua.edu.cn/~lingxuan/rdt2/umi_normalizer_wo_downsample_indentity_rot.pt
29normalizer = LinearNormalizer.from_pretrained("umi_normalizer_wo_downsample_indentity_rot.pt") #
30
31result = batch_predict_action(
32 model,
33 processor,
34 vae,
35 normalizer,
36 examples=[
37 {
38 "obs": {
39 # NOTE: following the setting of UMI, camera0_rgb for right arm, camera1_rgb for left arm
40 "camera0_rgb": ..., # RGB image in np.ndarray of shape (1, 384, 384, 3) with dtype=np.uint8
41 "camera1_rgb": ..., # RGB image in np.ndarray of shape (1, 384, 384, 3) with dtype=np.uint8
42 },
43 "meta": {
44 "num_camera": 2
45 }
46 },
47 ..., # we support batch inference, so you can pass a list of examples
48 ],
49 valid_action_id_length=valid_action_id_length,
50 apply_jpeg_compression=True,
51 # Since model is trained with mostly jpeg images, we suggest toggle this on for better formance
52 instruction="Pick up the apple."
53 # We suggest using Instruction in format "verb + object" with Capitalized First Letter and trailing period
54)
55
56# get the predict action from example 0
57action_chunk = result["action_pred"][0] # torch.FloatTensor of shape (24, 20) with dtype=torch.float32
58# action_chunk (T, D) with T=24, D=20
59# T=24: our action_chunk predicts the future 0.8s in fps=30, i.e. 24 frames
60# D=20: following the setting of UMI, we predict the action for both arms from right to left
61# - [0-2]: RIGHT ARM end effector position in x, y, z (unit: m)
62# - [3-8]: RIGHT ARM end effector rotation in 6D rotation representation
63# - [9]: RIGHT ARM gripper width (unit: m)
64# - [10-12]: LEFT ARM end effector position in x, y, z (unit: m)
65# - [13-18]: LEFT ARM end effector rotation in 6D rotation representation
66# - [19]: LEFT ARM gripper width (unit: m)
67
68# rescale gripper width from [0, 0.088] to [0, 0.1]
69for robot_idx in range(2):
70 action_chunk[:, robot_idx * 10 + 9] = action_chunk[:, robot_idx * 10 + 9] / 0.088 * 0.1For installation and fine-tuning instructions, please refer to the official GitHub repository.
| Symptom | Likely cause | Suggested fix |
|---|---|---|
| Drifting / unstable gripper widths | Scale mismatch | Apply LinearNormalizer; rescale widths ([0,0.088] → [0,0.1]). |
| Poor instruction following | Prompt format | Use “Verb + Object.” with capitalization + period. |
| No improvement after FT | OOD actions | Check RVQ bounds & reconstruction error; verify normalization. |
| Vision brittleness | JPEG gap | Enable --image_corruption; ensure 384×384 inputs. |
1@article{liu2026rdt2,
2 title={RDT2: Exploring the Scaling Limit of UMI Data Towards Zero-Shot Cross-Embodiment Generalization},
3 author={Liu, Songming and Li, Bangguo and Ma, Kai and Wu, Lingxuan and Tan, Hengkai and Ouyang, Xiao and Su, Hang and Zhu, Jun},
4 journal={arXiv preprint arXiv:2602.03310},
5 year={2026}
6}