fix segmentation fault and buy a yamazaki 2012 whiskey of the year edition to Alexander

This commit is contained in:
Cadene 2024-05-01 17:44:49 +00:00
parent cdaaa16a71
commit a00102b643
2 changed files with 6 additions and 1 deletions

View File

@ -19,7 +19,7 @@ def get_stats_einops_patterns(dataset: LeRobotDataset | datasets.Dataset):
dataloader = torch.utils.data.DataLoader(
dataset,
num_workers=0,
num_workers=1, # do not set to 0 when using `load_from_videos`
batch_size=2,
shuffle=False,
)

View File

@ -13,6 +13,11 @@ from datasets.features.features import register_feature
def load_from_videos(
item: dict[str, torch.Tensor], video_frame_keys: list[str], videos_dir: Path, tolerance_s: float
):
"""Note: When using data workers (e.g. DataLoader with num_workers>0), do not call this function
in the main process (e.g. by using a second Dataloader with num_workers=0). It will result in a Segmentation Fault.
This probably happens because a memory reference to the video loader is created in the main process and a
subprocess fails to access it.
"""
# since video path already contains "videos" (e.g. videos_dir="data/videos", path="videos/episode_0.mp4")
data_dir = videos_dir.parent