Per-episode `data/file_index` / `data/chunk_index` metadata points at the wrong parquet files
Hi — while working with this dataset through lerobot (v3.0 dataset format, lerobot 0.5.2) I found that the per-episode file-location metadata in meta/episodes is inconsistent with where episode rows actually live in data/.
Reproduction:
import pandas as pd
from lerobot.datasets.lerobot_dataset import LeRobotDataset
ds = LeRobotDataset("HuggingFaceVLA/libero")
ep = 807 # first episode of the libero_object suite; many episodes are affected
row = ds.meta.episodes[ep]
print(row["data/chunk_index"], row["data/file_index"])
# -> chunk 0, file 37
df = pd.read_parquet(ds.root / "data/chunk-000/file-037.parquet", columns=["episode_index"])
print(sorted(set(df["episode_index"])))
# -> [90, 91, 92] — episode 807 is not in the file its metadata points to
# scanning data/ for episode 807's rows finds them in file-211 instead
What is still consistent: the global dataset_from_index / dataset_to_index values in meta/episodes are correct (frame windows line up with the concatenated data parquets, and the video pathway matches — I verified frames visually against task strings). So ordinary training/loading through LeRobotDataset works fine.
What breaks: anything that trusts the per-episode file pointers. lerobot's get_data_file_path() returns the wrong file, and dataset_tools.delete_episodes() crashes (KeyError in _copy_and_reindex_episodes_metadata) — and could silently corrupt output on datasets where the mismatch doesn't happen to crash. Episode-editing workflows on this dataset are effectively unusable until the metadata is regenerated.
Workaround for anyone hitting this: ignore the file-index columns and locate episodes by scanning the parquets' own episode_index column (or use the global from/to indices), e.g.:
for f in sorted((ds.root / "data").rglob("*.parquet")):
eps = set(pd.read_parquet(f, columns=["episode_index"])["episode_index"])
if ep in eps:
print(f) # the file that actually contains the episode
Would it be possible to regenerate the data/file_index / data/chunk_index columns in meta/episodes from the actual parquet contents? Happy to provide more examples of affected episodes if useful. Thanks for publishing the dataset!
We hit this independently in late July and can add quantification: it's not just "many episodes". Scanning all parquets and matching against meta/episodes, the per-episode data/chunk_index / data/file_index pointers are wrong for 1690 of 1693 episodes, across all four suites. Fully consistent with your findings: the global dataset_from_index / dataset_to_index are correct throughout (training via LeRobotDataset is unaffected), and only the file-pointer columns are stale.
One more breakage entry point beyond delete_episodes(): dataset_tools.split_dataset() crashes on the first episode (KeyError) for the same reason, so split/delete/merge are all effectively unusable on this dataset until the metadata is regenerated.
Workaround we used for a write path (building a modified dataset): ignore the pointer columns entirely and do manual parquet appends: hard-link the untouched files, then row-copy episodes located via each parquet's own episode_index column, and rebuild meta/episodes from what was actually written. Clunky but byte-exact; happy to share the script if useful.
+1 to regenerating data/file_index / data/chunk_index from the actual parquet contents.