File size: 1,114 Bytes
115d1ae 8fdc74e 115d1ae 8fdc74e 115d1ae 8fdc74e 115d1ae | 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 | #!/usr/bin/env python3
"""
Run this script as ./conversion_script.py to convert the UniCausal CTB files to HF-compatible parquet files.
"""
# 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/ctb_train.csv
# - https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/ctb_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/ctb_train.csv",
"test": "https://raw.githubusercontent.com/tanfiona/UniCausal/refs/heads/main/data/splits/ctb_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")
|