baiyu0325 commited on
Commit
94d6ca8
1 Parent(s): c573afe

Delete neteval-exam.py

Browse files
Files changed (1) hide show
  1. neteval-exam.py +0 -114
neteval-exam.py DELETED
@@ -1,114 +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
- _CITATION = """\
21
- @misc{miao2023empirical,
22
- title={An Empirical Study of NetOps Capability of Pre-Trained Large Language Models},
23
- author={Yukai Miao and Yu Bai and Li Chen and Dan Li and Haifeng Sun and Xizheng Wang and Ziqiu Luo and Dapeng Sun and Xiuting Xu and Qi Zhang and Chao Xiang and Xinchi Li},
24
- year={2023},
25
- eprint={2309.05557},
26
- archivePrefix={arXiv},
27
- primaryClass={cs.CL}
28
- }
29
- """
30
-
31
- _DESCRIPTION = """\
32
- NetEval is a NetOps evaluation suite for foundation models, consisting of 5269 multi-choice questions.
33
- """
34
-
35
- _LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License"
36
-
37
- _URL = r"https://huggingface.co/datasets/NASP/neteval-exam/resolve/main/neteval-exam.zip"
38
-
39
- task_list = [
40
- "network",
41
- "security",
42
- ]
43
-
44
-
45
- class NetEvalExamConfig(datasets.BuilderConfig):
46
- def __init__(self, **kwargs):
47
- super().__init__(version=datasets.Version("1.0.0"), **kwargs)
48
-
49
-
50
- class NetEvalExam(datasets.GeneratorBasedBuilder):
51
- BUILDER_CONFIGS = [
52
- NetEvalExamConfig(
53
- name=task_name,
54
- )
55
- for task_name in task_list
56
- ]
57
-
58
- def _info(self):
59
- features = datasets.Features(
60
- {
61
- "Question": datasets.Value("string"),
62
- "A": datasets.Value("string"),
63
- "B": datasets.Value("string"),
64
- "C": datasets.Value("string"),
65
- "D": datasets.Value("string"),
66
- "Answer": datasets.Value("string"),
67
- "Explanation":datasets.Value("string"),
68
- }
69
- )
70
- return datasets.DatasetInfo(
71
- description=_DESCRIPTION,
72
- features=features,
73
- license=_LICENSE,
74
- citation=_CITATION,
75
- )
76
-
77
- def _split_generators(self, dl_manager):
78
- data_dir = dl_manager.download_and_extract(_URL)
79
- task_name = self.config.name
80
- return [
81
- datasets.SplitGenerator(
82
- name=datasets.Split.TEST,
83
- gen_kwargs={
84
- "filepath": os.path.join(
85
- data_dir, "test", f"{task_name}.csv"
86
- ),
87
- },
88
- ),
89
- datasets.SplitGenerator(
90
- name=datasets.Split("val"),
91
- gen_kwargs={
92
- "filepath": os.path.join(
93
- data_dir, "val", f"{task_name}.csv"
94
- ),
95
- },
96
- ),
97
- datasets.SplitGenerator(
98
- name=datasets.Split("dev"),
99
- gen_kwargs={
100
- "filepath": os.path.join(
101
- data_dir, "dev", f"{task_name}.csv"
102
- ),
103
- },
104
- ),
105
- ]
106
-
107
- def _generate_examples(self, filepath):
108
- df = pd.read_csv(filepath,encoding="utf-8")
109
- for i, instance in enumerate(df.to_dict(orient="records")):
110
- if "Answer" not in instance.keys():
111
- instance["Answer"]=""
112
- if "Explanation" not in instance.keys():
113
- instance["Explanation"]=""
114
- yield i, instance