| |
| """Upload AION to Hugging Face Hub. |
| |
| Do NOT hardcode your token in this file. Use: |
| export HF_TOKEN=hf_xxx |
| python upload_to_hf.py --repo_id YOUR_USERNAME/AION |
| """ |
| from __future__ import annotations |
| import argparse |
| import os |
| from pathlib import Path |
|
|
|
|
| def main(): |
| ap = argparse.ArgumentParser() |
| ap.add_argument("--repo_id", required=True, help="Example: username/AION") |
| ap.add_argument("--private", action="store_true") |
| args = ap.parse_args() |
| token = os.environ.get("HF_TOKEN") |
| if not token: |
| raise SystemExit("Missing HF_TOKEN env var. Set it without printing it: export HF_TOKEN=hf_...") |
| try: |
| from huggingface_hub import HfApi, create_repo, upload_folder |
| except Exception: |
| raise SystemExit("Install first: pip install huggingface_hub") |
|
|
| base = Path(__file__).resolve().parent |
| create_repo(args.repo_id, token=token, private=args.private, exist_ok=True, repo_type="model") |
| upload_folder( |
| repo_id=args.repo_id, |
| folder_path=str(base), |
| path_in_repo=".", |
| token=token, |
| repo_type="model", |
| commit_message="Upload AION unified hybrid assistant with local eval results", |
| ignore_patterns=["__pycache__/*", "*.pyc"], |
| ) |
| print(f"Uploaded to https://huggingface.co/{args.repo_id}") |
|
|
| if __name__ == "__main__": |
| main() |
|
|