atakan Claude Sonnet 5 commited on
Commit
16e21ec
·
1 Parent(s): f803d3f

chore: Track scripts/upload_to_hf.py

Browse files

Correct, working uploader for the fused model (fixed earlier this
session); was sitting untracked instead of committed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/upload_to_hf.py +38 -0
scripts/upload_to_hf.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Upload fused ControlAI model directly from local disk to Hugging Face Model Hub."""
3
+
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+ from huggingface_hub import HfApi
8
+
9
+ PROJECT_ROOT = Path(__file__).resolve().parent.parent
10
+ MODEL_DIR = PROJECT_ROOT / "models" / "controlai_fused"
11
+ REPO_ID = "atakankahya/ControlAI-Agent"
12
+
13
+ def main():
14
+ if not MODEL_DIR.exists():
15
+ print(f"Error: Model directory not found at {MODEL_DIR}")
16
+ sys.exit(1)
17
+
18
+ token = os.environ.get("HF_TOKEN")
19
+ if not token:
20
+ # Prompt user or read from cache
21
+ from huggingface_hub import get_token
22
+ token = get_token()
23
+
24
+ if not token:
25
+ print("Error: Hugging Face token not found. Please provide HF_TOKEN environment variable or login via huggingface_hub.")
26
+ sys.exit(1)
27
+
28
+ print(f"Uploading local fused model from {MODEL_DIR} (2.26 GB) to https://huggingface.co/{REPO_ID}...")
29
+ api = HfApi(token=token)
30
+ api.upload_folder(
31
+ folder_path=str(MODEL_DIR),
32
+ repo_id=REPO_ID,
33
+ repo_type="model",
34
+ )
35
+ print("\nUpload complete! Your fine-tuned model is now live on Hugging Face Model Hub.")
36
+
37
+ if __name__ == "__main__":
38
+ main()