Commit
·
09acc4b
1
Parent(s):
c8b1a7c
Delete loading script
Browse files- medmcqa.py +0 -116
medmcqa.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
# coding=utf-8
|
| 2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
"""MedMCQA : A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering"""
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
import json
|
| 19 |
-
import os
|
| 20 |
-
|
| 21 |
-
import datasets
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
_DESCRIPTION = """\
|
| 25 |
-
MedMCQA is a large-scale, Multiple-Choice Question Answering (MCQA) dataset designed to address real-world medical entrance exam questions.
|
| 26 |
-
MedMCQA has more than 194k high-quality AIIMS & NEET PG entrance exam MCQs covering 2.4k healthcare topics and 21 medical subjects are collected with an average token length of 12.77 and high topical diversity.
|
| 27 |
-
The dataset contains questions about the following topics: Anesthesia, Anatomy, Biochemistry, Dental, ENT, Forensic Medicine (FM)
|
| 28 |
-
Obstetrics and Gynecology (O&G), Medicine, Microbiology, Ophthalmology, Orthopedics Pathology, Pediatrics, Pharmacology, Physiology,
|
| 29 |
-
Psychiatry, Radiology Skin, Preventive & Social Medicine (PSM) and Surgery
|
| 30 |
-
"""
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
_HOMEPAGE = "https://medmcqa.github.io"
|
| 34 |
-
|
| 35 |
-
_LICENSE = "Apache License 2.0"
|
| 36 |
-
_URL = "https://drive.google.com/uc?export=download&id=15VkJdq5eyWIkfb_aoD3oS8i4tScbHYky"
|
| 37 |
-
_CITATION = """\
|
| 38 |
-
@InProceedings{pmlr-v174-pal22a,
|
| 39 |
-
title = {MedMCQA: A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering},
|
| 40 |
-
author = {Pal, Ankit and Umapathi, Logesh Kumar and Sankarasubbu, Malaikannan},
|
| 41 |
-
booktitle = {Proceedings of the Conference on Health, Inference, and Learning},
|
| 42 |
-
pages = {248--260},
|
| 43 |
-
year = {2022},
|
| 44 |
-
editor = {Flores, Gerardo and Chen, George H and Pollard, Tom and Ho, Joyce C and Naumann, Tristan},
|
| 45 |
-
volume = {174},
|
| 46 |
-
series = {Proceedings of Machine Learning Research},
|
| 47 |
-
month = {07--08 Apr},
|
| 48 |
-
publisher = {PMLR},
|
| 49 |
-
pdf = {https://proceedings.mlr.press/v174/pal22a/pal22a.pdf},
|
| 50 |
-
url = {https://proceedings.mlr.press/v174/pal22a.html},
|
| 51 |
-
abstract = {This paper introduces MedMCQA, a new large-scale, Multiple-Choice Question Answering (MCQA) dataset designed to address real-world medical entrance exam questions. More than 194k high-quality AIIMS & NEET PG entrance exam MCQs covering 2.4k healthcare topics and 21 medical subjects are collected with an average token length of 12.77 and high topical diversity. Each sample contains a question, correct answer(s), and other options which requires a deeper language understanding as it tests the 10+ reasoning abilities of a model across a wide range of medical subjects & topics. A detailed explanation of the solution, along with the above information, is provided in this study.}
|
| 52 |
-
}
|
| 53 |
-
"""
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
class MedMCQA(datasets.GeneratorBasedBuilder):
|
| 57 |
-
"""MedMCQA : A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering"""
|
| 58 |
-
|
| 59 |
-
VERSION = datasets.Version("1.1.0")
|
| 60 |
-
|
| 61 |
-
def _info(self):
|
| 62 |
-
|
| 63 |
-
features = datasets.Features(
|
| 64 |
-
{
|
| 65 |
-
"id": datasets.Value("string"),
|
| 66 |
-
"question": datasets.Value("string"),
|
| 67 |
-
"opa": datasets.Value("string"),
|
| 68 |
-
"opb": datasets.Value("string"),
|
| 69 |
-
"opc": datasets.Value("string"),
|
| 70 |
-
"opd": datasets.Value("string"),
|
| 71 |
-
"cop": datasets.features.ClassLabel(names=["a", "b", "c", "d"]),
|
| 72 |
-
"choice_type": datasets.Value("string"),
|
| 73 |
-
"exp": datasets.Value("string"),
|
| 74 |
-
"subject_name": datasets.Value("string"),
|
| 75 |
-
"topic_name": datasets.Value("string"),
|
| 76 |
-
}
|
| 77 |
-
)
|
| 78 |
-
return datasets.DatasetInfo(
|
| 79 |
-
description=_DESCRIPTION,
|
| 80 |
-
features=features,
|
| 81 |
-
homepage=_HOMEPAGE,
|
| 82 |
-
license=_LICENSE,
|
| 83 |
-
citation=_CITATION,
|
| 84 |
-
)
|
| 85 |
-
|
| 86 |
-
def _split_generators(self, dl_manager):
|
| 87 |
-
"""Returns SplitGenerators."""
|
| 88 |
-
data_dir = dl_manager.download_and_extract(_URL)
|
| 89 |
-
return [
|
| 90 |
-
datasets.SplitGenerator(
|
| 91 |
-
name=datasets.Split.TRAIN,
|
| 92 |
-
gen_kwargs={
|
| 93 |
-
"filepath": os.path.join(data_dir, "train.json"),
|
| 94 |
-
},
|
| 95 |
-
),
|
| 96 |
-
datasets.SplitGenerator(
|
| 97 |
-
name=datasets.Split.TEST,
|
| 98 |
-
gen_kwargs={
|
| 99 |
-
"filepath": os.path.join(data_dir, "test.json"),
|
| 100 |
-
},
|
| 101 |
-
),
|
| 102 |
-
datasets.SplitGenerator(
|
| 103 |
-
name=datasets.Split.VALIDATION,
|
| 104 |
-
gen_kwargs={
|
| 105 |
-
"filepath": os.path.join(data_dir, "dev.json"),
|
| 106 |
-
},
|
| 107 |
-
),
|
| 108 |
-
]
|
| 109 |
-
|
| 110 |
-
def _generate_examples(self, filepath):
|
| 111 |
-
with open(filepath, encoding="utf-8") as f:
|
| 112 |
-
for key, row in enumerate(f):
|
| 113 |
-
data = json.loads(row)
|
| 114 |
-
data["cop"] = int(data.get("cop", 0)) - 1
|
| 115 |
-
data["exp"] = data.get("exp", "")
|
| 116 |
-
yield key, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|