File size: 1,193 Bytes
cf916ef 070fbfd cf916ef 070fbfd cf916ef 070fbfd cf916ef | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #!/usr/bin/env python3
"""
Run this script as ./conversion_script.py to convert the UniCausal ESL files to HF-compatible parquet files.
Note: UniCausal refers to this dataset as 'esl2' in its processed splits.
"""
# 1) Install dependencies:
# pip install git+https://github.com/TheMrSheldon/causality-toolkit.git
# 2) Source files (fetched automatically via pandas):
# - https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/esl2_train.csv
# - https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/esl2_test.csv
from pathlib import Path
from ctk.data.constants import Task
from ctk.data.conversion import UniCausal2HF
converter = UniCausal2HF({"train": "https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/esl2_train.csv",
"test": "https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/esl2_test.csv"}, Path.cwd(), grouped=False)
converter.convert(Task.CausalityDetection, "train")
converter.convert(Task.CausalityDetection, "test")
converter.convert(Task.CausalityIdentification, "train")
converter.convert(Task.CausalityIdentification, "test")
|