File size: 576 Bytes
f755bbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from datasets import load_dataset
import os
import sys
os.chdir(sys.path[0])


def main():
    raw_dset = load_dataset("super_glue", "wsc")
    text_labs = ["False", "True"]

    for split, dset in raw_dset.items():
        label_text = []
        for i in dset["label"]:
            if i >= 0:
                label_text.append(text_labs[i])
            else:
                label_text.append("unlabeled")
        dset = dset.add_column("label_text", label_text)        
        dset.to_json(f"{split}.jsonl")


if __name__ == "__main__":
    main()
    print("Job's done!")