Convert dataset to Parquet
#3
by
garrethlee
- opened
- IndoMMLU.csv +0 -0
- IndoMMLU.py +0 -172
- README.md +29 -0
- data/test-00000-of-00001.parquet +3 -0
IndoMMLU.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
IndoMMLU.py
DELETED
|
@@ -1,172 +0,0 @@
|
|
| 1 |
-
import csv
|
| 2 |
-
import datasets
|
| 3 |
-
|
| 4 |
-
_CITATION = """\
|
| 5 |
-
@inproceedings{koto-etal-2023-indommlu,
|
| 6 |
-
title = "Large Language Models Only Pass Primary School Exams in {I}ndonesia: A Comprehensive Test on {I}ndo{MMLU}",
|
| 7 |
-
author = "Fajri Koto and Nurul Aisyah and Haonan Li and Timothy Baldwin",
|
| 8 |
-
booktitle = "Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
|
| 9 |
-
month = December,
|
| 10 |
-
year = "2023",
|
| 11 |
-
address = "Singapore",
|
| 12 |
-
publisher = "Association for Computational Linguistics",
|
| 13 |
-
}"""
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
subject2english = {
|
| 17 |
-
'Sejarah': 'History',
|
| 18 |
-
'Geografi': 'Geography',
|
| 19 |
-
'Bahasa Lampung': 'Lampungic',
|
| 20 |
-
'IPS': 'Social science',
|
| 21 |
-
'Bahasa Bali': 'Balinese',
|
| 22 |
-
'Bahasa Makassar': 'Makassarese',
|
| 23 |
-
'Bahasa Banjar': 'Banjarese',
|
| 24 |
-
'Kimia': 'Chemistry',
|
| 25 |
-
'Biologi': 'Biology',
|
| 26 |
-
'IPA': 'Science',
|
| 27 |
-
'Agama Kristen': 'Christian religion',
|
| 28 |
-
'Kesenian': 'Art',
|
| 29 |
-
'Agama Islam': 'Islam religion',
|
| 30 |
-
'Agama Hindu': 'Hindu religion',
|
| 31 |
-
'Bahasa Madura': 'Madurese',
|
| 32 |
-
'Penjaskes': 'Sport',
|
| 33 |
-
'Bahasa Indonesia': 'Indonesian language',
|
| 34 |
-
'Fisika': 'Physics',
|
| 35 |
-
'Budaya Alam Minangkabau': 'Minangkabau culture',
|
| 36 |
-
'Bahasa Dayak Ngaju': 'Dayak language',
|
| 37 |
-
'Sosiologi': 'Sociology',
|
| 38 |
-
'Ekonomi': 'Economy',
|
| 39 |
-
'Bahasa Sunda': 'Sundanese',
|
| 40 |
-
'Bahasa Jawa': 'Javanese',
|
| 41 |
-
'PPKN': 'Civic education',
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
subject2group = {
|
| 45 |
-
'Sejarah': 'Humanities',
|
| 46 |
-
'Geografi': 'Social science',
|
| 47 |
-
'Bahasa Lampung': 'Local languages and cultures',
|
| 48 |
-
'IPS': 'Social science',
|
| 49 |
-
'Bahasa Bali': 'Local languages and cultures',
|
| 50 |
-
'Bahasa Makassar': 'Local languages and cultures',
|
| 51 |
-
'Bahasa Banjar': 'Local languages and cultures',
|
| 52 |
-
'Kimia': 'STEM',
|
| 53 |
-
'Biologi': 'STEM',
|
| 54 |
-
'IPA': 'STEM',
|
| 55 |
-
'Agama Kristen': 'Humanities',
|
| 56 |
-
'Kesenian': 'Humanities',
|
| 57 |
-
'Agama Islam': 'Humanities',
|
| 58 |
-
'Agama Hindu': 'Humanities',
|
| 59 |
-
'Bahasa Madura': 'Local languages and cultures',
|
| 60 |
-
'Penjaskes': 'Humanities',
|
| 61 |
-
'Bahasa Indonesia': 'Indonesian language',
|
| 62 |
-
'Fisika': 'STEM',
|
| 63 |
-
'Budaya Alam Minangkabau': 'Local languages and cultures',
|
| 64 |
-
'Bahasa Dayak Ngaju': 'Local languages and cultures',
|
| 65 |
-
'Sosiologi': 'Social science',
|
| 66 |
-
'Ekonomi': 'Social science',
|
| 67 |
-
'Bahasa Sunda': 'Local languages and cultures',
|
| 68 |
-
'Bahasa Jawa': 'Local languages and cultures',
|
| 69 |
-
'PPKN': 'Social science',
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
special_case = ['SD-SMP-SMA', 'SD-SMP']
|
| 73 |
-
level_mapper = {
|
| 74 |
-
'SMA': 'SMA',
|
| 75 |
-
'Seleksi PTN': 'University entrance test',
|
| 76 |
-
'SD': 'SD',
|
| 77 |
-
'SMP': 'SMP',
|
| 78 |
-
'Kelas I SD': 'SD',
|
| 79 |
-
'Kelas X SMA': 'SMA',
|
| 80 |
-
'Kelas XI SMA': 'SMA',
|
| 81 |
-
'Kelas XII SMA': 'SMA',
|
| 82 |
-
'V SD': 'SD',
|
| 83 |
-
'VI SD': 'SD',
|
| 84 |
-
'VII SMP': 'SMP',
|
| 85 |
-
'VIII SMP ': 'SMP',
|
| 86 |
-
'IX SMP': 'SMP',
|
| 87 |
-
'Kelas III SD':'SD',
|
| 88 |
-
'Kelas IV SD': 'SD',
|
| 89 |
-
'Kelas II SD': 'SD'
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
def fix_level(level, kelas):
|
| 93 |
-
#Fixing Level
|
| 94 |
-
if level in special_case:
|
| 95 |
-
kelas = float(kelas)
|
| 96 |
-
if kelas >=1 and kelas <= 6:
|
| 97 |
-
level = 'SD'
|
| 98 |
-
elif kelas >=7 and kelas <= 9:
|
| 99 |
-
level = 'SMP'
|
| 100 |
-
elif kelas >=10:
|
| 101 |
-
level = 'SMA'
|
| 102 |
-
else:
|
| 103 |
-
print(level)
|
| 104 |
-
fixed_level = level_mapper[level]
|
| 105 |
-
|
| 106 |
-
#Fixing class
|
| 107 |
-
fixed_kelas = -1
|
| 108 |
-
kelas = str(kelas)
|
| 109 |
-
if kelas.strip() in ['PTN', '2023-10-12 00:00:00']:
|
| 110 |
-
fixed_kelas = 13
|
| 111 |
-
elif kelas == '4,5,6':
|
| 112 |
-
fixed_kelas = 6
|
| 113 |
-
else:
|
| 114 |
-
fixed_kelas = int(float(kelas.strip()))
|
| 115 |
-
|
| 116 |
-
# sanity check over the level and kelas
|
| 117 |
-
return fixed_level, fixed_kelas
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
_URL = {
|
| 121 |
-
'test': "https://huggingface.co/datasets/indolem/IndoMMLU/resolve/main/IndoMMLU.csv",
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
class IndoMMLUConfig(datasets.BuilderConfig):
|
| 125 |
-
"""IndoMMLUConfig for IndoMMLU"""
|
| 126 |
-
|
| 127 |
-
def __init__(self, **kwargs):
|
| 128 |
-
"""BuilderConfig for IndoStoryCloze.
|
| 129 |
-
**kwargs: keyword arguments forwarded to super.
|
| 130 |
-
"""
|
| 131 |
-
# Version history:
|
| 132 |
-
# 1.0.0: Release version
|
| 133 |
-
super().__init__(version=datasets.Version("1.0.0"), **kwargs)
|
| 134 |
-
self.features = ['subject', 'group', 'level', 'class', 'question', 'options', 'answer', 'is_for_fewshot']
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
class IndoMMLU(datasets.GeneratorBasedBuilder):
|
| 138 |
-
"""The IndoMMLU Datasets."""
|
| 139 |
-
|
| 140 |
-
BUILDER_CONFIGS = [IndoMMLUConfig()]
|
| 141 |
-
|
| 142 |
-
def _info(self):
|
| 143 |
-
features = {feature: datasets.Value("string") for feature in self.config.features}
|
| 144 |
-
|
| 145 |
-
return datasets.DatasetInfo(
|
| 146 |
-
description='IndoMMLU',
|
| 147 |
-
features=datasets.Features(features),
|
| 148 |
-
homepage='https://github.com/fajri91/IndoMMLU',
|
| 149 |
-
citation=_CITATION
|
| 150 |
-
)
|
| 151 |
-
|
| 152 |
-
def _split_generators(self, dl_manager):
|
| 153 |
-
downloaded_file = dl_manager.download_and_extract(_URL)
|
| 154 |
-
|
| 155 |
-
return [
|
| 156 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"data_file": downloaded_file['test']}),
|
| 157 |
-
]
|
| 158 |
-
|
| 159 |
-
def _generate_examples(self, data_file):
|
| 160 |
-
data = csv.DictReader(open(data_file, newline=''))
|
| 161 |
-
for i, row in enumerate(data):
|
| 162 |
-
fixed_level, fixed_kelas = fix_level(row['level'], row['kelas'])
|
| 163 |
-
yield i, {
|
| 164 |
-
"subject": subject2english[row['subject']],
|
| 165 |
-
"group": subject2group[row['subject']],
|
| 166 |
-
"level": fixed_level,
|
| 167 |
-
"class": fixed_kelas,
|
| 168 |
-
"question": row['soal'],
|
| 169 |
-
"options": row['jawaban'].split('\n'),
|
| 170 |
-
"answer": row['kunci'],
|
| 171 |
-
"is_for_fewshot": row['is_for_fewshot']
|
| 172 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -9,6 +9,35 @@ tags:
|
|
| 9 |
pretty_name: IndoMMLU
|
| 10 |
size_categories:
|
| 11 |
- 10K<n<100K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
# IndoMMLU
|
| 14 |
|
|
|
|
| 9 |
pretty_name: IndoMMLU
|
| 10 |
size_categories:
|
| 11 |
- 10K<n<100K
|
| 12 |
+
configs:
|
| 13 |
+
- config_name: default
|
| 14 |
+
data_files:
|
| 15 |
+
- split: test
|
| 16 |
+
path: data/test-*
|
| 17 |
+
dataset_info:
|
| 18 |
+
features:
|
| 19 |
+
- name: subject
|
| 20 |
+
dtype: string
|
| 21 |
+
- name: group
|
| 22 |
+
dtype: string
|
| 23 |
+
- name: level
|
| 24 |
+
dtype: string
|
| 25 |
+
- name: class
|
| 26 |
+
dtype: string
|
| 27 |
+
- name: question
|
| 28 |
+
dtype: string
|
| 29 |
+
- name: options
|
| 30 |
+
dtype: string
|
| 31 |
+
- name: answer
|
| 32 |
+
dtype: string
|
| 33 |
+
- name: is_for_fewshot
|
| 34 |
+
dtype: string
|
| 35 |
+
splits:
|
| 36 |
+
- name: test
|
| 37 |
+
num_bytes: 5294005
|
| 38 |
+
num_examples: 14981
|
| 39 |
+
download_size: 2216431
|
| 40 |
+
dataset_size: 5294005
|
| 41 |
---
|
| 42 |
# IndoMMLU
|
| 43 |
|
data/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2061d9e558f022682fd554890dca2bffe30652bad4284b0168c5a0e4858e597
|
| 3 |
+
size 2216431
|