ikala-ray commited on
Commit
65beb84
1 Parent(s): b217cb1

Delete tmmluplus.py

Browse files
Files changed (1) hide show
  1. tmmluplus.py +0 -124
tmmluplus.py DELETED
@@ -1,124 +0,0 @@
1
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- import os
15
-
16
- import datasets
17
- import pandas as pd
18
-
19
-
20
- _DESCRIPTION = """\
21
- TMMLU2 data loader
22
- """
23
- _DATA_PATH = "data"
24
-
25
- task_list = [
26
- 'dentistry', 'traditional_chinese_medicine_clinical_medicine', 'clinical_psychology',
27
- 'technical', 'culinary_skills', 'mechanical', 'logic_reasoning', 'real_estate',
28
- 'general_principles_of_law', 'finance_banking', 'anti_money_laundering', 'ttqav2',
29
- 'marketing_management', 'business_management', 'organic_chemistry', 'advance_chemistry',
30
- 'physics', 'secondary_physics', 'human_behavior', 'national_protection', 'jce_humanities',
31
- 'politic_science', 'agriculture', 'official_document_management',
32
- 'financial_analysis', 'pharmacy', 'educational_psychology', 'statistics_and_machine_learning',
33
- 'management_accounting', 'introduction_to_law', 'computer_science', 'veterinary_pathology',
34
- 'accounting', 'fire_science', 'optometry', 'insurance_studies', 'pharmacology', 'taxation',
35
- 'education_(profession_level)', 'economics',
36
- 'veterinary_pharmacology', 'nautical_science', 'occupational_therapy_for_psychological_disorders',
37
- 'trust_practice', 'geography_of_taiwan', 'physical_education', 'auditing', 'administrative_law',
38
- 'basic_medical_science', 'macroeconomics', 'trade', 'chinese_language_and_literature',
39
- 'tve_design', 'junior_science_exam', 'junior_math_exam', 'junior_chinese_exam',
40
- 'junior_social_studies', 'tve_mathematics', 'tve_chinese_language',
41
- 'tve_natural_sciences', 'junior_chemistry', 'music', 'education',
42
- 'three_principles_of_people', 'taiwanese_hokkien',
43
- 'engineering_math'
44
- ]
45
-
46
- _URLs = {
47
- task_name: {
48
- split_name: [
49
- os.path.join(
50
- _DATA_PATH, task_name+"_"+split_name+".csv"
51
- ), # TODO -> handle multiple shards
52
- ]
53
- for split_name in ['dev', 'test', 'val']
54
- }
55
- for task_name in task_list
56
- }
57
-
58
-
59
- class TMMLU2Config(datasets.BuilderConfig):
60
- def __init__(self, **kwargs):
61
- super().__init__(version=datasets.Version("1.0.0"), **kwargs)
62
-
63
-
64
- class TMMLU2(datasets.GeneratorBasedBuilder):
65
- BUILDER_CONFIGS = [
66
- TMMLU2Config(
67
- name=task_name,
68
- )
69
- for task_name in task_list
70
- ]
71
-
72
- def _info(self):
73
- features = datasets.Features(
74
- {
75
- "question": datasets.Value("string"),
76
- "A": datasets.Value("string"),
77
- "B": datasets.Value("string"),
78
- "C": datasets.Value("string"),
79
- "D": datasets.Value("string"),
80
- "answer": datasets.Value("string"),
81
- }
82
- )
83
- return datasets.DatasetInfo(
84
- description=_DESCRIPTION,
85
- features=features,
86
- )
87
-
88
- def _split_generators(self, dl_manager):
89
- task_name = self.config.name
90
- data_dir = dl_manager.download(_URLs[task_name])
91
- return [
92
- datasets.SplitGenerator(
93
- name=datasets.Split.TEST,
94
- gen_kwargs={
95
- "filepath": data_dir['test'],
96
- },
97
- ),
98
- datasets.SplitGenerator(
99
- name=datasets.Split.VALIDATION,
100
- gen_kwargs={
101
- "filepath": data_dir['val'],
102
- },
103
- ),
104
- datasets.SplitGenerator(
105
- name=datasets.Split.TRAIN,
106
- gen_kwargs={
107
- "filepath": data_dir['dev'],
108
- },
109
- ),
110
- ]
111
-
112
- def _generate_examples(self, filepath):
113
- if isinstance(filepath, list):
114
- filepath = filepath[0]
115
- df = pd.read_csv(filepath)
116
-
117
- for i, instance in enumerate(df.to_dict(orient="records")):
118
- yield i, {'question': instance['question'],
119
- 'A': instance['A'],
120
- 'B': instance['B'],
121
- 'C': instance['C'],
122
- 'D': instance['D'],
123
- 'answer': instance['answer']
124
- }