Delete push_to_hub.py
Browse files- push_to_hub.py +0 -49
push_to_hub.py
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
from huggingface_hub import HfApi
|
| 2 |
-
import os
|
| 3 |
-
import sys
|
| 4 |
-
|
| 5 |
-
# --- Configuration ---
|
| 6 |
-
# The local directory to upload.
|
| 7 |
-
# We will upload the entire current directory.
|
| 8 |
-
local_dir = "."
|
| 9 |
-
|
| 10 |
-
# The Hugging Face repository ID (username/model_name)
|
| 11 |
-
hf_repo_id = "algorythmtechnologies/Syntax-3B-Untrained"
|
| 12 |
-
|
| 13 |
-
# The branch you want to push to
|
| 14 |
-
branch_name = "main"
|
| 15 |
-
|
| 16 |
-
# --- End Configuration ---
|
| 17 |
-
|
| 18 |
-
# Get the token from the command-line arguments
|
| 19 |
-
if len(sys.argv) > 1:
|
| 20 |
-
token = sys.argv[1]
|
| 21 |
-
else:
|
| 22 |
-
print("Error: Hugging Face token not provided.")
|
| 23 |
-
print("Usage: python push_to_hub.py <your_hf_token>")
|
| 24 |
-
sys.exit(1)
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
print(f"Found local directory: {local_dir}")
|
| 28 |
-
print("Authenticating with Hugging Face...")
|
| 29 |
-
|
| 30 |
-
try:
|
| 31 |
-
# Initialize the HfApi client with the provided token.
|
| 32 |
-
api = HfApi(token=token)
|
| 33 |
-
|
| 34 |
-
print(f"Uploading contents of '{local_dir}' to '{hf_repo_id}' on branch '{branch_name}'...")
|
| 35 |
-
|
| 36 |
-
# Upload the folder to the repository
|
| 37 |
-
api.upload_folder(
|
| 38 |
-
folder_path=local_dir,
|
| 39 |
-
repo_id=hf_repo_id,
|
| 40 |
-
repo_type="model",
|
| 41 |
-
revision=branch_name,
|
| 42 |
-
commit_message=f"Upload project folder {local_dir}"
|
| 43 |
-
)
|
| 44 |
-
|
| 45 |
-
print("\nUpload complete!")
|
| 46 |
-
print(f"You can view your repository at: https://huggingface.co/{hf_repo_id}/tree/{branch_name}")
|
| 47 |
-
|
| 48 |
-
except Exception as e:
|
| 49 |
-
print(f"\nAn error occurred: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|