In tests: Add use_videos=False by default, Create mp4 file if True, then fix test_datasets and test_aggregate (all passing)

This commit is contained in:
Remi Cadene
2025-05-12 15:37:02 +02:00
parent e88af0e588
commit e07cb52baa
7 changed files with 81 additions and 29 deletions
+2 -4
View File
@@ -63,6 +63,7 @@ from lerobot.common.datasets.utils import (
load_nested_dataset,
load_stats,
load_tasks,
safe_write_dataframe_to_parquet,
update_chunk_file_indices,
validate_episode_buffer,
validate_frame,
@@ -1008,10 +1009,7 @@ class LeRobotDataset(torch.utils.data.Dataset):
# Write the resulting dataframe from RAM to disk
path = self.root / self.meta.data_path.format(chunk_index=chunk_idx, file_index=file_idx)
path.parent.mkdir(parents=True, exist_ok=True)
if len(self.meta.image_keys) > 0:
datasets.Dataset.from_dict(df.to_dict(orient="list")).to_parquet(path)
else:
df.to_parquet(path)
safe_write_dataframe_to_parquet(df, path, self.meta.image_keys)
# Update the Hugging Face dataset by reloading it.
# This process should be fast because only the latest Parquet file has been modified.