File size: 1,609 Bytes
46300b3 e17c1ac 46300b3 e17c1ac 46300b3 e17c1ac 46300b3 e17c1ac 46300b3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | """Upload the project source to a HF dataset, mirrored at /code in the Job."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
from huggingface_hub import HfApi, create_repo
def main():
p = argparse.ArgumentParser()
p.add_argument("--repo", default="Dar3devil/promptops-arena-src")
p.add_argument("--root", default=".")
args = p.parse_args()
root = Path(args.root).resolve()
api = HfApi()
create_repo(args.repo, repo_type="dataset", exist_ok=True, private=True)
ignore_patterns = [
"**/__pycache__/**",
"**/.pytest_cache/**",
".pytest_cache/**",
"**/.benchmarks/**",
".benchmarks/**",
".git/**",
".git",
"outputs/**",
"**/*.pyc",
"**/*.pyo",
".venv/**",
"venv/**",
".env",
".env.local",
".vscode/**",
".idea/**",
".cursor/**",
".codex/**",
".claude/**",
".agents/**",
"AGENTS.md",
"wandb/**",
"*.log",
".DS_Store",
"BLOG.md",
"notebooks/**",
]
print(f"[upload] uploading {root} -> dataset {args.repo}")
api.upload_folder(
folder_path=str(root),
repo_id=args.repo,
repo_type="dataset",
ignore_patterns=ignore_patterns,
commit_message="sync source for HF Jobs training run",
)
print(f"[upload] done. https://huggingface.co/datasets/{args.repo}")
if __name__ == "__main__":
sys.exit(main() or 0)
|