--- license: mit task_categories: - video-classification - multiple-choice size_categories: 1K /tmp/make_pendulum_shards.py <<'PY' from pathlib import Path import json import webdataset as wds data = Path.home() / "Downloads" / "pendulum-cjepa-3k-clevrer" expected_counts = {"train": 2400, "val": 600} for split, expected in expected_counts.items(): source = data / "videos" / split files = sorted(source.glob("*.mp4")) if len(files) != expected: raise RuntimeError(f"{source}: expected {expected} MP4s, found {len(files)}") output = data / "wds" / split output.mkdir(parents=True, exist_ok=True) pattern = str(output / f"pendulum-{split}-%06d.tar") with wds.ShardWriter(pattern, maxcount=128) as sink: for path in files: sink.write({ "__key__": path.stem, "video.mp4": path.read_bytes(), "meta.json": json.dumps({ "split": split, "filename": path.name, }).encode("utf-8"), }) print(f"{split}: wrote {len(files)} videos to {output}") PY python /tmp/make_pendulum_shards.py ```