luketheduke commited on
Commit
74873a8
1 Parent(s): 359ce39

Upload create_dataset.py

Browse files
Files changed (1) hide show
  1. create_dataset.py +23 -0
create_dataset.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import load_dataset
2
+
3
+
4
+ def main():
5
+ raw_dset = load_dataset("glue", "mrpc")
6
+ raw_dset = raw_dset.rename_column("sentence1", "text1")
7
+ raw_dset = raw_dset.rename_column("sentence2", "text2")
8
+ text_labs = ["not equivalent", "equivalent"]
9
+
10
+ for split, dset in raw_dset.items():
11
+ label_text = []
12
+ for i in dset["label"]:
13
+ if i >= 0:
14
+ label_text.append(text_labs[i])
15
+ else:
16
+ label_text.append("unlabeled")
17
+ dset = dset.add_column("label_text", label_text)
18
+ dset.to_json(f"{split}.jsonl")
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
23
+ print("Job's done!")