Diffusion Transformer Policy

March 26, 2025 ยท View on GitHub

arXiv License: MIT Static Badge

Please refer to the extension repo:

Dita:Scaling Diffusion Transformer for Generalist Vision-Language-Action Policy

Installation

To run the code, you should install the requiresments. The code is run on python3.10 and pytorch 2.2.0, tensorflow==2.15.0, CUDA 12.1.

 pip install -r requirements.txt

Then, clone the code as follow,

git clone https://github.com/zhihou7/dit_policy

Model Checkpoints

We provide the corresponding models, that can be utilized for finetuing.

ModelDescriptionCheckpoint Path
DiT PolicyDiffusion Transformer PolicyGoogle Drive
DiT PolicyDiffusion Transformer Policy (w/o image augmentation)Google Drive
Diffusion MLP HeadTransformer with Diffusion Head Policy (w/o image augmentation)Google Drive

Training & Finetuning

PRETRAINING on OXE dataset

Before you run the code, you should update the s3 key "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "S3_ENDPOINT". We train the network with 32 GPUs.

python scripts/train_diffusion_oxe.py task_name=openx_full_train_o2_p32 dataset.traj_length=32 num_pred_action=31 scheduler_type=1 shuffle_buffer_size=128000 dataname=oxe_magic_soup_plus task_name=oxe_full_train_o2_p32_wotimestep_oxe_noclamp_filter batch_size=256 

We observe that image augmentation is beneficial for SimplerEnv in our experiments. If you want to use image augmentation, please add ``+image_aug=1''

Finetuning with Lora

Here, we provide an example for finetuning with lora, i.e., the 10-shot finetuning code on Real-Franka Arm.


python3 scripts/finetune_realdata.py +pretrained_path=dit_policy_checkpoint.pth dataset.traj_per_episode=16 dataset.traj_length=1 task_name=new_test_nodiffhead_few10_250124 num_pred_action=1 dataname=lab_907_1 batch_size=32 dataset.train_data_list=you pkl dataname file to include the collected pkl files name use_lora=True scheduler_type=0 dataset.num_given_observation=1  max_iters=10000

scheduler_type=0 indicates we use 100 DDPM training steps.

Fully Finetuning on CALVIN

At first, you should follow the instruction-calvin to install CALVIN environment.

we train the network with 4GPUs.

python scripts/train_diffusion_sim.py --config-name config_diffusion_calvin batch_size=32 dataset.traj_length=11 num_pred_action=10 task_name=calvin_exp dataset.num_given_observation=2 dataset=fix_camera use_close_loop_eval=True close_loop_eval.test_episodes_num=32 dataset.use_baseframe_action=True taskname=task_ABC_D dataname=calvin_mc close_loop_eval.eval_iters=10000 close_loop_eval.test_episodes_num=250 scheduler_type=0 wrap_grmg_data=2 +pretrained_path=dit_policy_checkpoint.pth +use_adjust_scheduler=true lr=0.0001 epoch=15 +min_lr_scale=0.01 scheduler.warmup_epochs=1

Simulation Benchmark Evaluations

LIBERO Simulation Benchmark Evaluations

MethodLIBERO-SpatialLIBERO-ObjectLIBERO-GoalLIBERO-LongAverage
Diffusion Policy from scratch78.392.5%68.3 %50.5 %72.4 %
Octo fine-tuned78.9 %85.7 %84.6%51.1 %75.1 %
OpenVLA fine-tuned84.7 %88.4 %79.2 %53.7 %76.5 %
ours fine-tuned84.2%96.3%85.4%63.8%82.4%

Calvin (ABC->D)

MethodInput12345Avg.Len.
RoboFlamingoS-RGB, G-RGB82.4%61.9%46.6%33.1%23.5%2.47
SuSIES-RGB87.0%69.0%49.0%38.0%26.0%2.69
GR-1S-RGB, G-RGB, P85.4%71.2%59.6%49.7%40.1%3.06
3D DiffuserS-RGBD, G-RGBD, Proprio, Cam92.2%78.7%63.9%51.2%41.2%3.27
ours w/o pretrainingStatic-RGB89.5%63.3%39.8%27.3%18.5%2.38
oursStatic-RGB94.5%82.5%72.8%61.3%50.0%3.61

Simulation Benchmark Evaluations

SimplerEnv

This evaluation is based on SimplerEnv

034568
coke_can/matching_avg0.72666666666666690.5670.7870.17nan0.163
coke_can/variant_avg0.60.490.8230.006nan0.545
coke_can/matching/horizontal0.85000000000000010.820.740.21nan0.27
coke_can/matching/vertical0.74000000000000010.330.740.21nan0.03
coke_can/matching/standing0.59000000000000010.550.880.09nan0.19
coke_can/variant/horizontal0.67999999999999990.5690.8220.005nan0.711
coke_can/variant/vertical0.50666666666666670.2040.7540.0nan0.271
coke_can/variant/standing0.61333333333333340.6980.8930.013nan0.653
move_near/variant0.52130892710661490.3230.7920.031nan0.477
move_near/matching0.491269401330376940.3170.7790.042nan0.462
drawer/matching_avg0.46296296296296290.5970.250.227nan0.356
drawer/variant_avg0.37523438443385370.2940.3530.011nan0.177
drawer/matching/open0.23148148148148150.2960.1570.009nan0.194
drawer/matching/close0.69444444444444430.8910.3430.444nan0.518
drawer/variant/open0.21555164412307270.0690.3330.0nan0.158
drawer/variant/close0.53491712474463470.5190.3720.021nan0.195
put_spoon_on_tablecloth/matching_partial0.250.167nan0.3470.7780.041
put_spoon_on_tablecloth/matching_entire0.166666666666666660.0nan0.1250.4720.0
put_carrot_on_plate/matching_partial0.208333333333333340.208nan0.5280.2780.333
put_carrot_on_plate/matching_entire0.166666666666666660.042nan0.0830.0970.0
stack_green_block_on_yellow_block/matching_partial0.083333333333333330.083nan0.3190.4030.125
stack_green_block_on_yellow_block/matching_entire0.00.0nan0.00.0420.0
put_eggplant_in_basket/matching_partial0.083333333333333330.0nan0.6670.8750.083
put_eggplant_in_basket/matching_entire0.00.0nan0.4310.5690.041
apple_in_drawer/matching_avg0.042037037037037030.2130.0370.00.0nan
apple_in_drawer/variant_avg0.0353550688568110140.1010.2060.00.0nan
modelsoursRT-1-XRT-2-XOcto-BaseOcto-SmallOpenVLA

In our experiments, we use the Bridge_orig from tfds in google cloud, in which the image has been resized (480*512->224*224) and caused image distortion. We think this part might significantly affect the evaluation on bridige. Please notice that RT-2-X is a huge model with web-scale data.

Real Franka Demonstration

Please refer to the project page.

Acknowledgement

The dataloader code of OXE is based on OpenVLA, The dataloader code of CALVIN is based on GR-MG, The architecture is based on transformers.

Citation

If you find our code or models useful in your work, please cite our paper:

@article{hou2024diffusion,
  title={Diffusion Transformer Policy},
  author={Hou, Zhi and Zhang, Tianyi and Xiong, Yuwen and Pu, Hengjun and Zhao, Chengyang and Tong, Ronglei and Qiao, Yu and Dai, Jifeng and Chen, Yuntao},
  journal={arXiv preprint arXiv:2410.15959},
  year={2024}
}