Upload test.py with huggingface_hub
Browse files
test.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import create_repo, upload_folder
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
datasets_to_push = [
|
| 5 |
+
("mon_dataset_manuel_1782511858", "InfectV22/nema_test_session1"),
|
| 6 |
+
("mon_dataset_manuel_1782567884", "InfectV22/nema_test_session2"),
|
| 7 |
+
("mon_dataset_manuel_1782589342", "InfectV22/nema_test_session3")
|
| 8 |
+
]
|
| 9 |
+
|
| 10 |
+
cache_dir = os.path.expanduser("~/.cache/huggingface/lerobot")
|
| 11 |
+
|
| 12 |
+
for local_name, remote_repo_id in datasets_to_push:
|
| 13 |
+
local_path = os.path.join(cache_dir, local_name)
|
| 14 |
+
|
| 15 |
+
print(f"======================================")
|
| 16 |
+
print(f"Uploading {local_name} -> {remote_repo_id}")
|
| 17 |
+
print(f"======================================")
|
| 18 |
+
|
| 19 |
+
# Cree le repertoire distant s'il n'existe pas
|
| 20 |
+
create_repo(remote_repo_id, repo_type="dataset", exist_ok=True)
|
| 21 |
+
|
| 22 |
+
# Upload tout le contenu
|
| 23 |
+
upload_folder(
|
| 24 |
+
folder_path=local_path,
|
| 25 |
+
repo_id=remote_repo_id,
|
| 26 |
+
repo_type="dataset"
|
| 27 |
+
)
|
| 28 |
+
print("Done!\n")
|
| 29 |
+
|
| 30 |
+
print("All datasets uploaded successfully!")
|