Datasets:
Upload open_cortex_fx_v3.py with huggingface_hub
Browse files- open_cortex_fx_v3.py +25 -7
open_cortex_fx_v3.py
CHANGED
|
@@ -66,14 +66,32 @@ class OpenCortexFXv3(datasets.GeneratorBasedBuilder):
|
|
| 66 |
for i in range(6): # We have 6 splits (final_0 through final_5)
|
| 67 |
split_name = f"final_{i}"
|
| 68 |
zip_url = f"https://huggingface.co/datasets/Standout/open-cortex-fx-v3/resolve/main/final_{i}.zip"
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
)
|
| 76 |
-
)
|
| 77 |
|
| 78 |
return splits
|
| 79 |
|
|
|
|
| 66 |
for i in range(6): # We have 6 splits (final_0 through final_5)
|
| 67 |
split_name = f"final_{i}"
|
| 68 |
zip_url = f"https://huggingface.co/datasets/Standout/open-cortex-fx-v3/resolve/main/final_{i}.zip"
|
| 69 |
+
try:
|
| 70 |
+
zip_path = dl_manager.download(zip_url)
|
| 71 |
+
if zip_path and Path(zip_path).exists():
|
| 72 |
+
splits.append(
|
| 73 |
+
datasets.SplitGenerator(
|
| 74 |
+
name=datasets.Split(split_name),
|
| 75 |
+
gen_kwargs={"zip_path": Path(zip_path)},
|
| 76 |
+
)
|
| 77 |
+
)
|
| 78 |
+
except Exception:
|
| 79 |
+
# Skip if file doesn't exist
|
| 80 |
+
continue
|
| 81 |
+
|
| 82 |
+
# If no splits found, return at least one to avoid errors
|
| 83 |
+
if not splits:
|
| 84 |
+
# Fallback: try to find any zip file
|
| 85 |
+
data_dir = Path(dl_manager.download_and_extract("https://huggingface.co/datasets/Standout/open-cortex-fx-v3/tree/main"))
|
| 86 |
+
zip_files = sorted(data_dir.glob("final_*.zip"))
|
| 87 |
+
for zip_file in zip_files:
|
| 88 |
+
split_name = zip_file.stem
|
| 89 |
+
splits.append(
|
| 90 |
+
datasets.SplitGenerator(
|
| 91 |
+
name=datasets.Split(split_name),
|
| 92 |
+
gen_kwargs={"zip_path": zip_file},
|
| 93 |
+
)
|
| 94 |
)
|
|
|
|
| 95 |
|
| 96 |
return splits
|
| 97 |
|