mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
fix(dataset): adding metadata loading when reading from a dataset after writing (#3305)
* fix(one shot load): adding metadata loading when reading from a dataset after writing * refactor(one shot load): move metadata reload to ensure_readable() on LeRobotDatasetMetadata Move the metadata reload from DatasetReader.load_and_activate() to a new public ensure_readable() method on LeRobotDatasetMetadata, called from LeRobotDataset._ensure_reader(). This places lifecycle management in the right layer: metadata owns its readiness check, the dataset orchestrates the write-to-read transition, and the reader stays clean. Also adds a regression test using delta_timestamps to exercise the meta.episodes access path in the create -> write -> finalize -> read flow. Co-authored-by: Steven Palma <imstevenpmwork@users.noreply.github.com> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Steven Palma <imstevenpmwork@users.noreply.github.com>
This commit is contained in:
@@ -278,6 +278,7 @@ class LeRobotDataset(torch.utils.data.Dataset):
|
||||
def _ensure_reader(self) -> DatasetReader:
|
||||
"""Lazily create the reader on first access."""
|
||||
if self.reader is None:
|
||||
self.meta.ensure_readable()
|
||||
self.reader = DatasetReader(
|
||||
meta=self.meta,
|
||||
root=self.root,
|
||||
|
||||
Reference in New Issue
Block a user