Lawhy
commited on
Commit
·
ab53d78
1
Parent(s):
2b3e455
upload bimnli
Browse files- OntoLAMA.py +42 -26
- README.md +24 -26
OntoLAMA.py
CHANGED
@@ -39,7 +39,7 @@ _DESCRIPTION = """\
|
|
39 |
OntoLAMA: LAnguage Model Analysis datasets for Ontology Subsumption Inference.
|
40 |
"""
|
41 |
|
42 |
-
_URL = lambda name: f"https://zenodo.org/record/
|
43 |
|
44 |
# TODO: Add a link to an official homepage for the dataset here
|
45 |
_HOMEPAGE = "https://krr-oxford.github.io/DeepOnto/"
|
@@ -50,8 +50,7 @@ _LICENSE = "Apache License, Version 2.0"
|
|
50 |
|
51 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
52 |
class OntoLAMA(datasets.GeneratorBasedBuilder):
|
53 |
-
"""TODO: Short description of my dataset.
|
54 |
-
"""
|
55 |
|
56 |
VERSION = datasets.Version("1.0.0")
|
57 |
|
@@ -68,25 +67,22 @@ class OntoLAMA(datasets.GeneratorBasedBuilder):
|
|
68 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
69 |
BUILDER_CONFIGS = [
|
70 |
datasets.BuilderConfig(
|
71 |
-
name="
|
72 |
-
|
73 |
-
description="Atomic SI dataset created from the Schema.org Ontology."
|
74 |
-
),
|
75 |
datasets.BuilderConfig(
|
76 |
-
name="
|
77 |
-
version=VERSION,
|
78 |
-
description="Atomic SI dataset created from the
|
79 |
-
|
80 |
datasets.BuilderConfig(
|
81 |
-
name="
|
82 |
-
|
83 |
-
description="Atomic SI dataset created from the Food Ontology."
|
84 |
-
),
|
85 |
datasets.BuilderConfig(
|
86 |
-
name="
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
90 |
]
|
91 |
|
92 |
def _info(self):
|
@@ -96,22 +92,39 @@ class OntoLAMA(datasets.GeneratorBasedBuilder):
|
|
96 |
{
|
97 |
"v_sub_concept": datasets.Value("string"),
|
98 |
"v_super_concept": datasets.Value("string"),
|
99 |
-
|
|
|
|
|
100 |
"axiom": datasets.Value("string"),
|
101 |
# These are the features of your dataset like images, labels ...
|
102 |
}
|
103 |
)
|
104 |
-
elif
|
|
|
|
|
105 |
features = datasets.Features(
|
106 |
{
|
107 |
"v_sub_concept": datasets.Value("string"),
|
108 |
"v_super_concept": datasets.Value("string"),
|
109 |
-
|
|
|
|
|
110 |
"axiom": datasets.Value("string"),
|
111 |
"anchor_axiom": datasets.Value("string") # the equivalence axiom used as anchor
|
112 |
# These are the features of your dataset like images, labels ...
|
113 |
}
|
114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
return datasets.DatasetInfo(
|
116 |
# This is the description that will appear on the datasets page.
|
117 |
description=_DESCRIPTION,
|
@@ -157,10 +170,7 @@ class OntoLAMA(datasets.GeneratorBasedBuilder):
|
|
157 |
datasets.SplitGenerator(
|
158 |
name=datasets.Split.TEST,
|
159 |
# These kwargs will be passed to _generate_examples
|
160 |
-
gen_kwargs={
|
161 |
-
"filepath": os.path.join(data_dir, self.config.name, "test.jsonl"),
|
162 |
-
"split": "test"
|
163 |
-
},
|
164 |
),
|
165 |
]
|
166 |
|
@@ -187,3 +197,9 @@ class OntoLAMA(datasets.GeneratorBasedBuilder):
|
|
187 |
"axiom": data["axiom"],
|
188 |
"anchor_axiom": data["anchor_axiom"],
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
OntoLAMA: LAnguage Model Analysis datasets for Ontology Subsumption Inference.
|
40 |
"""
|
41 |
|
42 |
+
_URL = lambda name: f"https://zenodo.org/record/7696383/files/{name}.zip?download=1"
|
43 |
|
44 |
# TODO: Add a link to an official homepage for the dataset here
|
45 |
_HOMEPAGE = "https://krr-oxford.github.io/DeepOnto/"
|
|
|
50 |
|
51 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
52 |
class OntoLAMA(datasets.GeneratorBasedBuilder):
|
53 |
+
"""TODO: Short description of my dataset."""
|
|
|
54 |
|
55 |
VERSION = datasets.Version("1.0.0")
|
56 |
|
|
|
67 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
68 |
BUILDER_CONFIGS = [
|
69 |
datasets.BuilderConfig(
|
70 |
+
name="bimnli", version=VERSION, description="BiMNLI dataset created from the MNLI dataset."
|
71 |
+
),
|
|
|
|
|
72 |
datasets.BuilderConfig(
|
73 |
+
name="schemaorg-atomic-SI",
|
74 |
+
version=VERSION,
|
75 |
+
description="Atomic SI dataset created from the Schema.org Ontology.",
|
76 |
+
),
|
77 |
datasets.BuilderConfig(
|
78 |
+
name="doid-atomic-SI", version=VERSION, description="Atomic SI dataset created from the Disease Ontology."
|
79 |
+
),
|
|
|
|
|
80 |
datasets.BuilderConfig(
|
81 |
+
name="foodon-atomic-SI", version=VERSION, description="Atomic SI dataset created from the Food Ontology."
|
82 |
+
),
|
83 |
+
datasets.BuilderConfig(
|
84 |
+
name="go-atomic-SI", version=VERSION, description="Atomic SI dataset created from the Gene Ontology."
|
85 |
+
),
|
86 |
]
|
87 |
|
88 |
def _info(self):
|
|
|
92 |
{
|
93 |
"v_sub_concept": datasets.Value("string"),
|
94 |
"v_super_concept": datasets.Value("string"),
|
95 |
+
"label": datasets.ClassLabel(
|
96 |
+
num_classes=2, names=["negative_subsumption", "positive_subsumption"], names_file=None, id=None
|
97 |
+
),
|
98 |
"axiom": datasets.Value("string"),
|
99 |
# These are the features of your dataset like images, labels ...
|
100 |
}
|
101 |
)
|
102 |
+
elif (
|
103 |
+
"complex-SI" in self.config.name
|
104 |
+
): # This is an example to show how to have different features for "first_domain" and "second_domain"
|
105 |
features = datasets.Features(
|
106 |
{
|
107 |
"v_sub_concept": datasets.Value("string"),
|
108 |
"v_super_concept": datasets.Value("string"),
|
109 |
+
"label": datasets.ClassLabel(
|
110 |
+
num_classes=2, names=["negative_subsumption", "positive_subsumption"], names_file=None, id=None
|
111 |
+
),
|
112 |
"axiom": datasets.Value("string"),
|
113 |
"anchor_axiom": datasets.Value("string") # the equivalence axiom used as anchor
|
114 |
# These are the features of your dataset like images, labels ...
|
115 |
}
|
116 |
)
|
117 |
+
elif self.config.name == "bimnli":
|
118 |
+
features = datasets.Features(
|
119 |
+
{
|
120 |
+
"premise": datasets.Value("string"),
|
121 |
+
"hypothesis": datasets.Value("string"),
|
122 |
+
"label": datasets.ClassLabel(
|
123 |
+
num_classes=2, names=["contradiction", "entailment"], names_file=None, id=None
|
124 |
+
),
|
125 |
+
}
|
126 |
+
)
|
127 |
+
|
128 |
return datasets.DatasetInfo(
|
129 |
# This is the description that will appear on the datasets page.
|
130 |
description=_DESCRIPTION,
|
|
|
170 |
datasets.SplitGenerator(
|
171 |
name=datasets.Split.TEST,
|
172 |
# These kwargs will be passed to _generate_examples
|
173 |
+
gen_kwargs={"filepath": os.path.join(data_dir, self.config.name, "test.jsonl"), "split": "test"},
|
|
|
|
|
|
|
174 |
),
|
175 |
]
|
176 |
|
|
|
197 |
"axiom": data["axiom"],
|
198 |
"anchor_axiom": data["anchor_axiom"],
|
199 |
}
|
200 |
+
elif self.config.name == "bimnli":
|
201 |
+
yield key, {
|
202 |
+
"premise": data["premise"],
|
203 |
+
"hypothesis": data["hypothesis"],
|
204 |
+
"label": data["label"],
|
205 |
+
}
|
README.md
CHANGED
@@ -12,32 +12,6 @@ size_categories:
|
|
12 |
language:
|
13 |
- en
|
14 |
dataset_info:
|
15 |
-
- config_name: default
|
16 |
-
features:
|
17 |
-
- name: v_sub_concept
|
18 |
-
dtype: string
|
19 |
-
- name: v_super_concept
|
20 |
-
dtype: string
|
21 |
-
- name: label
|
22 |
-
dtype:
|
23 |
-
class_label:
|
24 |
-
names:
|
25 |
-
'0': negative_subsumption
|
26 |
-
'1': positive_subsumption
|
27 |
-
- name: axiom
|
28 |
-
dtype: string
|
29 |
-
splits:
|
30 |
-
- name: train
|
31 |
-
num_bytes: 152537233
|
32 |
-
num_examples: 772870
|
33 |
-
- name: validation
|
34 |
-
num_bytes: 19060490
|
35 |
-
num_examples: 96608
|
36 |
-
- name: test
|
37 |
-
num_bytes: 19069265
|
38 |
-
num_examples: 96610
|
39 |
-
download_size: 53310393
|
40 |
-
dataset_size: 190666988
|
41 |
- config_name: schemaorg-atomic-SI
|
42 |
features:
|
43 |
- name: v_sub_concept
|
@@ -142,6 +116,30 @@ dataset_info:
|
|
142 |
num_examples: 96610
|
143 |
download_size: 32379717
|
144 |
dataset_size: 190666988
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
---
|
146 |
|
147 |
# OntoLAMA: LAnguage Model Analysis for Ontology Subsumption Inference
|
|
|
12 |
language:
|
13 |
- en
|
14 |
dataset_info:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
- config_name: schemaorg-atomic-SI
|
16 |
features:
|
17 |
- name: v_sub_concept
|
|
|
116 |
num_examples: 96610
|
117 |
download_size: 32379717
|
118 |
dataset_size: 190666988
|
119 |
+
- config_name: bimnli
|
120 |
+
features:
|
121 |
+
- name: premise
|
122 |
+
dtype: string
|
123 |
+
- name: hypothesis
|
124 |
+
dtype: string
|
125 |
+
- name: label
|
126 |
+
dtype:
|
127 |
+
class_label:
|
128 |
+
names:
|
129 |
+
'0': contradiction
|
130 |
+
'1': entailment
|
131 |
+
splits:
|
132 |
+
- name: train
|
133 |
+
num_bytes: 43363266
|
134 |
+
num_examples: 235622
|
135 |
+
- name: validation
|
136 |
+
num_bytes: 4818648
|
137 |
+
num_examples: 26180
|
138 |
+
- name: test
|
139 |
+
num_bytes: 2420273
|
140 |
+
num_examples: 12906
|
141 |
+
download_size: 19264134
|
142 |
+
dataset_size: 50602187
|
143 |
---
|
144 |
|
145 |
# OntoLAMA: LAnguage Model Analysis for Ontology Subsumption Inference
|