CoolFace
Modelpublic

Spatial9/GravityLLM

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes
upload_to_hub.py32 linesDownload Raw Back to root
1import argparse2from pathlib import Path3 4from huggingface_hub import HfApi5 6 7def parse_args() -> argparse.Namespace:8    parser = argparse.ArgumentParser(description="Upload a local GravityLLM folder to the Hugging Face Hub.")9    parser.add_argument("--folder_path", type=Path, required=True, help="Local folder to upload.")10    parser.add_argument("--repo_id", type=str, required=True, help="Namespace/repo-name on Hugging Face.")11    parser.add_argument("--repo_type", type=str, default="model", choices=["model", "dataset", "space"])12    parser.add_argument("--private", action="store_true")13    parser.add_argument("--commit_message", type=str, default="Upload GravityLLM artifacts")14    return parser.parse_args()15 16 17def main() -> None:18    args = parse_args()19    api = HfApi()20    api.create_repo(repo_id=args.repo_id, repo_type=args.repo_type, private=args.private, exist_ok=True)21    api.upload_folder(22        folder_path=str(args.folder_path),23        repo_id=args.repo_id,24        repo_type=args.repo_type,25        commit_message=args.commit_message,26    )27    print(f"Uploaded {args.folder_path} to https://huggingface.co/{args.repo_id}")28 29 30if __name__ == "__main__":31    main()32