Upload push_to_hf.py
Browse files- script/push_to_hf.py +20 -0
script/push_to_hf.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse, os
|
| 2 |
+
from huggingface_hub import create_repo, HfApi
|
| 3 |
+
|
| 4 |
+
p = argparse.ArgumentParser()
|
| 5 |
+
p.add_argument("--repo", required=True, help="e.g. yourname/ib-physics-mini-gpt")
|
| 6 |
+
args = p.parse_args()
|
| 7 |
+
|
| 8 |
+
api = HfApi()
|
| 9 |
+
try:
|
| 10 |
+
create_repo(repo_id=args.repo, exist_ok=True)
|
| 11 |
+
except Exception:
|
| 12 |
+
pass
|
| 13 |
+
|
| 14 |
+
os.system("git init")
|
| 15 |
+
os.system(f"git remote add origin https://huggingface.co/{args.repo}")
|
| 16 |
+
os.system("git lfs install")
|
| 17 |
+
os.system("git add .")
|
| 18 |
+
os.system('git commit -m "initial commit: tiny from-scratch gpt + space"')
|
| 19 |
+
os.system("git push -u origin HEAD:main --force")
|
| 20 |
+
print("Pushed to HF:", args.repo)
|