Buckets:
| #!/usr/bin/env python3 | |
| import argparse | |
| import csv | |
| from pathlib import Path | |
| REQUIRED = ["path", "text", "num_frames", "height", "width", "aspect_ratio", "resolution", "fps"] | |
| def main(): | |
| p = argparse.ArgumentParser() | |
| p.add_argument("--csv", required=True) | |
| p.add_argument("--video-root", default="") | |
| p.add_argument("--limit", type=int, default=0) | |
| args = p.parse_args() | |
| with open(args.csv, newline="", encoding="utf-8") as f: | |
| rows = list(csv.DictReader(f)) | |
| if not rows: | |
| raise SystemExit("Manifest is empty") | |
| missing = [c for c in REQUIRED if c not in rows[0]] | |
| if missing: | |
| raise SystemExit(f"Missing columns: {missing}") | |
| root = Path(args.video_root) if args.video_root else None | |
| checked = 0 | |
| missing_files = [] | |
| for row in rows[: args.limit or None]: | |
| path = Path(row["path"]) | |
| if not path.is_absolute() and root: | |
| path = root / path | |
| if not path.exists(): | |
| missing_files.append(str(path)) | |
| if not str(row["text"]).strip(): | |
| raise SystemExit(f"Empty caption for row: {row}") | |
| checked += 1 | |
| print(f"Rows: {len(rows)}") | |
| print(f"Checked: {checked}") | |
| if missing_files: | |
| print(f"Missing video files: {len(missing_files)}") | |
| for x in missing_files[:20]: | |
| print(x) | |
| raise SystemExit(2) | |
| print("Manifest validation OK") | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 1.44 kB
- Xet hash:
- 20ba7031f55e3552d2771eab1bd2d65562610ec966d2621d15198ccfb16d936b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.