Download scripts/make_cil_collection.py from anhtld/vla: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/anhtld/vla/resolve/54392df34e2e9dc095c0fddda77e00a4e67f8ed0/scripts/make_cil_collection.py
- Command line
-
hf download hf://anhtld/vla@54392df34e2e9dc095c0fddda77e00a4e67f8ed0/scripts/make_cil_collection.py
-
curl -L -o make_cil_collection.py https://huggingface.co/anhtld/vla/resolve/54392df34e2e9dc095c0fddda77e00a4e67f8ed0/scripts/make_cil_collection.py
1.22 kB
| #!/usr/bin/env python | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import sys | |
| from pathlib import Path | |
| PROJECT_ROOT = Path(__file__).resolve().parents[1] | |
| if str(PROJECT_ROOT) not in sys.path: | |
| sys.path.insert(0, str(PROJECT_ROOT)) | |
| from dovla_cil.data.datasets import CILDataset, write_cil_collection # noqa: E402 | |
| def main(argv: list[str] | None = None) -> int: | |
| parser = argparse.ArgumentParser( | |
| description="Create a zero-copy collection over multiple CIL datasets." | |
| ) | |
| parser.add_argument("--sources", nargs="+", type=Path, required=True) | |
| parser.add_argument("--out", type=Path, required=True) | |
| parser.add_argument("--name", default="dovla_cil_collection") | |
| args = parser.parse_args(argv) | |
| path = write_cil_collection(args.out, args.sources, dataset_name=args.name) | |
| dataset = CILDataset(args.out) | |
| print( | |
| json.dumps( | |
| { | |
| "collection": str(path), | |
| "num_sources": len(args.sources), | |
| "num_groups": len(dataset.group_ids), | |
| "num_records": len(dataset), | |
| }, | |
| indent=2, | |
| ) | |
| ) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |