Merge branch 'main' into feat/minimal_default_install

This commit is contained in:
Steven Palma
2026-04-10 20:57:38 +02:00
committed by GitHub
3 changed files with 36 additions and 0 deletions
+25
View File
@@ -535,6 +535,31 @@ def test_getitem_works_after_finalize(tmp_path):
assert "task" in item
def test_getitem_after_finalize_with_delta_timestamps(tmp_path):
"""After finalize(), dataset[0] works when delta_timestamps require episode metadata.
Regression test for https://github.com/huggingface/lerobot/pull/3305.
The create -> write -> finalize -> read path left meta.episodes as None
because the write path flushes episodes to disk without updating them
in memory. Features that access meta.episodes (video decoding,
delta_timestamps) would crash with a TypeError.
"""
dataset = LeRobotDataset.create(
repo_id=DUMMY_REPO_ID, fps=DEFAULT_FPS, features=SIMPLE_FEATURES, root=tmp_path / "ds"
)
for _ in range(5):
dataset.add_frame(_make_frame())
dataset.save_episode()
dataset.finalize()
# Set delta_timestamps so get_item() accesses meta.episodes via _get_query_indices
dataset.delta_timestamps = {"state": [0.0]}
item = dataset[0]
assert "state" in item
assert "state_is_pad" in item
# ── Property delegation ──────────────────────────────────────────────