evalscope 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. evalscope/__init__.py +3 -0
  2. evalscope/backend/__init__.py +3 -0
  3. evalscope/backend/base.py +27 -0
  4. evalscope/backend/opencompass/__init__.py +3 -0
  5. evalscope/backend/opencompass/api_meta_template.py +64 -0
  6. evalscope/backend/opencompass/backend_manager.py +247 -0
  7. evalscope/backend/opencompass/tasks/__init__.py +1 -0
  8. evalscope/backend/opencompass/tasks/eval_api.py +30 -0
  9. evalscope/backend/opencompass/tasks/eval_datasets.py +71 -0
  10. evalscope/backend/vlm_eval_kit/__init__.py +1 -0
  11. evalscope/backend/vlm_eval_kit/backend_manager.py +153 -0
  12. evalscope/benchmarks/__init__.py +4 -0
  13. evalscope/benchmarks/arc/__init__.py +5 -0
  14. evalscope/benchmarks/arc/ai2_arc.py +148 -0
  15. evalscope/benchmarks/arc/arc_adapter.py +231 -0
  16. evalscope/benchmarks/bbh/__init__.py +6 -0
  17. evalscope/benchmarks/bbh/bbh_adapter.py +308 -0
  18. evalscope/benchmarks/bbh/cot_prompts/boolean_expressions.txt +23 -0
  19. evalscope/benchmarks/bbh/cot_prompts/causal_judgement.txt +25 -0
  20. evalscope/benchmarks/bbh/cot_prompts/date_understanding.txt +33 -0
  21. evalscope/benchmarks/bbh/cot_prompts/disambiguation_qa.txt +37 -0
  22. evalscope/benchmarks/bbh/cot_prompts/dyck_languages.txt +72 -0
  23. evalscope/benchmarks/bbh/cot_prompts/formal_fallacies.txt +44 -0
  24. evalscope/benchmarks/bbh/cot_prompts/geometric_shapes.txt +78 -0
  25. evalscope/benchmarks/bbh/cot_prompts/hyperbaton.txt +28 -0
  26. evalscope/benchmarks/bbh/cot_prompts/logical_deduction_five_objects.txt +37 -0
  27. evalscope/benchmarks/bbh/cot_prompts/logical_deduction_seven_objects.txt +37 -0
  28. evalscope/benchmarks/bbh/cot_prompts/logical_deduction_three_objects.txt +37 -0
  29. evalscope/benchmarks/bbh/cot_prompts/movie_recommendation.txt +42 -0
  30. evalscope/benchmarks/bbh/cot_prompts/multistep_arithmetic_two.txt +25 -0
  31. evalscope/benchmarks/bbh/cot_prompts/navigate.txt +43 -0
  32. evalscope/benchmarks/bbh/cot_prompts/object_counting.txt +37 -0
  33. evalscope/benchmarks/bbh/cot_prompts/penguins_in_a_table.txt +41 -0
  34. evalscope/benchmarks/bbh/cot_prompts/reasoning_about_colored_objects.txt +63 -0
  35. evalscope/benchmarks/bbh/cot_prompts/ruin_names.txt +44 -0
  36. evalscope/benchmarks/bbh/cot_prompts/salient_translation_error_detection.txt +40 -0
  37. evalscope/benchmarks/bbh/cot_prompts/snarks.txt +30 -0
  38. evalscope/benchmarks/bbh/cot_prompts/sports_understanding.txt +10 -0
  39. evalscope/benchmarks/bbh/cot_prompts/temporal_sequences.txt +77 -0
  40. evalscope/benchmarks/bbh/cot_prompts/tracking_shuffled_objects_five_objects.txt +40 -0
  41. evalscope/benchmarks/bbh/cot_prompts/tracking_shuffled_objects_seven_objects.txt +40 -0
  42. evalscope/benchmarks/bbh/cot_prompts/tracking_shuffled_objects_three_objects.txt +40 -0
  43. evalscope/benchmarks/bbh/cot_prompts/web_of_lies.txt +28 -0
  44. evalscope/benchmarks/bbh/cot_prompts/word_sorting.txt +17 -0
  45. evalscope/benchmarks/benchmark.py +65 -0
  46. evalscope/benchmarks/ceval/__init__.py +5 -0
  47. evalscope/benchmarks/ceval/ceval_adapter.py +340 -0
  48. evalscope/benchmarks/ceval/ceval_exam.py +159 -0
  49. evalscope/benchmarks/cmmlu/__init__.py +5 -0
  50. evalscope/benchmarks/cmmlu/cmmlu.py +166 -0
  51. evalscope/benchmarks/cmmlu/cmmlu_adapter.py +369 -0
  52. evalscope/benchmarks/competition_math/__init__.py +5 -0
  53. evalscope/benchmarks/competition_math/competition_math.py +88 -0
  54. evalscope/benchmarks/competition_math/competition_math_adapter.py +470 -0
  55. evalscope/benchmarks/data_adapter.py +263 -0
  56. evalscope/benchmarks/general_qa/__init__.py +5 -0
  57. evalscope/benchmarks/general_qa/general_qa_adapter.py +186 -0
  58. evalscope/benchmarks/gsm8k/__init__.py +5 -0
  59. evalscope/benchmarks/gsm8k/gsm8k.py +127 -0
  60. evalscope/benchmarks/gsm8k/gsm8k_adapter.py +236 -0
  61. evalscope/benchmarks/hellaswag/__init__.py +5 -0
  62. evalscope/benchmarks/hellaswag/hellaswag.py +116 -0
  63. evalscope/benchmarks/hellaswag/hellaswag_adapter.py +222 -0
  64. evalscope/benchmarks/humaneval/__init__.py +5 -0
  65. evalscope/benchmarks/humaneval/humaneval.py +82 -0
  66. evalscope/benchmarks/humaneval/humaneval_adapter.py +21 -0
  67. evalscope/benchmarks/mmlu/__init__.py +5 -0
  68. evalscope/benchmarks/mmlu/mmlu.py +174 -0
  69. evalscope/benchmarks/mmlu/mmlu_adapter.py +375 -0
  70. evalscope/benchmarks/race/__init__.py +5 -0
  71. evalscope/benchmarks/race/race.py +118 -0
  72. evalscope/benchmarks/race/race_adapter.py +229 -0
  73. evalscope/benchmarks/trivia_qa/__init__.py +5 -0
  74. evalscope/benchmarks/trivia_qa/trivia_qa.py +104 -0
  75. evalscope/benchmarks/trivia_qa/trivia_qa_adapter.py +207 -0
  76. evalscope/benchmarks/truthful_qa/__init__.py +5 -0
  77. evalscope/benchmarks/truthful_qa/truthful_qa.py +167 -0
  78. evalscope/benchmarks/truthful_qa/truthful_qa_adapter.py +351 -0
  79. evalscope/cache.py +98 -0
  80. evalscope/cli/__init__.py +1 -0
  81. evalscope/cli/base.py +20 -0
  82. evalscope/cli/cli.py +26 -0
  83. evalscope/cli/start_perf.py +37 -0
  84. evalscope/cli/start_server.py +138 -0
  85. evalscope/config.py +165 -0
  86. evalscope/constants.py +150 -0
  87. evalscope/evaluator/__init__.py +3 -0
  88. evalscope/evaluator/evaluator.py +689 -0
  89. evalscope/evaluator/rating_eval.py +178 -0
  90. evalscope/evaluator/reviewer/__init__.py +1 -0
  91. evalscope/evaluator/reviewer/auto_reviewer.py +411 -0
  92. evalscope/metrics/__init__.py +1 -0
  93. evalscope/metrics/bundled_rouge_score/__init__.py +14 -0
  94. evalscope/metrics/bundled_rouge_score/rouge_scorer.py +342 -0
  95. evalscope/metrics/code_metric.py +104 -0
  96. evalscope/metrics/math_accuracy.py +60 -0
  97. evalscope/metrics/metrics.py +405 -0
  98. evalscope/metrics/rouge_metric.py +129 -0
  99. evalscope/models/__init__.py +4 -0
  100. evalscope/models/custom/__init__.py +4 -0
  101. evalscope/models/custom/custom_model.py +53 -0
  102. evalscope/models/dummy_chat_model.py +50 -0
  103. evalscope/models/model.py +88 -0
  104. evalscope/models/model_adapter.py +586 -0
  105. evalscope/models/openai_model.py +103 -0
  106. evalscope/models/template.py +1446 -0
  107. evalscope/perf/__init__.py +0 -0
  108. evalscope/perf/_logging.py +32 -0
  109. evalscope/perf/api_plugin_base.py +60 -0
  110. evalscope/perf/custom_api.py +87 -0
  111. evalscope/perf/dashscope_api.py +84 -0
  112. evalscope/perf/dataset_plugin_base.py +64 -0
  113. evalscope/perf/datasets/__init__.py +0 -0
  114. evalscope/perf/datasets/line_by_line.py +18 -0
  115. evalscope/perf/datasets/longalpaca_12k.py +20 -0
  116. evalscope/perf/datasets/openqa.py +22 -0
  117. evalscope/perf/how_to_analysis_result.py +24 -0
  118. evalscope/perf/http_client.py +756 -0
  119. evalscope/perf/openai_api.py +130 -0
  120. evalscope/perf/plugin_registry.py +35 -0
  121. evalscope/perf/query_parameters.py +42 -0
  122. evalscope/perf/server_sent_event.py +43 -0
  123. evalscope/preprocess/__init__.py +1 -0
  124. evalscope/preprocess/tokenizers/__init__.py +0 -0
  125. evalscope/preprocess/tokenizers/gpt2_tokenizer.py +221 -0
  126. evalscope/registry/__init__.py +1 -0
  127. evalscope/registry/tasks/arc.yaml +29 -0
  128. evalscope/registry/tasks/bbh.yaml +27 -0
  129. evalscope/registry/tasks/bbh_mini.yaml +27 -0
  130. evalscope/registry/tasks/ceval.yaml +27 -0
  131. evalscope/registry/tasks/ceval_mini.yaml +27 -0
  132. evalscope/registry/tasks/cmmlu.yaml +27 -0
  133. evalscope/registry/tasks/eval_qwen-7b-chat_v100.yaml +28 -0
  134. evalscope/registry/tasks/general_qa.yaml +27 -0
  135. evalscope/registry/tasks/gsm8k.yaml +29 -0
  136. evalscope/registry/tasks/mmlu.yaml +29 -0
  137. evalscope/registry/tasks/mmlu_mini.yaml +27 -0
  138. evalscope/run.py +404 -0
  139. evalscope/run_arena.py +204 -0
  140. evalscope/run_ms.py +140 -0
  141. evalscope/summarizer.py +144 -0
  142. evalscope/third_party/__init__.py +1 -0
  143. evalscope/third_party/toolbench_static/__init__.py +3 -0
  144. evalscope/third_party/toolbench_static/eval.py +219 -0
  145. evalscope/third_party/toolbench_static/infer.py +278 -0
  146. evalscope/third_party/toolbench_static/llm/__init__.py +1 -0
  147. evalscope/third_party/toolbench_static/llm/swift_infer.py +45 -0
  148. evalscope/third_party/toolbench_static/toolbench_static.py +50 -0
  149. evalscope/tools/__init__.py +1 -0
  150. evalscope/tools/combine_reports.py +140 -0
  151. evalscope/tools/gen_mmlu_subject_mapping.py +90 -0
  152. evalscope/tools/rewrite_eval_results.py +95 -0
  153. evalscope/utils/__init__.py +4 -0
  154. evalscope/utils/arena_utils.py +247 -0
  155. evalscope/utils/completion_parsers.py +87 -0
  156. evalscope/utils/logger.py +64 -0
  157. evalscope/utils/task_cfg_parser.py +10 -0
  158. evalscope/utils/task_utils.py +19 -0
  159. evalscope/utils/utils.py +625 -0
  160. evalscope/version.py +4 -0
  161. evalscope-0.5.0.dist-info/METADATA +566 -0
  162. evalscope-0.5.0.dist-info/RECORD +165 -0
  163. evalscope-0.5.0.dist-info/WHEEL +5 -0
  164. evalscope-0.5.0.dist-info/entry_points.txt +3 -0
  165. evalscope-0.5.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,566 @@
