luketheduke
commited on
Commit
•
e40c880
1
Parent(s):
f1a32c5
Upload create_dataset.py
Browse files- create_dataset.py +24 -0
create_dataset.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import load_dataset
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
os.chdir(sys.path[0])
|
5 |
+
|
6 |
+
|
7 |
+
def main():
|
8 |
+
raw_dset = load_dataset("super_glue", "wsc.fixed")
|
9 |
+
text_labs = ["False", "True"]
|
10 |
+
|
11 |
+
for split, dset in raw_dset.items():
|
12 |
+
label_text = []
|
13 |
+
for i in dset["label"]:
|
14 |
+
if i >= 0:
|
15 |
+
label_text.append(text_labs[i])
|
16 |
+
else:
|
17 |
+
label_text.append("unlabeled")
|
18 |
+
dset = dset.add_column("label_text", label_text)
|
19 |
+
dset.to_json(f"{split}.jsonl")
|
20 |
+
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
main()
|
24 |
+
print("Job's done!")
|