jordi-ai2 commited on
Commit
b95e145
·
verified ·
1 Parent(s): 1cd6353

Update download.py

Browse files
Files changed (1) hide show
  1. 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 may live under a __-joined path or the original /-joined path.
161
- candidates = [data_source_dir]
162
- flat = data_source_dir.replace("/", "__")
163
- if flat != data_source_dir:
164
- candidates.append(flat)
165
-
166
- parquet_paths: list[str] = []
167
- for candidate in candidates:
168
- repo_items = api.list_repo_tree(
169
- repo_id=HF_REPO_ID,
170
- repo_type=HF_REPO_TYPE,
171
- path_in_repo=candidate,
172
- revision=revision,
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(