File size: 443 Bytes
36889a1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from datasets import load_dataset
def main():
raw_dset = load_dataset("go_emotions", "simplified")
raw_dset = raw_dset.rename_column("labels", "label")
labels = raw_dset["train"].features["label"].feature
for split, dset in raw_dset.items():
dset = dset.map(lambda x: {"label_text": [labels.int2str(l) for l in x["label"]]}, num_proc=4)
dset.to_json(f"{split}.jsonl")
if __name__ == "__main__":
main()
|