albertvillanova HF staff commited on
Commit
8c2e675
1 Parent(s): 63c373d

Host data files (#2)

Browse files

- Add data files in JSON Lines (96fe571ae68c0b714555fe29333b8c0ba0514943)
- Use hosted data files in JSON Lines format (83429ebe1a3f8b76896d83aa77708c27f1db7133)

biomrc.py CHANGED
@@ -21,7 +21,6 @@ import json
21
 
22
  import datasets
23
 
24
-
25
  logger = datasets.logging.get_logger(__name__)
26
 
27
 
@@ -47,6 +46,22 @@ _DESCRIPTION = """\
47
  We introduce BIOMRC, a large-scale cloze-style biomedical MRC dataset. Care was taken to reduce noise, compared to the previous BIOREAD dataset of Pappas et al. (2018). Experiments show that simple heuristics do not perform well on the new dataset and that two neural MRC models that had been tested on BIOREAD perform much better on BIOMRC, indicating that the new dataset is indeed less noisy or at least that its task is more feasible. Non-expert human performance is also higher on the new dataset compared to BIOREAD, and biomedical experts perform even better. We also introduce a new BERT-based MRC model, the best version of which substantially outperforms all other methods tested, reaching or surpassing the accuracy of biomedical experts in some experiments. We make the new dataset available in three different sizes, also releasing our code, and providing a leaderboard.
48
  """
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  class BiomrcConfig(datasets.BuilderConfig):
52
  """BuilderConfig for BioMRC."""
@@ -143,23 +158,9 @@ class Biomrc(datasets.GeneratorBasedBuilder):
143
 
144
  def _split_generators(self, dl_manager):
145
  setting = "" if self.config.biomrc_setting == "A" else "_B"
146
- if self.config.biomrc_version == "large":
147
- urls_to_download = {
148
- "train": f"https://archive.org/download/biomrc_dataset/biomrc_large/dataset_train{setting}.json.gz",
149
- "val": f"https://archive.org/download/biomrc_dataset/biomrc_large/dataset_val{setting}.json.gz",
150
- "test": f"https://archive.org/download/biomrc_dataset/biomrc_large/dataset_test{setting}.json.gz",
151
- }
152
- elif self.config.biomrc_version == "small":
153
- urls_to_download = {
154
- "train": f"https://archive.org/download/biomrc_dataset/biomrc_small/dataset_train_small{setting}.json.gz",
155
- "val": f"https://archive.org/download/biomrc_dataset/biomrc_small/dataset_val_small{setting}.json.gz",
156
- "test": f"https://archive.org/download/biomrc_dataset/biomrc_small/dataset_test_small{setting}.json.gz",
157
- }
158
- else:
159
- urls_to_download = {
160
- "test": f"https://archive.org/download/biomrc_dataset/biomrc_tiny/dataset_tiny{setting}.json.gz"
161
- }
162
-
163
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
164
 
165
  if self.config.biomrc_version == "tiny":
@@ -178,10 +179,6 @@ class Biomrc(datasets.GeneratorBasedBuilder):
178
  def _generate_examples(self, filepath):
179
  """This function returns the examples in the raw (text) form."""
180
  logger.info("generating examples from = %s", filepath)
181
- # Id for the biomrc dataset
182
  with open(filepath, encoding="utf-8") as fp:
183
- biomrc = json.load(fp)
184
- for _id, (ab, ti, el, an) in enumerate(
185
- zip(biomrc["abstracts"], biomrc["titles"], biomrc["entities_list"], biomrc["answers"])
186
- ):
187
- yield _id, {"abstract": ab, "title": ti, "entities_list": el, "answer": an}
 
21
 
22
  import datasets
23
 
 
24
  logger = datasets.logging.get_logger(__name__)
25
 
26
 
 
46
  We introduce BIOMRC, a large-scale cloze-style biomedical MRC dataset. Care was taken to reduce noise, compared to the previous BIOREAD dataset of Pappas et al. (2018). Experiments show that simple heuristics do not perform well on the new dataset and that two neural MRC models that had been tested on BIOREAD perform much better on BIOMRC, indicating that the new dataset is indeed less noisy or at least that its task is more feasible. Non-expert human performance is also higher on the new dataset compared to BIOREAD, and biomedical experts perform even better. We also introduce a new BERT-based MRC model, the best version of which substantially outperforms all other methods tested, reaching or surpassing the accuracy of biomedical experts in some experiments. We make the new dataset available in three different sizes, also releasing our code, and providing a leaderboard.
47
  """
48
 
49
+ _URLS = {
50
+ "large": {
51
+ "train": "data/biomrc_large/dataset_train{setting}.jsonl.gz",
52
+ "val": "data/biomrc_large/dataset_val{setting}.jsonl.gz",
53
+ "test": "data/biomrc_large/dataset_test{setting}.jsonl.gz",
54
+ },
55
+ "small": {
56
+ "train": "data/biomrc_small/dataset_train_small{setting}.jsonl.gz",
57
+ "val": "data/biomrc_small/dataset_val_small{setting}.jsonl.gz",
58
+ "test": "data/biomrc_small/dataset_test_small{setting}.jsonl.gz",
59
+ },
60
+ "tiny": {
61
+ "test": "data/biomrc_tiny/dataset_tiny{setting}.jsonl.gz",
62
+ },
63
+ }
64
+
65
 
66
  class BiomrcConfig(datasets.BuilderConfig):
67
  """BuilderConfig for BioMRC."""
 
158
 
159
  def _split_generators(self, dl_manager):
160
  setting = "" if self.config.biomrc_setting == "A" else "_B"
161
+ urls_to_download = {
162
+ split: url.format(setting=setting) for split, url in _URLS[self.config.biomrc_version].items()
163
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
165
 
166
  if self.config.biomrc_version == "tiny":
 
179
  def _generate_examples(self, filepath):
180
  """This function returns the examples in the raw (text) form."""
181
  logger.info("generating examples from = %s", filepath)
 
182
  with open(filepath, encoding="utf-8") as fp:
183
+ for idx, example in enumerate(fp):
184
+ yield idx, json.loads(example)
 
 
 
data/biomrc_large/dataset_test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f745d3c0dd4cc6a2f795ef06ab8156d09555b6d9987b723db9ca845dd428a21c
3
+ size 33922627
data/biomrc_large/dataset_test_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e0cc7821972a394b65ce95a4082ba265553bcdcb74c6fd8eef9bc927a563717
3
+ size 27883744
data/biomrc_large/dataset_train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2468b324c2d7511f66d3264b3ae00543df375538f36cd71dd338a18426990008
3
+ size 377220119
data/biomrc_large/dataset_train_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3181c528c9b4b3eda3ac655edb401fdc13b283a911da24d9022a01c1ddd942cf
3
+ size 309771578
data/biomrc_large/dataset_val.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:847e2d20628fa6d1c21882e3ea2a93195b3fbfc0a9557cb3c3aa76c45f5c488d
3
+ size 27416109
data/biomrc_large/dataset_val_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f558c4979223d6bd0629302cddfb52acfe79841b30b0d5c63e266e2f7b252a5
3
+ size 22591623
data/biomrc_small/dataset_test_small.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4cc06064b325026301923aae909fe354a22cf80d23abf698d61e71735bfee74
3
+ size 4705472
data/biomrc_small/dataset_test_small_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39924466420bfba9e18e096a924f044e7f46293a37de510ee3dd92ddbe71f4f7
3
+ size 3835183
data/biomrc_small/dataset_train_small.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1c0cef6a91853beea61383be3509c594ae6d2183124f62a723b809c17913752
3
+ size 65423765
data/biomrc_small/dataset_train_small_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5412bed40882c936eb437da5cb5eae69a28a67c09c8810074b42df92a4cfc13
3
+ size 53169632
data/biomrc_small/dataset_val_small.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6b1d0c4da2ff8ff8cee7bc34183188fd2f7f3499f736224506a6cc83f945232
3
+ size 4750974
data/biomrc_small/dataset_val_small_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5b6b127bdea3d134f09922e91a446c4b91eb76b90bb8746a7f135a4c530cb25
3
+ size 3875394
data/biomrc_tiny/dataset_tiny.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1e03e2352d4419e0e0e414e8e1579fbb5b5f9af937b82e2bf0dc55efbfaaa6d
3
+ size 23529
data/biomrc_tiny/dataset_tiny_B.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6d944e2cce9f9b04493c66ac7a94aa6330ea6b939533c8c4e670b0e6df64209
3
+ size 20318