Commit
•
2b9793b
1
Parent(s):
eb2aeb7
Changed format to have labels as columns
Browse files- create_dataset.py +14 -3
- test.jsonl +2 -2
- train.jsonl +2 -2
- validation.jsonl +2 -2
create_dataset.py
CHANGED
@@ -1,15 +1,26 @@
|
|
1 |
from datasets import load_dataset
|
2 |
|
3 |
|
|
|
|
|
4 |
def main():
|
5 |
raw_dset = load_dataset("go_emotions", "simplified")
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
for split, dset in raw_dset.items():
|
10 |
-
dset = dset.map(lambda x:
|
|
|
11 |
dset.to_json(f"{split}.jsonl")
|
12 |
|
13 |
|
|
|
|
|
14 |
if __name__ == "__main__":
|
15 |
main()
|
|
|
1 |
from datasets import load_dataset
|
2 |
|
3 |
|
4 |
+
# +
|
5 |
+
|
6 |
def main():
|
7 |
raw_dset = load_dataset("go_emotions", "simplified")
|
8 |
+
labels = raw_dset["train"].features["labels"].feature
|
9 |
+
|
10 |
+
def create_labels(row):
|
11 |
+
labels_columns = {}
|
12 |
+
for _label in labels.names:
|
13 |
+
labels_columns.setdefault(_label, 0)
|
14 |
+
labels_columns.update({labels.int2str(_l):1 for _l in row['labels']})
|
15 |
+
return labels_columns
|
16 |
|
17 |
for split, dset in raw_dset.items():
|
18 |
+
dset = dset.map(lambda x: create_labels(x), num_proc=4)
|
19 |
+
dset = dset.remove_columns(["id", "labels"])
|
20 |
dset.to_json(f"{split}.jsonl")
|
21 |
|
22 |
|
23 |
+
# -
|
24 |
+
|
25 |
if __name__ == "__main__":
|
26 |
main()
|
test.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:63c68fd56fa2470a701135a0c31dd8aff946a535efef663a7917415149e88630
|
3 |
+
size 2400101
|
train.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b14e8b3fd45a657f4a01267fab784db088893da29e3415fbcd2221d8dfac4198
|
3 |
+
size 19222477
|
validation.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bff7228526b2d0053a50cc16e8d1b4093d46f919c7f7097387fc7b5dbaf396d1
|
3 |
+
size 2402070
|