sh110495 commited on
Commit
b2e8368
1 Parent(s): 5ab6cb5

Upload dataset

Browse files
.gitattributes CHANGED
@@ -25,3 +25,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ klue-re-v1.1_dev.json filter=lfs diff=lfs merge=lfs -text
29
+ klue-re-v1.1_train.json filter=lfs diff=lfs merge=lfs -text
klue-re-v1.1_dev.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d150873430e592a5c569d35b20d88fbbbfba751dae0ffa4d8cbfb6b7321dea14
3
+ size 5212646
klue-re-v1.1_train.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10101fa3059b340f9971286dd5639daccb5889324182aed31679f038bca05bc4
3
+ size 22316866
klue-re.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import json
3
+ import pandas as pd
4
+ import datasets
5
+
6
+ logger = datasets.logging.get_logger(__name__)
7
+
8
+ _DESCRIPTION = """\
9
+ Klue Relation Extraction Data
10
+ """
11
+
12
+ _URL = "https://huggingface.co/datasets/LeverageX/klue-re/resolve/main/"
13
+ _URLS = {
14
+ "train_data": _URL + "klue-re-v1.1_train.json",
15
+ "validation_data": _URL + "klue-re-v1.1_dev.json",
16
+ }
17
+
18
+ class KoreanNewspaper(datasets.GeneratorBasedBuilder):
19
+
20
+ BUILDER_CONFIGS = [
21
+ datasets.BuilderConfig(
22
+ name="KLUE Relation Extraction",
23
+ version=datasets.Version("1.0.0", ""),
24
+ description="For LeverageX Project",
25
+ ),
26
+ ]
27
+
28
+ def _info(self):
29
+ return datasets.DatasetInfo(
30
+ description=_DESCRIPTION,
31
+ features=datasets.Features(
32
+ {
33
+ "guid": datasets.Value("string"),
34
+ "label": datasets.Value("string"),
35
+ "object_entity": datasets.Value("String"),
36
+ "sentencce": datasets.Value("string"),
37
+ "source": datasets.Value("string"),
38
+ "subject_entity": datasets.Value("string"),
39
+ }
40
+ ),
41
+ # No default supervised_keys (as we have to pass both question
42
+ # and context as input).
43
+ supervised_keys=None,
44
+ homepage="https://klue-benchmark.com/tasks/70/overview/description",
45
+ )
46
+
47
+ def _split_generators(self, dl_manager):
48
+ downloaded_files = dl_manager.download_and_extract(_URLS)
49
+
50
+ return [
51
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
52
+ ]
53
+
54
+ def _generate_examples(self, filepath):
55
+ """This function returns the examples in the raw (text) form."""
56
+ logger.info("generating examples from = %s", filepath)
57
+ key = 0
58
+ with open(filepath, encoding="utf-8") as f :
59
+ data = json.load(f)
60
+
61
+ for info in data :
62
+ guid = info['guid']
63
+ label = info['label']
64
+ object_entity = info['object_entity']
65
+ subject_entity = info['subject_entity']
66
+ source = info['source']
67
+
68
+ yield key, {
69
+ "guid" : guid,
70
+ "label" : label,
71
+ "object_entity" : object_entity,
72
+ "subject_entity" : subject_entity,
73
+ "source" : source,
74
+ }
75
+ key += 1