| """ | |
| Upload mathstral-nano-sat to HuggingFace Hub. | |
| Usage: | |
| pip install huggingface_hub | |
| python upload_to_hub.py --repo your-username/mathstral-nano-sat --token hf_... | |
| """ | |
| import argparse, os | |
| from huggingface_hub import HfApi, login | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--repo", required=True, help="HF repo id, e.g. alice/mathstral-nano-sat") | |
| parser.add_argument("--token", required=True, help="HuggingFace write token") | |
| parser.add_argument("--private", action="store_true", help="Make repo private") | |
| args = parser.parse_args() | |
| login(token=args.token) | |
| api = HfApi() | |
| api.create_repo(repo_id=args.repo, exist_ok=True, private=args.private) | |
| here = os.path.dirname(os.path.abspath(__file__)) | |
| api.upload_folder( | |
| folder_path = here, | |
| repo_id = args.repo, | |
| repo_type = "model", | |
| ignore_patterns= ["upload_to_hub.py"], | |
| commit_message = "Upload mathstral-nano-sat (NumPy fine-tuned SAT math model)", | |
| ) | |
| print(f"\nUploaded to: https://huggingface.co/{args.repo}") | |