Skip to content

Latest commit

 

History

History
114 lines (79 loc) · 3.82 KB

README.md

File metadata and controls

114 lines (79 loc) · 3.82 KB

Generate Lerobot Dataset from RoboTwin Data

This guide explains how to process raw data from RoboTwin and convert it into the LerobotDataset format following the official RoboTwin instructions.

1. Clone the Official RoboTwin Repository

git clone git@github.com:RoboTwin-Platform/RoboTwin.git

2. Create Required Directories

Navigate to the policy/pi0 directory inside the cloned RoboTwin repository and create the folders:

cd ./policy/pi0
mkdir processed_data training_data

3. Convert RoboTwin Raw Data to HDF5

Download official dataset and unzip the dataset to '/path/to/RoboTwin/data'

Example:

data
└── adjust_bottle
    └── aloha-agilex_clean_50

Use the provided script process_data_pi0.sh:

cd policy/pi0
bash process_data_pi0.sh ${task_name} ${task_config} ${expert_data_num}

Example (clean demo):

bash process_data_pi0.sh adjust_bottle aloha-agilex_clean_50 50

Example (randomized demo):

bash process_data_pi0.sh adjust_bottle aloha-agilex_randomized_500 50

If successful, the output folder:

processed_data/${task_name}-${task_config}-${expert_data_num}/

4. Prepare Training Data

Copy the required processed datasets into training_data/${model_name}:

cp -r processed_data/${task_name}-${task_config}-${expert_data_num} \
      training_data/${model_name}/

5. Ensure Sufficient Disk Space

The generated LerobotDataset will be stored under:

$XDG_CACHE_HOME/huggingface/lerobot/${repo_id}

By default, XDG_CACHE_HOME points to ~/.cache, which must have sufficient free space.
If space is low, change the cache location:

export XDG_CACHE_HOME=/path/to/your/cache

6. Generate LerobotDataset v2.1 Format

Run generate.sh to convert the HDF5 datasets to Lerobot.

Parameters:

  • hdf5_path: Path to the HDF5 training data (e.g., ./training_data/${model_name}/)
  • repo_id: Name for the dataset (e.g., my_repo)
bash generate.sh ${hdf5_path} ${repo_id}

Example:

bash generate.sh ./training_data/demo_clean/ demo_clean_repo

Output:

${XDG_CACHE_HOME}/huggingface/lerobot/${repo_id}

7. Merge Datasets

If you want to train on multiple RoboTwin 2.0 tasks jointly, you can merge them first. It is more efficient to merge datasets while they are still in LeRobot v2.1 format, and then convert the merged dataset to v3.0 in one go.

For example, to merge the 5 RoboTwin 2.0 tasks ("open_microwave", "click_bell", "stack_blocks_three", "place_shoe", "put_object_cabinet"), all belonging to the aloha-agilex robot, you can run:

python scripts/merge_lerobot_v21.py --sources path_to_open_microwave-aloha-agilex_clean_50-50,path_to_click_bell-aloha-agilex_clean_50-50,path_to_stack_blocks_three-aloha-agilex_clean_50-50,path_to_place_shoe-aloha-agilex_clean_50-50,path_to_put_object_cabinet-aloha-agilex_clean_50-50 --output path_to_merged_data

Important: Merged datasets must share the same robot embodiment, just like the data from these 5 tasks belongs to aloha-agilex in this case.

8. Convert to LerobotDataset v3.0 Format

LingbotVLA loads data through the LeRobot library (LeRobotDataset). Your dataset must be in LeRobot v3.0 format — either as a HuggingFace Hub repo or a local directory.

When the data in LeRobot v2.1 format has been prepared, you can use convert_dataset_v21_to_v30.py to quickly convert it to v3.0.