Upload huggingface_download.py
Browse files- huggingface_download.py +29 -0
huggingface_download.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
import shutil
|
3 |
+
# cached_path = hf_hub_download(
|
4 |
+
# repo_id="returnzeros/anyrobot_bimanual",
|
5 |
+
# filename="ACT_DP_multitask"
|
6 |
+
# )
|
7 |
+
# shutil.copy(cached_path, "./policy")
|
8 |
+
# print(cached_path)
|
9 |
+
|
10 |
+
|
11 |
+
from huggingface_hub import list_repo_files, hf_hub_download
|
12 |
+
import os, shutil
|
13 |
+
|
14 |
+
repo_id = "returnzeros/anyrobot_bimanual"
|
15 |
+
local_root = "./anyrobot_bimanual_policy"
|
16 |
+
|
17 |
+
os.makedirs(local_root, exist_ok=True)
|
18 |
+
|
19 |
+
file_list = list_repo_files(repo_id)
|
20 |
+
|
21 |
+
for file in file_list:
|
22 |
+
print(f"? Downloading: {file}")
|
23 |
+
path = hf_hub_download(repo_id=repo_id, filename=file)
|
24 |
+
|
25 |
+
local_path = os.path.join(local_root, file)
|
26 |
+
os.makedirs(os.path.dirname(local_path), exist_ok=True)
|
27 |
+
shutil.copy(path, local_path)
|
28 |
+
|
29 |
+
print(f"load root path : {local_root}")
|