metom commited on
Commit
5003ef3
1 Parent(s): 69d167d
Files changed (3) hide show
  1. README.md +38 -0
  2. ceval-exam.py +167 -0
  3. ceval-exam.zip +3 -0
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ task_categories:
4
+ - text-classification
5
+ - multiple-choice
6
+ - question-answering
7
+ language:
8
+ - zh
9
+ pretty_name: C-Eval
10
+ size_categories:
11
+ - 10K<n<100K
12
+ ---
13
+
14
+ C-Eval is a comprehensive Chinese evaluation suite for foundation models. It consists of 13948 multi-choice questions spanning 52 diverse disciplines and four difficulty levels. Please visit our [website](https://cevalbenchmark.com/) and [GitHub](https://github.com/SJTU-LIT/ceval/tree/main) or check our [paper](https://arxiv.org/abs/2305.08322) for more details.
15
+
16
+ Each subject consists of three splits: dev, val, and test. The dev set per subject consists of five exemplars with explanations for few-shot evaluation. The val set is intended to be used for hyperparameter tuning. And the test set is for model evaluation. Labels on the test split are not released, users are required to submit their results to automatically obtain test accuracy. [How to submit?](https://github.com/SJTU-LIT/ceval/tree/main#how-to-submit)
17
+
18
+ ### Load the data
19
+ ```python
20
+ from datasets import load_dataset
21
+ dataset=load_dataset(r"ceval/ceval-exam",name="computer_network")
22
+
23
+ print(dataset['val'][0])
24
+ # {'id': 0, 'question': '使用位填充方法,以01111110为位首flag,数据为011011111111111111110010,求问传送时要添加几个0____', 'A': '1', 'B': '2', 'C': '3', 'D': '4', 'answer': 'C', 'explanation': ''}
25
+ ```
26
+ More details on loading and using the data are at our [github page](https://github.com/SJTU-LIT/ceval#data).
27
+
28
+ Please cite our paper if you use our dataset.
29
+ ```
30
+ @article{huang2023ceval,
31
+ title={C-Eval: A Multi-Level Multi-Discipline Chinese Evaluation Suite for Foundation Models},
32
+ author={Huang, Yuzhen and Bai, Yuzhuo and Zhu, Zhihao and Zhang, Junlei and Zhang, Jinghan and Su, Tangjun and Liu, Junteng and Lv, Chuancheng and Zhang, Yikai and Lei, Jiayi and Fu, Yao and Sun, Maosong and He, Junxian},
33
+ journal={arXiv preprint arXiv:2305.08322},
34
+ year={2023}
35
+ }
36
+ ```
37
+
38
+
ceval-exam.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ _CITATION = """\
21
+ @article{huang2023ceval,
22
+ title={C-Eval: A Multi-Level Multi-Discipline Chinese Evaluation Suite for Foundation Models},
23
+ author={Huang, Yuzhen and Bai, Yuzhuo and Zhu, Zhihao and Zhang, Junlei and Zhang, Jinghan and Su, Tangjun and Liu, Junteng and Lv, Chuancheng and Zhang, Yikai and Lei, Jiayi and Fu, Yao and Sun, Maosong and He, Junxian},
24
+ journal={arXiv preprint arXiv:2305.08322},
25
+ year={2023}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ C-Eval is a comprehensive Chinese evaluation suite for foundation models. It consists of 13948 multi-choice questions spanning 52 diverse disciplines and four difficulty levels.
31
+ """
32
+
33
+ _HOMEPAGE = "https://cevalbenchmark.com"
34
+
35
+ _LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License"
36
+
37
+ _URL = r"https://huggingface.co/datasets/cryptom/ceval/resolve/main/ceval-exam.zip"
38
+
39
+ task_list = [
40
+ "merge",
41
+ "computer_network",
42
+ "operating_system",
43
+ "computer_architecture",
44
+ "college_programming",
45
+ "college_physics",
46
+ "college_chemistry",
47
+ "advanced_mathematics",
48
+ "probability_and_statistics",
49
+ "discrete_mathematics",
50
+ "electrical_engineer",
51
+ "metrology_engineer",
52
+ "high_school_mathematics",
53
+ "high_school_physics",
54
+ "high_school_chemistry",
55
+ "high_school_biology",
56
+ "middle_school_mathematics",
57
+ "middle_school_biology",
58
+ "middle_school_physics",
59
+ "middle_school_chemistry",
60
+ "veterinary_medicine",
61
+ "college_economics",
62
+ "business_administration",
63
+ "marxism",
64
+ "mao_zedong_thought",
65
+ "education_science",
66
+ "teacher_qualification",
67
+ "high_school_politics",
68
+ "high_school_geography",
69
+ "middle_school_politics",
70
+ "middle_school_geography",
71
+ "modern_chinese_history",
72
+ "ideological_and_moral_cultivation",
73
+ "logic",
74
+ "law",
75
+ "chinese_language_and_literature",
76
+ "art_studies",
77
+ "professional_tour_guide",
78
+ "legal_professional",
79
+ "high_school_chinese",
80
+ "high_school_history",
81
+ "middle_school_history",
82
+ "civil_servant",
83
+ "sports_science",
84
+ "plant_protection",
85
+ "basic_medicine",
86
+ "clinical_medicine",
87
+ "urban_and_rural_planner",
88
+ "accountant",
89
+ "fire_engineer",
90
+ "environmental_impact_assessment_engineer",
91
+ "tax_accountant",
92
+ "physician",
93
+ ]
94
+
95
+
96
+ class CevalExamConfig(datasets.BuilderConfig):
97
+ def __init__(self, **kwargs):
98
+ super().__init__(version=datasets.Version("1.0.0"), **kwargs)
99
+
100
+
101
+ class CevalExam(datasets.GeneratorBasedBuilder):
102
+ BUILDER_CONFIGS = [
103
+ CevalExamConfig(
104
+ name=task_name,
105
+ )
106
+ for task_name in task_list
107
+ ]
108
+
109
+ def _info(self):
110
+ features = datasets.Features(
111
+ {
112
+ "id":datasets.Value("int32"),
113
+ "question": datasets.Value("string"),
114
+ "A": datasets.Value("string"),
115
+ "B": datasets.Value("string"),
116
+ "C": datasets.Value("string"),
117
+ "D": datasets.Value("string"),
118
+ "answer": datasets.Value("string"),
119
+ "explanation":datasets.Value("string"),
120
+ }
121
+ )
122
+ return datasets.DatasetInfo(
123
+ description=_DESCRIPTION,
124
+ features=features,
125
+ homepage=_HOMEPAGE,
126
+ license=_LICENSE,
127
+ citation=_CITATION,
128
+ )
129
+
130
+ def _split_generators(self, dl_manager):
131
+ data_dir = dl_manager.download_and_extract(_URL)
132
+ task_name = self.config.name
133
+ return [
134
+ datasets.SplitGenerator(
135
+ name=datasets.Split.TEST,
136
+ gen_kwargs={
137
+ "filepath": os.path.join(
138
+ data_dir, "test", f"{task_name}_test.csv"
139
+ ),
140
+ },
141
+ ),
142
+ datasets.SplitGenerator(
143
+ name=datasets.Split("val"),
144
+ gen_kwargs={
145
+ "filepath": os.path.join(
146
+ data_dir, "val", f"{task_name}_val.csv"
147
+ ),
148
+ },
149
+ ),
150
+ datasets.SplitGenerator(
151
+ name=datasets.Split("dev"),
152
+ gen_kwargs={
153
+ "filepath": os.path.join(
154
+ data_dir, "dev", f"{task_name}_dev.csv"
155
+ ),
156
+ },
157
+ ),
158
+ ]
159
+
160
+ def _generate_examples(self, filepath):
161
+ df = pd.read_csv(filepath,encoding="utf-8")
162
+ for i, instance in enumerate(df.to_dict(orient="records")):
163
+ if "answer" not in instance.keys():
164
+ instance["answer"]=""
165
+ if "explanation" not in instance.keys():
166
+ instance["explanation"]=""
167
+ yield i, instance
ceval-exam.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60f9c5b1142c0480ad7ca2646fd84f6d65b3439e384f707e28c767f6e7a28ea4
3
+ size 1611510