Download Biomanus-V2/Experiment1/scripts/export_items.py from czty/BioOcto: direct link, hf CLI and curl.
- Browser
- Download file 943 Bytes
-
https://huggingface.co/datasets/czty/BioOcto/resolve/main/Biomanus-V2/Experiment1/scripts/export_items.py
- Command line
-
hf download hf://datasets/czty/BioOcto/Biomanus-V2/Experiment1/scripts/export_items.py
-
curl -L -o export_items.py https://huggingface.co/datasets/czty/BioOcto/resolve/main/Biomanus-V2/Experiment1/scripts/export_items.py
943 Bytes
| #!/usr/bin/env python3 | |
| """Export one JSON file per dataset item for frozen LLM generation jobs.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from common import read_json, write_json | |
| def main() -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--manifest", type=Path, required=True) | |
| parser.add_argument("--split", choices=("development", "test", "all"), default="all") | |
| parser.add_argument("--out", type=Path, required=True) | |
| args = parser.parse_args() | |
| payload = read_json(args.manifest) | |
| count = 0 | |
| for item in payload["items"]: | |
| if args.split != "all" and item["split"] != args.split: | |
| continue | |
| write_json(args.out / f"{item['server_name']}.json", item) | |
| count += 1 | |
| print(json.dumps({"exported": count, "output": str(args.out)}, indent=2)) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |