Download scripts/upload.py from anonymous-quantinv/quantinvbench: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/datasets/anonymous-quantinv/quantinvbench/resolve/bcc98e760df1ce784d6aa0208611dc14f49df472/scripts/upload.py
- Command line
-
hf download hf://datasets/anonymous-quantinv/quantinvbench@bcc98e760df1ce784d6aa0208611dc14f49df472/scripts/upload.py
-
curl -L -o upload.py https://huggingface.co/datasets/anonymous-quantinv/quantinvbench/resolve/bcc98e760df1ce784d6aa0208611dc14f49df472/scripts/upload.py
1.37 kB
| #!/usr/bin/env python3 | |
| """Create or update a Hugging Face Dataset repository from hf_release.""" | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("repo_id", help="Hugging Face repository, for example org/quantinvbench") | |
| parser.add_argument("--private", action="store_true") | |
| parser.add_argument("--revision", default="main") | |
| args = parser.parse_args() | |
| release_root = Path(__file__).resolve().parents[1] | |
| required = [release_root / "README.md", release_root / "LICENSE", release_root / "data" / "manifest.json"] | |
| missing = [str(path) for path in required if not path.exists()] | |
| if missing: | |
| raise FileNotFoundError(f"Release is incomplete: {missing}") | |
| api = HfApi() | |
| api.create_repo(args.repo_id, repo_type="dataset", private=args.private, exist_ok=True) | |
| api.upload_folder( | |
| repo_id=args.repo_id, | |
| repo_type="dataset", | |
| revision=args.revision, | |
| folder_path=release_root, | |
| ignore_patterns=["__pycache__/**", "*.pyc", ".pytest_cache/**", "cache/**"], | |
| commit_message="Publish QuantInvBench dataset", | |
| ) | |
| print(f"Uploaded https://huggingface.co/datasets/{args.repo_id}") | |
| if __name__ == "__main__": | |
| main() | |