1
+ Metadata-Version: 2.1
2
+ Name: evalscope
3
+ Version: 0.5.0
4
+ Summary: Eval-Scope: Lightweight LLMs Evaluation Framework
5
+ Home-page: https://github.com/modelscope/eval-scope
6
+ Author: ModelScope team
7
+ Author-email: contact@modelscope.cn
8
+ License: UNKNOWN
9
+ Keywords: python,llm,evaluation
10
+ Platform: UNKNOWN
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: torch
21
+ Requires-Dist: absl-py
22
+ Requires-Dist: accelerate
23
+ Requires-Dist: cachetools
24
+ Requires-Dist: editdistance
25
+ Requires-Dist: jsonlines
26
+ Requires-Dist: matplotlib
27
+ Requires-Dist: modelscope[framework]
28
+ Requires-Dist: nltk
29
+ Requires-Dist: openai
30
+ Requires-Dist: pandas
31
+ Requires-Dist: plotly
32
+ Requires-Dist: pyarrow
33
+ Requires-Dist: pympler
34
+ Requires-Dist: pyyaml
35
+ Requires-Dist: regex
36
+ Requires-Dist: requests
37
+ Requires-Dist: requests-toolbelt
38
+ Requires-Dist: rouge-score
39
+ Requires-Dist: sacrebleu
40
+ Requires-Dist: scikit-learn
41
+ Requires-Dist: seaborn
42
+ Requires-Dist: sentencepiece
43
+ Requires-Dist: simple-ddl-parser
44
+ Requires-Dist: tabulate
45
+ Requires-Dist: tiktoken
46
+ Requires-Dist: tqdm
47
+ Requires-Dist: transformers (<4.43,>=4.33)
48
+ Requires-Dist: transformers-stream-generator
49
+ Requires-Dist: jieba
50
+ Requires-Dist: rouge-chinese
51
+ Provides-Extra: all
52
+ Requires-Dist: torch ; extra == 'all'
53
+ Requires-Dist: absl-py ; extra == 'all'
54
+ Requires-Dist: accelerate ; extra == 'all'
55
+ Requires-Dist: cachetools ; extra == 'all'
56
+ Requires-Dist: editdistance ; extra == 'all'
57
+ Requires-Dist: jsonlines ; extra == 'all'
58
+ Requires-Dist: matplotlib ; extra == 'all'
59
+ Requires-Dist: modelscope[framework] ; extra == 'all'
60
+ Requires-Dist: nltk ; extra == 'all'
61
+ Requires-Dist: openai ; extra == 'all'
62
+ Requires-Dist: pandas ; extra == 'all'
63
+ Requires-Dist: plotly ; extra == 'all'
64
+ Requires-Dist: pyarrow ; extra == 'all'
65
+ Requires-Dist: pympler ; extra == 'all'
66
+ Requires-Dist: pyyaml ; extra == 'all'
67
+ Requires-Dist: regex ; extra == 'all'
68
+ Requires-Dist: requests ; extra == 'all'
69
+ Requires-Dist: requests-toolbelt ; extra == 'all'
70
+ Requires-Dist: rouge-score ; extra == 'all'
71
+ Requires-Dist: sacrebleu ; extra == 'all'
72
+ Requires-Dist: scikit-learn ; extra == 'all'
73
+ Requires-Dist: seaborn ; extra == 'all'
74
+ Requires-Dist: sentencepiece ; extra == 'all'
75
+ Requires-Dist: simple-ddl-parser ; extra == 'all'
76
+ Requires-Dist: tabulate ; extra == 'all'
77
+ Requires-Dist: tiktoken ; extra == 'all'
78
+ Requires-Dist: tqdm ; extra == 'all'
79
+ Requires-Dist: transformers (<4.43,>=4.33) ; extra == 'all'
80
+ Requires-Dist: transformers-stream-generator ; extra == 'all'
81
+ Requires-Dist: jieba ; extra == 'all'
82
+ Requires-Dist: rouge-chinese ; extra == 'all'
83
+ Requires-Dist: ms-opencompass ; extra == 'all'
84
+ Requires-Dist: ms-vlmeval ; extra == 'all'
85
+ Provides-Extra: inner
86
+ Requires-Dist: absl-py ; extra == 'inner'
87
+ Requires-Dist: accelerate ; extra == 'inner'
88
+ Requires-Dist: alibaba-itag-sdk ; extra == 'inner'
89
+ Requires-Dist: dashscope ; extra == 'inner'
90
+ Requires-Dist: editdistance ; extra == 'inner'
91
+ Requires-Dist: jsonlines ; extra == 'inner'
92
+ Requires-Dist: nltk ; extra == 'inner'
93
+ Requires-Dist: openai ; extra == 'inner'
94
+ Requires-Dist: pandas (==1.5.3) ; extra == 'inner'
95
+ Requires-Dist: plotly ; extra == 'inner'
96
+ Requires-Dist: pyarrow ; extra == 'inner'
97
+ Requires-Dist: pyodps ; extra == 'inner'
98
+ Requires-Dist: pyyaml ; extra == 'inner'
99
+ Requires-Dist: regex ; extra == 'inner'
100
+ Requires-Dist: requests (==2.28.1) ; extra == 'inner'
101
+ Requires-Dist: requests-toolbelt (==0.10.1) ; extra == 'inner'
102
+ Requires-Dist: rouge-score ; extra == 'inner'
103
+ Requires-Dist: sacrebleu ; extra == 'inner'
104
+ Requires-Dist: scikit-learn ; extra == 'inner'
105
+ Requires-Dist: seaborn ; extra == 'inner'
106
+ Requires-Dist: simple-ddl-parser ; extra == 'inner'
107
+ Requires-Dist: streamlit ; extra == 'inner'
108
+ Requires-Dist: tqdm ; extra == 'inner'
109
+ Requires-Dist: transformers (<4.43,>=4.33) ; extra == 'inner'
110
+ Requires-Dist: transformers-stream-generator ; extra == 'inner'
111
+ Provides-Extra: opencompass
112
+ Requires-Dist: ms-opencompass ; extra == 'opencompass'
113
+ Provides-Extra: vlmeval
114
+ Requires-Dist: ms-vlmeval ; extra == 'vlmeval'
115
+
116
+ English | [简体中文](README_zh.md)
117
+
118
+ <p align="center">
119
+ <a href="https://pypi.org/project/evalscope"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/evalscope">
120
+ </a>
121
+ <a href="https://github.com/modelscope/eval-scope/pulls"><img src="https://img.shields.io/badge/PR-welcome-55EB99.svg"></a>
122
+ <p>
123
+
124
+ ## 📖 Table of Content
125
+ - [Introduction](#introduction)
126
+ - [News](#News)
127
+ - [Installation](#installation)
128
+ - [Quick Start](#quick-start)
129
+ - [Dataset List](#datasets-list)
130
+ - [Leaderboard](#leaderboard)
131
+ - [Experiments and Results](#Experiments-and-Results)
132
+ - [Model Serving Performance Evaluation](#Model-Serving-Performance-Evaluation)
133
+
134
+ ## 📝 Introduction
135
+
136
+ Large Language Model (LLMs) evaluation has become a critical process for assessing and improving LLMs. To better support the evaluation of large models, we propose the Eval-Scope framework, which includes the following components and features:
137
+
138
+ - Pre-configured common benchmark datasets, including: MMLU, CMMLU, C-Eval, GSM8K, ARC, HellaSwag, TruthfulQA, MATH, HumanEval, etc.
139
+ - Implementation of common evaluation metrics
140
+ - Unified model integration, compatible with the generate and chat interfaces of multiple model series
141
+ - Automatic evaluation (evaluator):
142
+ - Automatic evaluation for objective questions
143
+ - Implementation of complex task evaluation using expert models
144
+ - Reports of evaluation generating
145
+ - Arena mode
146
+ - Visualization tools
147
+ - Model Inference Performance Evaluation [Tutorial](evalscope/perf/README.md)
148
+ - Support for OpenCompass as an Evaluation Backend, featuring advanced encapsulation and task simplification to easily submit tasks to OpenCompass for evaluation.
149
+ - Supports VLMEvalKit as the evaluation backend. It initiates VLMEvalKit's multimodal evaluation tasks through Eval-Scope, supporting various multimodal models and datasets.
150
+ - Full pipeline support: Seamlessly integrate with SWIFT to easily train and deploy model services, initiate evaluation tasks, view evaluation reports, and achieve an end-to-end large model development process.
151
+
152
+
153
+ **Features**
154
+ - Lightweight, minimizing unnecessary abstractions and configurations
155
+ - Easy to customize
156
+ - New datasets can be integrated by simply implementing a single class
157
+ - Models can be hosted on [ModelScope](https://modelscope.cn), and evaluations can be initiated with just a model id
158
+ - Supports deployment of locally hosted models
159
+ - Visualization of evaluation reports
160
+ - Rich evaluation metrics
161
+ - Model-based automatic evaluation process, supporting multiple evaluation modes
162
+ - Single mode: Expert models score individual models
163
+ - Pairwise-baseline mode: Comparison with baseline models
164
+ - Pairwise (all) mode: Pairwise comparison of all models
165
+
166
+ ## 🎉 News
167
+ - **[2024.07.31]** Breaking change: The sdk name has been changed from `llmuses` to `evalscope`, please update the sdk name in your code.
168
+ - **[2024.07.26]** Supports **VLMEvalKit** as a third-party evaluation framework, initiating multimodal model evaluation tasks. [User Guide](#vlmevalkit-evaluation-backend) 🔥🔥🔥
169
+ - **[2024.06.29]** Supports **OpenCompass** as a third-party evaluation framework. We have provided a high-level wrapper, supporting installation via pip and simplifying the evaluation task configuration. [User Guide](#opencompass-evaluation-backend) 🔥🔥🔥
170
+ - **[2024.06.13]** Eval-Scope has been updated to version 0.3.x, which supports the ModelScope SWIFT framework for LLMs evaluation. 🚀🚀🚀
171
+ - **[2024.06.13]** We have supported the ToolBench as a third-party evaluation backend for Agents evaluation. 🚀🚀🚀
172
+
173
+
174
+
175
+ ## 🛠️ Installation
176
+ ### Install with pip
177
+ 1. create conda environment
178
+ ```shell
179
+ conda create -n eval-scope python=3.10
180
+ conda activate eval-scope
181
+ ```
182
+
183
+ 2. Install Eval-Scope
184
+ ```shell
185
+ pip install evalscope
186
+ ```
187
+
188
+ ### Install from source code
189
+ 1. Download source code
190
+ ```shell
191
+ git clone https://github.com/modelscope/eval-scope.git
192
+ ```
193
+
194
+ 2. Install dependencies
195
+ ```shell
196
+ cd eval-scope/
197
+ pip install -e .
198
+ ```
199
+
200
+
201
+ ## 🚀 Quick Start
202
+
203
+ ### Simple Evaluation
204
+ command line with pip installation:
205
+ ```shell
206
+ python -m evalscope.run --model ZhipuAI/chatglm3-6b --template-type chatglm3 --datasets arc --limit 100
207
+ ```
208
+ command line with source code:
209
+ ```shell
210
+ python evalscope/run.py --model ZhipuAI/chatglm3-6b --template-type chatglm3 --datasets mmlu ceval --limit 10
211
+ ```
212
+ Parameters:
213
+ - --model: ModelScope model id, model link: [ZhipuAI/chatglm3-6b](https://modelscope.cn/models/ZhipuAI/chatglm3-6b/summary)
214
+
215
+ ### Evaluation with Model Arguments
216
+ ```shell
217
+ python evalscope/run.py --model ZhipuAI/chatglm3-6b --template-type chatglm3 --model-args revision=v1.0.2,precision=torch.float16,device_map=auto --datasets mmlu ceval --use-cache true --limit 10
218
+ ```
219
+ ```shell
220
+ python evalscope/run.py --model qwen/Qwen-1_8B --generation-config do_sample=false,temperature=0.0 --datasets ceval --dataset-args '{"ceval": {"few_shot_num": 0, "few_shot_random": false}}' --limit 10
221
+ ```
222
+ Parameters:
223
+ - --model-args: Parameters of model: revision, precision, device_map, in format of key=value,key=value
224
+ - --datasets: datasets list, separated by space
225
+ - --use-cache: `true` or `false`, whether to use cache, default is `false`
226
+ - --dataset-args: evaluation settings,json format,key is the dataset name,value should be args for the dataset
227
+ - --few_shot_num: few-shot data number
228
+ - --few_shot_random: whether to use random few-shot data, default is `true`
229
+ - --local_path: local dataset path
230
+ - --limit: maximum number of samples to evaluate for each sub-dataset
231
+ - --template-type: model template type, see [Template Type List](https://github.com/modelscope/swift/blob/main/docs/source_en/LLM/Supported-models-datasets.md)
232
+
233
+ Note: you can use following command to check the template type list of the model:
234
+ ```shell
235
+ from evalscope.models.template import TemplateType
236
+ print(TemplateType.get_template_name_list())
237
+ ```
238
+
239
+ ### Evaluation Backend
240
+ Eval-Scope supports using third-party evaluation frameworks to initiate evaluation tasks, which we call Evaluation Backend. Currently supported Evaluation Backend includes:
241
+ - **Native**: Eval-Scope's own **default evaluation framework**, supporting various evaluation modes including single model evaluation, arena mode, and baseline model comparison mode.
242
+ - [OpenCompass](https://github.com/open-compass/opencompass): Initiate OpenCompass evaluation tasks through Eval-Scope. Lightweight, easy to customize, supports seamless integration with the LLM fine-tuning framework [ModelScope Swift](https://github.com/modelscope/swift).
243
+ - [VLMEvalKit](https://github.com/open-compass/VLMEvalKit): Initiate VLMEvalKit multimodal evaluation tasks through Eval-Scope. Supports various multimodal models and datasets, and offers seamless integration with the LLM fine-tuning framework [ModelScope Swift](https://github.com/modelscope/swift).
244
+ - **ThirdParty**: The third-party task, e.g. [ToolBench](evalscope/thirdparty/toolbench/README.md), you can contribute your own evaluation task to Eval-Scope as third-party backend.
245
+
246
+ #### OpenCompass Eval-Backend
247
+
248
+ To facilitate the use of the OpenCompass evaluation backend, we have customized the OpenCompass source code and named it `ms-opencompass`. This version includes optimizations for evaluation task configuration and execution based on the original version, and it supports installation via PyPI. This allows users to initiate lightweight OpenCompass evaluation tasks through Eval-Scope. Additionally, we have initially opened up API-based evaluation tasks in the OpenAI API format. You can deploy model services using [ModelScope Swift](https://github.com/modelscope/swift), where [swift deploy](https://swift.readthedocs.io/en/latest/LLM/VLLM-inference-acceleration-and-deployment.html) supports using vLLM to launch model inference services.
249
+
250
+
251
+ ##### Installation
252
+ ```shell
253
+ # Install with extra option
254
+ pip install evalscope[opencompass]
255
+ ```
256
+
257
+ ##### Data Preparation
258
+ Available datasets from OpenCompass backend:
259
+ ```text
260
+ 'obqa', 'AX_b', 'siqa', 'nq', 'mbpp', 'winogrande', 'mmlu', 'BoolQ', 'cluewsc', 'ocnli', 'lambada', 'CMRC', 'ceval', 'csl', 'cmnli', 'bbh', 'ReCoRD', 'math', 'humaneval', 'eprstmt', 'WSC', 'storycloze', 'MultiRC', 'RTE', 'chid', 'gsm8k', 'AX_g', 'bustm', 'afqmc', 'piqa', 'lcsts', 'strategyqa', 'Xsum', 'agieval', 'ocnli_fc', 'C3', 'tnews', 'race', 'triviaqa', 'CB', 'WiC', 'hellaswag', 'summedits', 'GaokaoBench', 'ARC_e', 'COPA', 'ARC_c', 'DRCD'
261
+ ```
262
+ Refer to [OpenCompass datasets](https://hub.opencompass.org.cn/home)
263
+
264
+ You can use the following code to list all available datasets:
265
+ ```python
266
+ from evalscope.backend.opencompass import OpenCompassBackendManager
267
+ print(f'** All datasets from OpenCompass backend: {OpenCompassBackendManager.list_datasets()}')
268
+ ```
269
+
270
+ Dataset download:
271
+ - Option1: Download from ModelScope
272
+ ```shell
273
+ git clone https://www.modelscope.cn/datasets/swift/evalscope_resource.git
274
+ ```
275
+
276
+ - Option2: Download from OpenCompass GitHub
277
+ ```shell
278
+ wget https://github.com/open-compass/opencompass/releases/download/0.2.2.rc1/OpenCompassData-complete-20240207.zip
279
+ ```
280
+
281
+ Unzip the file and set the path to the `data` directory in current work directory.
282
+
283
+
284
+ ##### Model Serving
285
+ We use ModelScope swift to deploy model services, see: [ModelScope Swift](hhttps://swift.readthedocs.io/en/latest/LLM/VLLM-inference-acceleration-and-deployment.html)
286
+ ```shell
287
+ # Install ms-swift
288
+ pip install ms-swift
289
+
290
+ # Deploy model
291
+ CUDA_VISIBLE_DEVICES=0 swift deploy --model_type llama3-8b-instruct --port 8000
292
+ ```
293
+
294
+
295
+ ##### Model Evaluation
296
+
297
+ Refer to example: [example_eval_swift_openai_api](examples/example_eval_swift_openai_api.py) to configure and execute the evaluation task:
298
+ ```shell
299
+ python examples/example_eval_swift_openai_api.py
300
+ ```
301
+
302
+ #### VLMEvalKit Evaluation Backend
303
+
304
+ To facilitate the use of the VLMEvalKit evaluation backend, we have customized the VLMEvalKit source code and named it `ms-vlmeval`. This version encapsulates the configuration and execution of evaluation tasks based on the original version and supports installation via PyPI, allowing users to initiate lightweight VLMEvalKit evaluation tasks through Eval-Scope. Additionally, we support API-based evaluation tasks in the OpenAI API format. You can deploy multimodal model services using ModelScope [swift](https://github.com/modelscope/swift).
305
+
306
+ ##### Installation
307
+ ```shell
308
+ # Install with additional options
309
+ pip install evalscope[vlmeval]
310
+ ```
311
+
312
+ ##### Data Preparation
313
+ Currently supported datasets include:
314
+ ```text
315
+ 'COCO_VAL', 'MME', 'HallusionBench', 'POPE', 'MMBench_DEV_EN', 'MMBench_TEST_EN', 'MMBench_DEV_CN', 'MMBench_TEST_CN', 'MMBench', 'MMBench_CN', 'MMBench_DEV_EN_V11', 'MMBench_TEST_EN_V11', 'MMBench_DEV_CN_V11', 'MMBench_TEST_CN_V11', 'MMBench_V11', 'MMBench_CN_V11', 'SEEDBench_IMG', 'SEEDBench2', 'SEEDBench2_Plus', 'ScienceQA_VAL', 'ScienceQA_TEST', 'MMT-Bench_ALL_MI', 'MMT-Bench_ALL', 'MMT-Bench_VAL_MI', 'MMT-Bench_VAL', 'AesBench_VAL', 'AesBench_TEST', 'CCBench', 'AI2D_TEST', 'MMStar', 'RealWorldQA', 'MLLMGuard_DS', 'BLINK', 'OCRVQA_TEST', 'OCRVQA_TESTCORE', 'TextVQA_VAL', 'DocVQA_VAL', 'DocVQA_TEST', 'InfoVQA_ VAL', 'InfoVQA_TEST', 'ChartQA_VAL', 'ChartQA_TEST', 'MathVision', 'MathVision_MINI', 'MMMU_DEV_VAL', 'MMMU_TEST', 'OCRBench', 'MathVista_MINI', 'LLaVABench', 'MMVet', 'MTVQA_TEST', 'MMLongBench_DOC', 'VCR_EN_EASY_500', 'VCR_EN_EASY_100', 'VCR_EN_EASY_ALL', 'VCR_EN_HARD_500', 'VCR_EN_HARD_100', 'VCR_EN_HARD_ALL', 'VCR_ZH_EASY_500', 'VCR_ZH_EASY_100', 'VCR_Z H_EASY_ALL', 'VCR_ZH_HARD_500', 'VCR_ZH_HARD_100', 'VCR_ZH_HARD_ALL', 'MMBench-Video', 'Video-MME', 'MMBench_DEV_EN', 'MMBench_TEST_EN', 'MMBench_DEV_CN', 'MMBench_TEST_CN', 'MMBench', 'MMBench_CN', 'MMBench_DEV_EN_V11', 'MMBench_TEST_EN_V11', 'MMBench_DEV_CN_V11', 'MMBench_TEST_CN_V11', 'MM Bench_V11', 'MMBench_CN_V11', 'SEEDBench_IMG', 'SEEDBench2', 'SEEDBench2_Plus', 'ScienceQA_VAL', 'ScienceQA_TEST', 'MMT-Bench_ALL_MI', 'MMT-Bench_ALL', 'MMT-Bench_VAL_MI', 'MMT-Bench_VAL', 'AesBench_VAL', 'AesBench_TEST', 'CCBench', 'AI2D_TEST', 'MMStar', 'RealWorldQA', 'MLLMGuard_DS', 'BLINK'
316
+ ```
317
+ For detailed information about the datasets, please refer to [VLMEvalKit Supported Multimodal Evaluation Sets](https://github.com/open-compass/VLMEvalKit/tree/main#-datasets-models-and-evaluation-results).
318
+
319
+ You can use the following to view the list of dataset names:
320
+ ```python
321
+ from evalscope.backend.vlm_eval_kit import VLMEvalKitBackendManager
322
+ print(f'** All models from VLMEvalKit backend: {VLMEvalKitBackendManager.list(list_supported_VLMs().keys())}')
323
+ ```
324
+ If the dataset file does not exist locally when loading the dataset, it will be automatically downloaded to the `~/LMUData/` directory.
325
+
326
+
327
+ ##### Model Evaluation
328
+ There are two ways to evaluate the model:
329
+
330
+ ###### 1. ModelScope Swift Deployment for Model Evaluation
331
+ **Model Deployment**
332
+ Deploy the model service using ModelScope Swift. For detailed instructions, refer to: [ModelScope Swift MLLM Deployment Guide](https://swift.readthedocs.io/en/latest/Multi-Modal/mutlimodal-deployment.html)
333
+ ```shell
334
+ # Install ms-swift
335
+ pip install ms-swift
336
+ # Deploy the qwen-vl-chat multi-modal model service
337
+ CUDA_VISIBLE_DEVICES=0 swift deploy --model_type qwen-vl-chat --model_id_or_path models/Qwen-VL-Chat
338
+ ```
339
+ **Model Evaluation**
340
+ Refer to the example file: [example_eval_vlm_swift](examples/example_eval_vlm_swift.py) to configure the evaluation task.
341
+ Execute the evaluation task:
342
+ ```shell
343
+ python examples/example_eval_vlm_swift.py
344
+ ```
345
+
346
+ ###### 2. Local Model Inference Evaluation
347
+ **Model Inference Evaluation**
348
+ Skip the model service deployment and perform inference directly on the local machine. Refer to the example file: [example_eval_vlm_local](examples/example_eval_vlm_local.py) to configure the evaluation task.
349
+ Execute the evaluation task:
350
+ ```shell
351
+ python examples/example_eval_vlm_local.py
352
+ ```
353
+
354
+
355
+ ##### (Optional) Deploy Judge Model
356
+ Deploy the local language model as a judge/extractor using ModelScope swift. For details, refer to: [ModelScope Swift LLM Deployment Guide](https://swift.readthedocs.io/en/latest/LLM/VLLM-inference-acceleration-and-deployment.html). If no judge model is deployed, exact matching will be used.
357
+
358
+ ```shell
359
+ # Deploy qwen2-7b as a judge
360
+ CUDA_VISIBLE_DEVICES=1 swift deploy --model_type qwen2-7b-instruct --model_id_or_path models/Qwen2-7B-Instruct --port 8866
361
+ ```
362
+
363
+ You **must configure the following environment variables for the judge model to be correctly invoked**:
364
+ ```
365
+ OPENAI_API_KEY=EMPTY
366
+ OPENAI_API_BASE=http://127.0.0.1:8866/v1/chat/completions # api_base for the judge model
367
+ LOCAL_LLM=qwen2-7b-instruct # model_id for the judge model
368
+ ```
369
+
370
+ ##### Model Evaluation
371
+ Refer to the example file: [example_eval_vlm_swift](examples/example_eval_vlm_swift.py) to configure the evaluation task.
372
+
373
+ Execute the evaluation task:
374
+
375
+ ```shell
376
+ python examples/example_eval_vlm_swift.py
377
+ ```
378
+
379
+
380
+ ### Local Dataset
381
+ You can use local dataset to evaluate the model without internet connection.
382
+ #### 1. Download and unzip the dataset
383
+ ```shell
384
+ # set path to /path/to/workdir
385
+ wget https://modelscope.oss-cn-beijing.aliyuncs.com/open_data/benchmark/data.zip
386
+ unzip data.zip
387
+ ```
388
+
389
+
390
+ #### 2. Use local dataset to evaluate the model
391
+ ```shell
392
+ python evalscope/run.py --model ZhipuAI/chatglm3-6b --template-type chatglm3 --datasets arc --dataset-hub Local --dataset-args '{"arc": {"local_path": "/path/to/workdir/data/arc"}}' --limit 10
393
+
394
+ # Parameters:
395
+ # --dataset-hub: dataset sources: `ModelScope`, `Local`, `HuggingFace` (TO-DO) default to `ModelScope`
396
+ # --dataset-args: json format, key is the dataset name, value should be args for the dataset
397
+ ```
398
+
399
+ #### 3. (Optional) Use local mode to submit evaluation task
400
+
401
+ ```shell
402
+ # 1. Prepare the model local folder, the folder structure refers to chatglm3-6b, link: https://modelscope.cn/models/ZhipuAI/chatglm3-6b/files
403
+ # For example, download the model folder to the local path /path/to/ZhipuAI/chatglm3-6b
404
+
405
+ # 2. Execute the offline evaluation task
406
+ python evalscope/run.py --model /path/to/ZhipuAI/chatglm3-6b --template-type chatglm3 --datasets arc --dataset-hub Local --dataset-args '{"arc": {"local_path": "/path/to/workdir/data/arc"}}' --limit 10
407
+ ```
408
+
409
+
410
+ ### Use run_task function
411
+
412
+ #### 1. Configuration
413
+ ```python
414
+ import torch
415
+ from evalscope.constants import DEFAULT_ROOT_CACHE_DIR
416
+
417
+ # Example configuration
418
+ your_task_cfg = {
419
+ 'model_args': {'revision': None, 'precision': torch.float16, 'device_map': 'auto'},
420
+ 'generation_config': {'do_sample': False, 'repetition_penalty': 1.0, 'max_new_tokens': 512},
421
+ 'dataset_args': {},
422
+ 'dry_run': False,
423
+ 'model': 'ZhipuAI/chatglm3-6b',
424
+ 'template_type': 'chatglm3',
425
+ 'datasets': ['arc', 'hellaswag'],
426
+ 'work_dir': DEFAULT_ROOT_CACHE_DIR,
427
+ 'outputs': DEFAULT_ROOT_CACHE_DIR,
428
+ 'mem_cache': False,
429
+ 'dataset_hub': 'ModelScope',
430
+ 'dataset_dir': DEFAULT_ROOT_CACHE_DIR,
431
+ 'stage': 'all',
432
+ 'limit': 10,
433
+ 'debug': False
434
+ }
435
+
436
+ ```
437
+
438
+ #### 2. Execute the task
439
+ ```python
440
+ from evalscope.run import run_task
441
+
442
+ run_task(task_cfg=your_task_cfg)
443
+ ```
444
+
445
+
446
+ ### Arena Mode
447
+ The Arena mode allows multiple candidate models to be evaluated through pairwise battles, and can choose to use the AI Enhanced Auto-Reviewer (AAR) automatic evaluation process or manual evaluation to obtain the evaluation report. The process is as follows:
448
+ #### 1. Env preparation
449
+ ```text
450
+ a. Data preparation, the question data format refers to: evalscope/registry/data/question.jsonl
451
+ b. If you need to use the automatic evaluation process (AAR), you need to configure the relevant environment variables. Taking the GPT-4 based auto-reviewer process as an example, you need to configure the following environment variables:
452
+ > export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
453
+ ```
454
+
455
+ #### 2. Configuration files
456
+ ```text
457
+ Refer to : evalscope/registry/config/cfg_arena.yaml
458
+ Parameters:
459
+ questions_file: question data path
460
+ answers_gen: candidate model prediction result generation, supports multiple models, can control whether to enable the model through the enable parameter
461
+ reviews_gen: evaluation result generation, currently defaults to using GPT-4 as the Auto-reviewer, can control whether to enable this step through the enable parameter
462
+ elo_rating: ELO rating algorithm, can control whether to enable this step through the enable parameter, note that this step depends on the review_file must exist
463
+ ```
464
+
465
+ #### 3. Execute the script
466
+ ```shell
467
+ #Usage:
468
+ cd evalscope
469
+
470
+ # dry-run mode
471
+ python evalscope/run_arena.py -c registry/config/cfg_arena.yaml --dry-run
472
+
473
+ # Execute the script
474
+ python evalscope/run_arena.py --c registry/config/cfg_arena.yaml
475
+ ```
476
+
477
+ #### 4. Visualization
478
+
479
+ ```shell
480
+ # Usage:
481
+ streamlit run viz.py -- --review-file evalscope/registry/data/qa_browser/battle.jsonl --category-file evalscope/registry/data/qa_browser/category_mapping.yaml
482
+ ```
483
+
484
+
485
+ ### Single Model Evaluation Mode
486
+
487
+ In this mode, we only score the output of a single model, without pairwise comparison.
488
+ #### 1. Configuration file
489
+ ```text
490
+ Refer to: evalscope/registry/config/cfg_single.yaml
491
+ Parameters:
492
+ questions_file: question data path
493
+ answers_gen: candidate model prediction result generation, supports multiple models, can control whether to enable the model through the enable parameter
494
+ reviews_gen: evaluation result generation, currently defaults to using GPT-4 as the Auto-reviewer, can control whether to enable this step through the enable parameter
495
+ rating_gen: rating algorithm, can control whether to enable this step through the enable parameter, note that this step depends on the review_file must exist
496
+ ```
497
+ #### 2. Execute the script
498
+ ```shell
499
+ #Example:
500
+ python evalscope/run_arena.py --c registry/config/cfg_single.yaml
501
+ ```
502
+
503
+ ### Baseline Model Comparison Mode
504
+
505
+ In this mode, we select the baseline model, and compare other models with the baseline model for scoring. This mode can easily add new models to the Leaderboard (just need to run the scoring with the new model and the baseline model).
506
+
507
+ #### 1. Configuration file
508
+ ```text
509
+ Refer to: evalscope/registry/config/cfg_pairwise_baseline.yaml
510
+ Parameters:
511
+ questions_file: question data path
512
+ answers_gen: candidate model prediction result generation, supports multiple models, can control whether to enable the model through the enable parameter
513
+ reviews_gen: evaluation result generation, currently defaults to using GPT-4 as the Auto-reviewer, can control whether to enable this step through the enable parameter
514
+ rating_gen: rating algorithm, can control whether to enable this step through the enable parameter, note that this step depends on the review_file must exist
515
+ ```
516
+ #### 2. Execute the script
517
+ ```shell
518
+ # Example:
519
+ python evalscope/run_arena.py --c registry/config/cfg_pairwise_baseline.yaml
520
+ ```
521
+
522
+
523
+ ## Datasets list
524
+
525
+ | DatasetName | Link | Status | Note |
526
+ |--------------------|----------------------------------------------------------------------------------------|--------|------|
527
+ | `mmlu` | [mmlu](https://modelscope.cn/datasets/modelscope/mmlu/summary) | Active | |
528
+ | `ceval` | [ceval](https://modelscope.cn/datasets/modelscope/ceval-exam/summary) | Active | |
529
+ | `gsm8k` | [gsm8k](https://modelscope.cn/datasets/modelscope/gsm8k/summary) | Active | |
530
+ | `arc` | [arc](https://modelscope.cn/datasets/modelscope/ai2_arc/summary) | Active | |
531
+ | `hellaswag` | [hellaswag](https://modelscope.cn/datasets/modelscope/hellaswag/summary) | Active | |
532
+ | `truthful_qa` | [truthful_qa](https://modelscope.cn/datasets/modelscope/truthful_qa/summary) | Active | |
533
+ | `competition_math` | [competition_math](https://modelscope.cn/datasets/modelscope/competition_math/summary) | Active | |
534
+ | `humaneval` | [humaneval](https://modelscope.cn/datasets/modelscope/humaneval/summary) | Active | |
535
+ | `bbh` | [bbh](https://modelscope.cn/datasets/modelscope/bbh/summary) | Active | |
536
+ | `race` | [race](https://modelscope.cn/datasets/modelscope/race/summary) | Active | |
537
+ | `trivia_qa` | [trivia_qa](https://modelscope.cn/datasets/modelscope/trivia_qa/summary) | To be intergrated | |
538
+
539
+
540
+ ## Leaderboard
541
+ The LLM Leaderboard aims to provide an objective and comprehensive evaluation standard and platform to help researchers and developers understand and compare the performance of models on various tasks on ModelScope.
542
+
543
+ [Leaderboard](https://modelscope.cn/leaderboard/58/ranking?type=free)
544
+
545
+
546
+
547
+ ## Experiments and Results
548
+ [Experiments](./resources/experiments.md)
549
+
550
+ ## Model Serving Performance Evaluation
551
+ [Perf](evalscope/perf/README.md)
552
+
553
+ ## TO-DO List
554
+ - ✅Agents evaluation
555
+ - [ ] vLLM
556
+ - [ ] Distributed evaluating
557
+ - ✅ Multi-modal evaluation
558
+ - [ ] Benchmarks
559
+ - [ ] GAIA
560
+ - [ ] GPQA
561
+ - ✅ MBPP
562
+ - [ ] Auto-reviewer
563
+ - [ ] Qwen-max
564
+
565
+
566
+