forge icon indicating copy to clipboard operation
forge copied to clipboard

LeRobot v2.0 to 3.0

Open MaggieK410 opened this issue 7 months ago • 4 comments

Hi, Thank you for building this very useful library! I tried using this library to convert a daraser from a LeRobot 2.0 to a v3.0 version but there seems to be some issue with the conversion. I am currently receiving the following error when trying to run my code with v3, suggesting that the conversion was not complete:

INFO 2026-05-05 07:01:53 ot_train.py:220 Logs will be saved locally.
INFO 2026-05-05 07:01:53 ot_train.py:236 Creating dataset
INFO 2026-05-05 07:01:56 eo_utils.py:110 Using video codec: libsvtav1
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/scripts/lerobot_train.py", line 599, in <module>
    main()
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/scripts/lerobot_train.py", line 595, in main
    train()
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/configs/parser.py", line 233, in wrapper_inner
    response = fn(cfg, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/scripts/lerobot_train.py", line 237, in train
    dataset = make_dataset(cfg)
              ^^^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/datasets/factory.py", line 90, in make_dataset
    dataset = LeRobotDataset(
              ^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/datasets/lerobot_dataset.py", line 234, in __init__
    if force_cache_sync or not self.reader.try_load():
                               ^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/datasets/dataset_reader.py", line 96, in try_load
    if not self._check_cached_episodes_sufficient():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/datasets/dataset_reader.py", line 154, in _check_cached_episodes_sufficient
    video_path = self.root / self._meta.get_video_file_path(ep_idx, vid_key)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/fswork/projects/rech/lhk/uqs25ws/lerobot/src/lerobot/datasets/dataset_metadata.py", line 276, in get_video_file_path
    chunk_idx = ep[f"videos/{vid_key}/chunk_index"]
                ~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'videos/observation.images.ego_view/chunk_index'

I converted my data with this command:

forge convert path/to/old_dataset ./new_dataset --format lerobot-v3

There were no issues during the conversion script.

I would be super grateful if you could help me solve this? Does the library expect 2.1 instead of 2.0? Thanks in advance!

MaggieK410 avatar May 05 '26 18:05 MaggieK410

Let me look into it. I am aware of L2->L3 issues and will be pushing fixes soon

arpitg1304 avatar May 13 '26 14:05 arpitg1304

Confirmed the bug — episodes.parquet was missing the per-video-key pointer columns (videos//chunk_index etc.) that upstream LeRobotDataset requires. Fixed in https://github.com/arpitg1304/forge/pull/15. Reproduced your exact KeyError with a synthetic test that's now green.

Could you re-convert your dataset against this branch and try running lerobot_train.py again? If it works, I'll merge.

pip install git+https://github.com/arpitg1304/forge.git@arpit_lerobot_v2_v3 forge convert path/to/old_dataset ./new_dataset --format lerobot-v3

arpitg1304 avatar May 26 '26 04:05 arpitg1304

@MaggieK410

arpitg1304 avatar May 26 '26 04:05 arpitg1304

Hi, sorry I had some other projects since I last looked at this. I tried your steps but did not get a changed result: I inspected the outputs after the conversion and I find that the chunk index is still not in the meta file. Maybe it would help to know that my info.json looks like this:

(lerobot_bubble) [uqs25ws@jean-zay1: chunk-000]$ cat ../../../../../red_cube_small_mini_dataset_GR1/meta/info.json
{
    "codebase_version": "v2.0",
    "robot_type": "GR1NYU",
    "total_episodes": 36,
    "total_frames": 9169,
    "total_tasks": 1,
    "total_videos": 36,
    "total_chunks": 1,
    "chunks_size": 36,
    "fps": 20.0,
    "splits": {
        "train": "0:100"
    },
    "data_path": "data/chunk-{episode_chunk:03d}/episode_{episode_index:06d}.parquet",
    "video_path": "videos/chunk-{episode_chunk:03d}/{video_key}/episode_{episode_index:06d}.mp4",
    "features": {
        "observation.state": {
            "dtype": "float64",
            "shape": [
                46
            ],
            "names": [
                "motor_0",
                "motor_1",
                "motor_2",
                "motor_3",
                "motor_4",
                "motor_5",
                "motor_6",
                "motor_7",
                "motor_8",
                "motor_9",
                "motor_10",
                "motor_11",
                "motor_12",
                "motor_13",
                "motor_14",
                "motor_15",
                "motor_16",
                "motor_17",
                "motor_18",
                "motor_19",
                "motor_20",
                "motor_21",
                "motor_22",
                "motor_23",
                "motor_24",
                "motor_25",
                "motor_26",
                "motor_27",
                "motor_28",
                "motor_29",
                "motor_30",
                "motor_31",
                "motor_32",
                "motor_33",
                "motor_34",
                "motor_35",
                "motor_36",
                "motor_37",
                "motor_38",
                "motor_39",
                "motor_40",
                "motor_41",
                "motor_42",
                "motor_43",
                "motor_44",
                "motor_45"
            ]
        },
        "action": {
            "dtype": "float64",
            "shape": [
                44
            ],
            "names": [
                "motor_0",
                "motor_1",
                "motor_2",
                "motor_3",
                "motor_4",
                "motor_5",
                "motor_6",
                "motor_7",
                "motor_8",
                "motor_9",
                "motor_10",
                "motor_11",
                "motor_12",
                "motor_13",
                "motor_14",
                "motor_15",
                "motor_16",
                "motor_17",
                "motor_18",
                "motor_19",
                "motor_20",
                "motor_21"
            ]
        },
        "timestamp": {
            "dtype": "float64",
            "shape": [
                1
            ]
        },
        "annotation.human.action.task_description": {
            "dtype": "int64",
            "shape": [
                1
            ]
        },
        "task_index": {
            "dtype": "int64",
            "shape": [
                1
            ]
        },
        "annotation.human.validity": {
            "dtype": "int64",
            "shape": [
                1
            ]
        },
        "episode_index": {
            "dtype": "int64",
            "shape": [
                1
            ]
        },
        "index": {
            "dtype": "int64",
            "shape": [
                1
            ]
        },
        "next.reward": {
            "dtype": "float64",
            "shape": [
                1
            ]
        },
        "next.done": {
            "dtype": "bool",
            "shape": [
                1
            ]
        },
        "observation.images.ego_view": {
            "dtype": "video",
            "shape": [
                256,
                256,
                3
            ],
            "names": [
                "height",
                "width",
                "channel"
            ],
            "video_info": {
                "video.fps": 20.0,
                "video.codec": "h264",
                "video.pix_fmt": "yuv420p",
                "video.is_depth_map": false,
                "has_audio": false
            }
        }
    }
}

MaggieK410 avatar Jul 20 '26 12:07 MaggieK410