Add files using upload-large-folder tool
Browse files- upload_to_hf.py +29 -51
upload_to_hf.py
CHANGED
|
@@ -1,61 +1,39 @@
|
|
| 1 |
-
from huggingface_hub import HfApi
|
| 2 |
|
|
|
|
| 3 |
username = "LLouis0622"
|
| 4 |
repo_name = "early_warning_model"
|
| 5 |
repo_id = f"{username}/{repo_name}"
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
try:
|
| 10 |
-
create_repo(repo_id=repo_id, repo_type="model", exist_ok=True)
|
| 11 |
-
print(f"Repository created: https://huggingface.co/{repo_id}")
|
| 12 |
-
except Exception as e:
|
| 13 |
-
print(f"Repository already exists or error: {e}")
|
| 14 |
-
|
| 15 |
-
api.upload_folder(
|
| 16 |
-
folder_path=".",
|
| 17 |
-
repo_id=repo_id,
|
| 18 |
-
repo_type="model",
|
| 19 |
-
ignore_patterns=[
|
| 20 |
-
".git/*",
|
| 21 |
-
"__pycache__/*",
|
| 22 |
-
"*.pyc",
|
| 23 |
-
".gitignore",
|
| 24 |
-
"venv/*",
|
| 25 |
-
".DS_Store"
|
| 26 |
-
]
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
print(f"Upload complete! Check: https://huggingface.co/{repo_id}")
|
| 30 |
-
|
| 31 |
-
from huggingface_hub import HfApi, create_repo
|
| 32 |
-
|
| 33 |
-
username = "LLouis0622"
|
| 34 |
-
repo_name = "early_warning_model"
|
| 35 |
-
repo_id = f"{username}/{repo_name}"
|
| 36 |
|
| 37 |
api = HfApi()
|
| 38 |
|
|
|
|
| 39 |
try:
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
except Exception as e:
|
| 43 |
-
print(f"
|
| 44 |
-
|
| 45 |
-
api.upload_folder(
|
| 46 |
-
folder_path=".",
|
| 47 |
-
repo_id=repo_id,
|
| 48 |
-
repo_type="model",
|
| 49 |
-
ignore_patterns=[
|
| 50 |
-
".git/*",
|
| 51 |
-
"__pycache__/*",
|
| 52 |
-
"*.pyc",
|
| 53 |
-
".gitignore",
|
| 54 |
-
"venv/*",
|
| 55 |
-
".DS_Store"
|
| 56 |
-
]
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
print(f"Upload complete! Check: https://huggingface.co/{repo_id}")
|
| 60 |
-
|
| 61 |
-
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi
|
| 2 |
|
| 3 |
+
# 설정
|
| 4 |
username = "LLouis0622"
|
| 5 |
repo_name = "early_warning_model"
|
| 6 |
repo_id = f"{username}/{repo_name}"
|
| 7 |
|
| 8 |
+
print(f"📦 Uploading to: https://huggingface.co/{repo_id}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
api = HfApi()
|
| 11 |
|
| 12 |
+
print("Uploading files (this may take a while)...")
|
| 13 |
try:
|
| 14 |
+
api.upload_large_folder(
|
| 15 |
+
folder_path=".",
|
| 16 |
+
repo_id=repo_id,
|
| 17 |
+
repo_type="model",
|
| 18 |
+
ignore_patterns=[
|
| 19 |
+
"data/raw/*",
|
| 20 |
+
"*.zip",
|
| 21 |
+
".git/*",
|
| 22 |
+
".git",
|
| 23 |
+
"__pycache__/*",
|
| 24 |
+
"*.pyc",
|
| 25 |
+
".gitignore",
|
| 26 |
+
".venv/*",
|
| 27 |
+
"venv/*",
|
| 28 |
+
".DS_Store",
|
| 29 |
+
".idea/*",
|
| 30 |
+
"*.egg-info/*",
|
| 31 |
+
".ipynb_checkpoints/*",
|
| 32 |
+
"early_warning_model/*"
|
| 33 |
+
]
|
| 34 |
+
)
|
| 35 |
+
print(f"Upload complete!")
|
| 36 |
+
print(f"View at: https://huggingface.co/{repo_id}")
|
| 37 |
except Exception as e:
|
| 38 |
+
print(f"Error: {e}")
|
| 39 |
+
print("Try uploading in smaller batches or excluding large files")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|