Add deferred dataset upload script
Browse files
scripts/push_dataset_to_hf.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Upload the competition dataset to the private Hugging Face repo.
|
| 2 |
+
|
| 3 |
+
Split out from the code/weights push because the 600 page-scale PNGs are 2.5 GB and take
|
| 4 |
+
several hours on a home uplink, while the code and checkpoints take under an hour. Run this
|
| 5 |
+
whenever the machine can stay awake and online — overnight is the intended use.
|
| 6 |
+
|
| 7 |
+
.venv/bin/python scripts/push_dataset_to_hf.py
|
| 8 |
+
|
| 9 |
+
Resumable: `upload_large_folder` records per-file state in .cache/huggingface inside the folder,
|
| 10 |
+
so a killed run picks up where it stopped instead of re-uploading. Safe to run repeatedly.
|
| 11 |
+
"""
|
| 12 |
+
from huggingface_hub import HfApi
|
| 13 |
+
|
| 14 |
+
REPO = "siddhant20/task1"
|
| 15 |
+
ROOT = "/Users/siddhantparashar/projects/TASK1_CYBER"
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
HfApi().upload_large_folder(
|
| 19 |
+
repo_id=REPO,
|
| 20 |
+
repo_type="model",
|
| 21 |
+
folder_path=ROOT,
|
| 22 |
+
# Everything except the dataset is already pushed; the zip is a duplicate of the
|
| 23 |
+
# extracted folder and would double the transfer for nothing.
|
| 24 |
+
allow_patterns=["Task1/**"],
|
| 25 |
+
ignore_patterns=["*.zip", "**/.DS_Store"],
|
| 26 |
+
num_workers=8,
|
| 27 |
+
print_report_every=60,
|
| 28 |
+
)
|
| 29 |
+
print("dataset upload complete")
|