Datasets:

Modalities:
Text
Formats:
json
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
License:
Axel578 commited on
Commit
a6abdda
1 Parent(s): e5597f5

Create samsum.py

Browse files
Files changed (1) hide show
  1. samsum.py +44 -0
samsum.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+ class SkillDataset(datasets.GeneratorBasedBuilder):
5
+ VERSION = datasets.Version("0.1.0")
6
+
7
+ def _info(self):
8
+ return datasets.DatasetInfo(
9
+ description="A dataset of skills and their descriptions",
10
+ features=datasets.Features(
11
+ {
12
+ "input": datasets.Value("string"),
13
+ "target": datasets.Value("string"),
14
+ }
15
+ ),
16
+ )
17
+
18
+ def _split_generators(self, dl_manager):
19
+ mappings = json.load(open("mappings.json", "r"))
20
+
21
+ training_data = mappings[:int(0.95 * len(mappings))]
22
+ testing_data = mappings[int(0.95 * len(mappings)) :]
23
+
24
+ return [
25
+ datasets.SplitGenerator(
26
+ name=datasets.Split.TRAIN,
27
+ gen_kwargs={
28
+ "data": training_data
29
+ }
30
+ ),
31
+ datasets.SplitGenerator(
32
+ name=datasets.Split.TEST,
33
+ gen_kwargs={
34
+ "data": testing_data
35
+ }
36
+ ),
37
+ ]
38
+
39
+ def _generate_examples(self, data):
40
+ for i, mapping in enumerate(data):
41
+ yield i, {
42
+ "input": mapping["input"],
43
+ "target": mapping["target"],
44
+ }