Download apply_filter.py from IFM/PalmX2025-Subtask2_verified: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/IFM/PalmX2025-Subtask2_verified/resolve/main/apply_filter.py
- Command line
-
hf download hf://datasets/IFM/PalmX2025-Subtask2_verified/apply_filter.py
-
curl -L -o apply_filter.py https://huggingface.co/datasets/IFM/PalmX2025-Subtask2_verified/resolve/main/apply_filter.py
1.03 kB
| """Rebuild the verified PalmX 2025 Subtask 2 test set from your own copy of the gated source. | |
| Requires access to UBC-NLP/palmx_2025_subtask2_islamic (accept its terms on the Hub and log in | |
| with `hf auth login`). Usage: | |
| python apply_filter.py [output.parquet] | |
| """ | |
| import sys | |
| import pandas as pd | |
| from datasets import load_dataset | |
| from huggingface_hub import hf_hub_download | |
| SOURCE = "UBC-NLP/palmx_2025_subtask2_islamic" | |
| SOURCE_REVISION = "95864e9a18753a2aab5b3b687a494a8638751606" | |
| THIS_REPO = "IFM/PalmX2025-Subtask2_verified" | |
| ids = pd.read_csv(hf_hub_download(THIS_REPO, "ids.csv", repo_type="dataset")) | |
| kept = set(ids.loc[ids["status"] == "kept", "id"]) | |
| test = load_dataset(SOURCE, split="test", revision=SOURCE_REVISION) | |
| verified = test.filter(lambda row: row["id"] in kept) | |
| assert len(verified) == len(kept) == 948, f"expected 948 rows, got {len(verified)}" | |
| out = sys.argv[1] if len(sys.argv) > 1 else "palmx2025_subtask2_verified.parquet" | |
| verified.to_parquet(out) | |
| print(f"Wrote {len(verified)} rows to {out}") | |