Datasets:

Languages:
Indonesian
ArXiv:
License:
garrethlee HF staff commited on
Commit
5f9ff6e
1 Parent(s): fc31b26

Delete loading script

Browse files
Files changed (1) hide show
  1. IndoMMLU.py +0 -172
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
- }