Update download.py
Browse files- download.py +14 -22
download.py
CHANGED
|
@@ -157,28 +157,20 @@ def load_arrow_table(data_source_dir: str, revision: str = "main") -> Dataset:
|
|
| 157 |
"""
|
| 158 |
api = HfApi()
|
| 159 |
|
| 160 |
-
# Parquet configs
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
parquet_paths = sorted(
|
| 175 |
-
item.path
|
| 176 |
-
for item in repo_items
|
| 177 |
-
if getattr(item, "path", "").endswith(".parquet")
|
| 178 |
-
and "pkgs" in os.path.basename(item.path)
|
| 179 |
-
)
|
| 180 |
-
if parquet_paths:
|
| 181 |
-
break
|
| 182 |
|
| 183 |
if not parquet_paths:
|
| 184 |
raise FileNotFoundError(
|
|
|
|
| 157 |
"""
|
| 158 |
api = HfApi()
|
| 159 |
|
| 160 |
+
# Parquet configs live under a __-joined path.
|
| 161 |
+
parquet_dir = data_source_dir.replace("/", "__")
|
| 162 |
+
repo_items = api.list_repo_tree(
|
| 163 |
+
repo_id=HF_REPO_ID,
|
| 164 |
+
repo_type=HF_REPO_TYPE,
|
| 165 |
+
path_in_repo=parquet_dir,
|
| 166 |
+
revision=revision,
|
| 167 |
+
)
|
| 168 |
+
parquet_paths = sorted(
|
| 169 |
+
item.path
|
| 170 |
+
for item in repo_items
|
| 171 |
+
if getattr(item, "path", "").endswith(".parquet")
|
| 172 |
+
and "pkgs" in os.path.basename(item.path)
|
| 173 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
if not parquet_paths:
|
| 176 |
raise FileNotFoundError(
|