mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-17 09:39:47 +00:00
Merge branch 'main' into feat/minimal_default_install
This commit is contained in:
@@ -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 ──────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user