Skip to content

Add script to convert LeRobot v3 datasets to unifolm-wma format#43

Closed
brownwa wants to merge 1 commit into
unitreerobotics:mainfrom
brownwa:fix/lerobot-dataset-conversion
Closed

Add script to convert LeRobot v3 datasets to unifolm-wma format#43
brownwa wants to merge 1 commit into
unitreerobotics:mainfrom
brownwa:fix/lerobot-dataset-conversion

Conversation

@brownwa

@brownwa brownwa commented Apr 4, 2026

Copy link
Copy Markdown

Summary

  • The HuggingFace datasets in the unitreerobotics collection (e.g. G1_WBT_Brainco_Pickup_Pillow) are published in LeRobot v3.0 format, but WMAData (in src/unifolm_wma/data/wma_data.py) expects a different layout — causing a FileNotFoundError on {dataset_name}.csv at inference time.
  • Adds scripts/prepare_lerobot_dataset.py — a one-time conversion utility that reads the LeRobot parquet/video/stats files and produces the layout WMAData requires.
  • The converted layout matches what DataModuleFromConfig.setup() constructs in src/unifolm_wma/utils/data.py.

What the script generates

{dataset_dir}/
  {dataset_name}.csv                                     # one row per episode
  videos/{dataset_name}/{episode_idx}.mp4                # per-episode clips (ffmpeg trim)
  transitions/{dataset_name}/{episode_idx}.h5            # state + action arrays
  transitions/{dataset_name}/meta_data/stats.safetensors # normalizer stats

Usage

python scripts/prepare_lerobot_dataset.py \
    --dataset_dir ~/.cache/huggingface/hub/datasets--unitreerobotics--G1_WBT_Brainco_Pickup_Pillow/snapshots/<hash> \
    --dataset_name G1_WBT_Brainco_Pickup_Pillow

Optional flags: --camera_key, --action_key, --state_key, --instruction.

Test plan

  • Run prepare_lerobot_dataset.py on G1_WBT_Brainco_Pickup_Pillow
  • Confirm WMAData loads 300 samples without error
  • Confirm real_eval_server.py starts and serves successfully
  • Test on at least one other dataset from the unitreerobotics collection

Related

Fixes the FileNotFoundError reported in issue #XX.

🤖 Generated with Claude Code

The G1_WBT_Brainco_Pickup_Pillow dataset (and others in the unitreerobotics
HuggingFace collection) are published in LeRobot v3.0 format, but WMAData
expects a different layout:

  - {dataset_name}.csv  (one row per episode)
  - videos/{dataset_name}/{episode_idx}.mp4  (one file per episode)
  - transitions/{dataset_name}/{episode_idx}.h5  (state/action per episode)
  - transitions/{dataset_name}/meta_data/stats.safetensors

scripts/prepare_lerobot_dataset.py reads the LeRobot parquet/video/stats
files and produces the required layout, including ffmpeg-based per-episode
video clip extraction from the concatenated multi-episode video files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@brownwa

brownwa commented Apr 6, 2026

Copy link
Copy Markdown
Author

All changes from this PR are now included in PR #47 (consolidated branch unifolm-wbt-dataset), which combines this PR with #45 and the Brainco setup guide into a single clean branch. Closing this in favour of #47.

@brownwa

brownwa commented Apr 6, 2026

Copy link
Copy Markdown
Author

Superseded by PR #47.

@brownwa brownwa closed this Apr 6, 2026
@brownwa brownwa deleted the fix/lerobot-dataset-conversion branch April 6, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant