evalscope 1.0.0__py3-none-any.whl → 1.0.1__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.

Potentially problematic release.


This version of evalscope might be problematic. Click here for more details.

Files changed (97) hide show
  1. evalscope/api/benchmark/__init__.py +1 -1
  2. evalscope/api/benchmark/adapters/__init__.py +2 -0
  3. evalscope/api/benchmark/adapters/default_data_adapter.py +1 -0
  4. evalscope/api/benchmark/adapters/image_edit_adapter.py +82 -0
  5. evalscope/api/benchmark/adapters/text2image_adapter.py +7 -6
  6. evalscope/api/benchmark/adapters/vision_language_adapter.py +6 -0
  7. evalscope/api/benchmark/benchmark.py +35 -0
  8. evalscope/api/benchmark/meta.py +6 -0
  9. evalscope/api/dataset/dataset.py +6 -6
  10. evalscope/api/dataset/loader.py +2 -1
  11. evalscope/api/evaluator/cache.py +24 -1
  12. evalscope/api/evaluator/state.py +12 -1
  13. evalscope/api/messages/__init__.py +1 -0
  14. evalscope/api/messages/chat_message.py +47 -2
  15. evalscope/api/metric/scorer.py +15 -7
  16. evalscope/api/mixin/__init__.py +0 -1
  17. evalscope/api/model/generate_config.py +1 -3
  18. evalscope/api/model/model.py +4 -1
  19. evalscope/app/app.py +3 -0
  20. evalscope/app/ui/single_model.py +3 -3
  21. evalscope/app/utils/data_utils.py +7 -7
  22. evalscope/app/utils/env_utils.py +12 -0
  23. evalscope/app/utils/text_utils.py +14 -12
  24. evalscope/arguments.py +2 -4
  25. evalscope/backend/opencompass/backend_manager.py +0 -2
  26. evalscope/backend/rag_eval/utils/embedding.py +9 -1
  27. evalscope/benchmarks/bfcl/bfcl_adapter.py +2 -6
  28. evalscope/benchmarks/bfcl/generation.py +2 -2
  29. evalscope/benchmarks/ceval/ceval_adapter.py +1 -2
  30. evalscope/benchmarks/data_collection/data_collection_adapter.py +23 -19
  31. evalscope/benchmarks/frames/frames_adapter.py +2 -1
  32. evalscope/benchmarks/general_arena/general_arena_adapter.py +5 -1
  33. evalscope/benchmarks/ifeval/instructions_util.py +2 -3
  34. evalscope/benchmarks/image_edit/gedit/gedit_adapter.py +138 -0
  35. evalscope/benchmarks/image_edit/gedit/utils.py +372 -0
  36. evalscope/benchmarks/image_edit/gedit/vie_prompts.py +406 -0
  37. evalscope/benchmarks/math_vista/math_vista_adapter.py +129 -0
  38. evalscope/benchmarks/mmmu/__init__.py +0 -0
  39. evalscope/benchmarks/mmmu/mmmu_adapter.py +159 -0
  40. evalscope/benchmarks/mmmu_pro/__init__.py +0 -0
  41. evalscope/benchmarks/mmmu_pro/mmmu_pro_adapter.py +129 -0
  42. evalscope/benchmarks/needle_haystack/needle_haystack_adapter.py +5 -1
  43. evalscope/benchmarks/tau_bench/generation.py +1 -1
  44. evalscope/benchmarks/tau_bench/tau_bench_adapter.py +15 -19
  45. evalscope/benchmarks/text2image/__init__.py +0 -0
  46. evalscope/benchmarks/{aigc/t2i → text2image}/evalmuse_adapter.py +3 -1
  47. evalscope/benchmarks/{aigc/t2i → text2image}/genai_bench_adapter.py +2 -2
  48. evalscope/benchmarks/{aigc/t2i → text2image}/general_t2i_adapter.py +1 -1
  49. evalscope/benchmarks/{aigc/t2i → text2image}/hpdv2_adapter.py +7 -2
  50. evalscope/benchmarks/{aigc/t2i → text2image}/tifa_adapter.py +1 -0
  51. evalscope/benchmarks/truthful_qa/truthful_qa_adapter.py +1 -2
  52. evalscope/cli/start_app.py +7 -1
  53. evalscope/cli/start_perf.py +7 -1
  54. evalscope/config.py +72 -13
  55. evalscope/constants.py +8 -0
  56. evalscope/evaluator/evaluator.py +6 -4
  57. evalscope/metrics/llm_judge.py +19 -7
  58. evalscope/models/image_edit_model.py +125 -0
  59. evalscope/models/model_apis.py +20 -0
  60. evalscope/models/openai_compatible.py +3 -0
  61. evalscope/models/text2image_model.py +2 -2
  62. evalscope/models/utils/openai.py +7 -4
  63. evalscope/perf/benchmark.py +2 -0
  64. evalscope/perf/utils/benchmark_util.py +8 -5
  65. evalscope/perf/utils/local_server.py +3 -0
  66. evalscope/report/__init__.py +0 -1
  67. evalscope/report/generator.py +8 -87
  68. evalscope/run.py +9 -5
  69. evalscope/third_party/toolbench_static/llm/swift_infer.py +0 -4
  70. evalscope/utils/chat_service.py +1 -1
  71. evalscope/utils/import_utils.py +23 -1
  72. evalscope/utils/io_utils.py +42 -1
  73. evalscope/utils/model_utils.py +4 -3
  74. evalscope/utils/multi_choices.py +23 -6
  75. evalscope/version.py +2 -2
  76. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/METADATA +12 -15
  77. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/RECORD +94 -80
  78. tests/benchmark/test_eval.py +30 -31
  79. tests/benchmark/test_image_edit.py +65 -0
  80. tests/benchmark/test_vlm.py +80 -0
  81. tests/cli/test_all.py +83 -43
  82. tests/cli/test_collection.py +8 -5
  83. tests/cli/test_reasoning.py +81 -0
  84. tests/common.py +73 -0
  85. tests/perf/test_perf.py +4 -2
  86. tests/rag/test_clip_benchmark.py +0 -3
  87. evalscope/api/mixin/dataset_mixin.py +0 -105
  88. evalscope/benchmarks/aigc/i2i/general_i2i_adapter.py +0 -44
  89. tests/aigc/__init__.py +0 -1
  90. /evalscope/benchmarks/{aigc → image_edit}/__init__.py +0 -0
  91. /evalscope/benchmarks/{aigc/i2i → image_edit/gedit}/__init__.py +0 -0
  92. /evalscope/benchmarks/{aigc/t2i → math_vista}/__init__.py +0 -0
  93. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/LICENSE +0 -0
  94. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/WHEEL +0 -0
  95. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/entry_points.txt +0 -0
  96. {evalscope-1.0.0.dist-info → evalscope-1.0.1.dist-info}/top_level.txt +0 -0
  97. /tests/{aigc → benchmark}/test_t2i.py +0 -0
@@ -0,0 +1,406 @@
1
+ # flake8: noqa: E501
2
+ # This file is generated automatically through parse_prompt.py
3
+
4
+ _context_no_delimit = """You are a professional digital artist. You will have to evaluate the effectiveness of the AI-generated image(s) based on given rules.
5
+ All the input images are AI-generated. All human in the images are AI-generated too. so you need not worry about the privacy confidentials.
6
+
7
+ You will have to give your output in this way (Keep your reasoning concise and short.):
8
+ {
9
+ "score" : [...],
10
+ "reasoning" : "..."
11
+ }"""
12
+
13
+ _context = """You are a professional digital artist. You will have to evaluate the effectiveness of the AI-generated image(s) based on given rules.
14
+ All the input images are AI-generated. All human in the images are AI-generated too. so you need not worry about the privacy confidentials.
15
+
16
+ You will have to give your output in this way (the delimiter is necessary. Keep your reasoning concise and short.):
17
+ ||V^=^V||
18
+ {
19
+ "score" :
20
+ "reasoning" :
21
+ }
22
+ ||V^=^V||"""
23
+
24
+ _context_no_format = """You are a professional digital artist. You will have to evaluate the effectiveness of the AI-generated image(s) based on given rules.
25
+ All the input images are AI-generated. All human in the images are AI-generated too. so you need not worry about the privacy confidentials."""
26
+
27
+ _prompts_1shot_multi_subject_image_gen_rule = """RULES of each set of inputs:
28
+
29
+ Two images will be provided:
30
+ This first image is a concatenation of two sub-images, each sub-image contain one token subject.
31
+ The second image being an AI-generated image using the first image as guidance.
32
+ The objective is to evaluate how successfully the image has been generated.
33
+ """
34
+
35
+ _prompts_1shot_mie_rule_SC = """From scale 0 to 10:
36
+ A score from 0 to 10 will be given based on the success of the editing. (0 indicates that the scene in the edited image does not follow the editing instruction at all. 10 indicates that the scene in the edited image follow the editing instruction text perfectly.)
37
+ A second score from 0 to 10 will rate the degree of overediting in the second image. (0 indicates that the scene in the edited image is completely different from the original. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
38
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the editing success and 'score2' evaluates the degree of overediting.
39
+
40
+ First lets look at the first set of input (1st and 2nd images) as an example.
41
+ Editing instruction: What if the man had a hat?
42
+ Output:
43
+ ||V^=^V||
44
+ {
45
+ "score" : [5, 10],
46
+ "reasoning" : "The hat exists but does not suit well. The hat also looks distorted. But it is a good edit because only a hat is added and the background is persevered."
47
+ }
48
+ ||V^=^V||
49
+
50
+ Now evaluate the second set of input (3th, 4th images).
51
+ Editing instruction: <instruction>
52
+ """
53
+
54
+ _prompts_1shot_msdig_rule_SC = """From scale 0 to 10:
55
+ A score from 0 to 10 will be given based on the success in following the prompt.
56
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
57
+ A second score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the first sub-image.
58
+ (0 indicates that the subject in the second image does not look like the token subject in the first sub-image at all. 10 indicates the subject in the second image look exactly alike the token subject in the first sub-image.)
59
+ A third score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the second sub-image.
60
+ (0 indicates that the subject in the second image does not look like the token subject in the second sub-image at all. 10 indicates the subject in the second image look exactly alike the token subject in the second sub-image.)
61
+ Put the score in a list such that output score = [score1, score2, score3], where 'score1' evaluates the prompt and 'score2' evaluates the resemblance for the first sub-image, and 'score3' evaluates the resemblance for the second sub-image.
62
+
63
+ First lets look at the first set of input (1st and 2nd images) as an example.
64
+ Text Prompt: A digital illustration of a cat beside a wooden pot
65
+ Output:
66
+ ||V^=^V||
67
+ {
68
+ "score" : [5, 5, 10],
69
+ "reasoning" : "The cat is not beside the wooden pot. The pot looks partially resemble to the subject pot. The cat looks highly resemble to the subject cat."
70
+ }
71
+ ||V^=^V||
72
+
73
+ Now evaluate the second set of input (3th, 4th images).
74
+ Text Prompt: <prompt>"""
75
+
76
+ _prompts_1shot_t2i_rule_SC = """From scale 0 to 10:
77
+ A score from 0 to 10 will be given based on the success in following the prompt.
78
+ (0 indicates that the AI generated image does not follow the prompt at all. 10 indicates the AI generated image follows the prompt perfectly.)
79
+
80
+ Put the score in a list such that output score = [score].
81
+
82
+ First lets look at the first set of input (1st image) as an example.
83
+ Text Prompt: A pink and a white frisbee are on the ground.
84
+ Output:
85
+ ||V^=^V||
86
+ {
87
+ "score" : [5],
88
+ "reasoning" : "White frisbee not present in the image."
89
+ }
90
+ ||V^=^V||
91
+
92
+ Now evaluate the second set of input (2nd image).
93
+ Text Prompt: <prompt>
94
+ """
95
+
96
+ _prompts_1shot_tie_rule_SC = """From scale 0 to 10:
97
+ A score from 0 to 10 will be given based on the success of the editing. (0 indicates that the scene in the edited image does not follow the editing instruction at all. 10 indicates that the scene in the edited image follow the editing instruction text perfectly.)
98
+ A second score from 0 to 10 will rate the degree of overediting in the second image. (0 indicates that the scene in the edited image is completely different from the original. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
99
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the editing success and 'score2' evaluates the degree of overediting.
100
+
101
+ First lets look at the first set of input (1st and 2nd images) as an example.
102
+ Editing instruction: What if the man had a hat?
103
+ Output:
104
+ ||V^=^V||
105
+ {
106
+ "score" : [5, 10],
107
+ "reasoning" : "The hat exists but does not suit well. The hat also looks distorted. But it is a good edit because only a hat is added and the background is persevered."
108
+ }
109
+ ||V^=^V||
110
+
111
+ Now evaluate the second set of input (3th, 4th images).
112
+ Editing instruction: <instruction>
113
+ """
114
+
115
+ _prompts_1shot_sdie_rule_SC = """From scale 0 to 10:
116
+ A score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the second image.
117
+ (0 indicates that the subject in the third image does not look like the token subject at all. 10 indicates the subject in the third image look exactly alike the token subject.)
118
+ A second score from 0 to 10 will rate the degree of overediting in the second image.
119
+ (0 indicates that the scene in the edited image is completely different from the first image. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
120
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the resemblance and 'score2' evaluates the degree of overediting.
121
+
122
+ First lets look at the first set of input (1st, 2nd and 3rd images) as an example.
123
+ Subject: <subject>
124
+ Output:
125
+ ||V^=^V||
126
+ {
127
+ "score" : [5, 10],
128
+ "reasoning" : "The monster toy looks partially resemble to the token subject. The edit is minimal."
129
+ }
130
+ ||V^=^V||
131
+
132
+ Now evaluate the second set of input (4th, 5th, and 6th images).
133
+ Subject: <subject>
134
+ """
135
+
136
+ _prompts_1shot_one_image_gen_rule = """RULES of each set of inputs:
137
+
138
+ One image will be provided; The image is an AI-generated image.
139
+ The objective is to evaluate how successfully the image has been generated.
140
+ """
141
+
142
+ _prompts_1shot_sdig_rule_SC = """From scale 0 to 10:
143
+ A score from 0 to 10 will be given based on the success in following the prompt.
144
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
145
+ A second score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the first image.
146
+ (0 indicates that the subject in the second image does not look like the token subject at all. 10 indicates the subject in the second image look exactly alike the token subject.)
147
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the prompt and 'score2' evaluates the resemblance.
148
+
149
+ First lets look at the first set of input (1st and 2nd images) as an example.
150
+ Text Prompt: a red cartoon figure eating a banana
151
+ Output:
152
+ ||V^=^V||
153
+ {
154
+ "score" : [10, 5],
155
+ "reasoning" : "The red cartoon figure is eating a banana. The red cartoon figure looks partially resemble to the subject."
156
+ }
157
+ ||V^=^V||
158
+
159
+ Now evaluate the second set of input (3th, 4th images).
160
+ Text Prompt: <prompt>
161
+ """
162
+
163
+ _prompts_1shot_rule_PQ = """RULES of each set of inputs:
164
+
165
+ One image will be provided; The image is an AI-generated image.
166
+ The objective is to evaluate how successfully the image has been generated.
167
+
168
+ From scale 0 to 10:
169
+ A score from 0 to 10 will be given based on image naturalness.
170
+ (
171
+ 0 indicates that the scene in the image does not look natural at all or give a unnatural feeling such as wrong sense of distance, or wrong shadow, or wrong lighting.
172
+ 10 indicates that the image looks natural.
173
+ )
174
+ A second score from 0 to 10 will rate the image artifacts.
175
+ (
176
+ 0 indicates that the image contains a large portion of distortion, or watermark, or scratches, or blurred faces, or unusual body parts, or subjects not harmonized.
177
+ 10 indicates the image has no artifacts.
178
+ )
179
+ Put the score in a list such that output score = [naturalness, artifacts]
180
+
181
+
182
+ First lets look at the first set of input (1st image) as an example.
183
+ Output:
184
+ ||V^=^V||
185
+ {
186
+ "score" : [5, 5],
187
+ "reasoning" : "The image gives an unnatural feeling on hands of the girl. There is also minor distortion on the eyes of the girl."
188
+ }
189
+ ||V^=^V||
190
+
191
+ Now evaluate the second set of input (2nd image).
192
+
193
+ """
194
+
195
+ _prompts_1shot_subject_image_gen_rule = """RULES of each set of inputs:
196
+
197
+ Two images will be provided: The first being a token subject image and the second being an AI-generated image using the first image as guidance.
198
+ The objective is to evaluate how successfully the image has been generated.
199
+ """
200
+
201
+ _prompts_1shot_cig_rule_SC = """
202
+ From scale 0 to 10:
203
+ A score from 0 to 10 will be given based on the success in following the prompt.
204
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
205
+ A second score from 0 to 10 will rate how well the generated image is following the guidance image.
206
+ (0 indicates that the second image is not following the guidance at all. 10 indicates that second image is following the guidance image.)
207
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the prompt and 'score2' evaluates the guidance.
208
+
209
+ First lets look at the first set of input (1st and 2nd images) as an example.
210
+ Text Prompt: the bridge is red, Golden Gate Bridge in San Francisco, USA
211
+ Output:
212
+ ||V^=^V||
213
+ {
214
+ "score" : [5, 5],
215
+ "reasoning" : "The bridge is red. But half of the bridge is gone."
216
+ }
217
+ ||V^=^V||
218
+
219
+ Now evaluate the second set of input (3th, 4th images).
220
+ Text Prompt: <prompt>
221
+ """
222
+
223
+ _prompts_1shot_two_image_edit_rule = """RULES of each set of inputs:
224
+
225
+ Two images will be provided: The first being the original AI-generated image and the second being an edited version of the first.
226
+ The objective is to evaluate how successfully the editing instruction has been executed in the second image.
227
+
228
+ Note that sometimes the two images might look identical due to the failure of image edit.
229
+ """
230
+
231
+ _prompts_1shot_subject_image_edit_rule = """RULES of each set of inputs:
232
+
233
+ Three images will be provided:
234
+ The first image is a input image to be edited.
235
+ The second image is a token subject image.
236
+ The third image is an AI-edited image from the first image. it should contain a subject that looks alike the subject in second image.
237
+ The objective is to evaluate how successfully the image has been edited.
238
+ """
239
+
240
+ _prompts_1shot_control_image_gen_rule = """RULES of each set of inputs:
241
+
242
+ Two images will be provided: The first being a processed image (e.g. Canny edges, openpose, grayscale etc.) and the second being an AI-generated image using the first image as guidance.
243
+ The objective is to evaluate how successfully the image has been generated.
244
+ """
245
+
246
+ _prompts_0shot_two_image_edit_rule = """RULES:
247
+
248
+ Two images will be provided: The first being the original AI-generated image and the second being an edited version of the first.
249
+ The objective is to evaluate how successfully the editing instruction has been executed in the second image.
250
+
251
+ Note that sometimes the two images might look identical due to the failure of image edit.
252
+ """
253
+
254
+ _prompts_0shot_one_video_gen_rule = """RULES:
255
+
256
+ The images are extracted from a AI-generated video according to the text prompt.
257
+ The objective is to evaluate how successfully the video has been generated.
258
+ """
259
+
260
+ _prompts_0shot_t2v_rule_PQ = """RULES:
261
+
262
+ The image frames are AI-generated.
263
+ The objective is to evaluate how successfully the image frames has been generated.
264
+
265
+ From scale 0 to 10:
266
+ A score from 0 to 10 will be given based on the image frames naturalness.
267
+ (
268
+ 0 indicates that the scene in the image frames does not look natural at all or give a unnatural feeling such as wrong sense of distance, or wrong shadow, or wrong lighting.
269
+ 10 indicates that the image frames looks natural.
270
+ )
271
+ A second score from 0 to 10 will rate the image frames artifacts.
272
+ (
273
+ 0 indicates that the image frames contains a large portion of distortion, or watermark, or scratches, or blurred faces, or unusual body parts, or subjects not harmonized.
274
+ 10 indicates the image frames has no artifacts.
275
+ )
276
+ Put the score in a list such that output score = [naturalness, artifacts]
277
+ """
278
+
279
+ _prompts_0shot_msdig_rule_SC = """From scale 0 to 10:
280
+ A score from 0 to 10 will be given based on the success in following the prompt.
281
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
282
+ A second score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the first sub-image.
283
+ (0 indicates that the subject in the second image does not look like the token subject in the first sub-image at all. 10 indicates the subject in the second image look exactly alike the token subject in the first sub-image.)
284
+ A third score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the second sub-image.
285
+ (0 indicates that the subject in the second image does not look like the token subject in the second sub-image at all. 10 indicates the subject in the second image look exactly alike the token subject in the second sub-image.)
286
+ Put the score in a list such that output score = [score1, score2, score3], where 'score1' evaluates the prompt and 'score2' evaluates the resemblance for the first sub-image, and 'score3' evaluates the resemblance for the second sub-image.
287
+
288
+ Text Prompt: <prompt>
289
+ """
290
+
291
+ _prompts_0shot_sdie_rule_SC = """From scale 0 to 10:
292
+ A score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the second image.
293
+ (0 indicates that the subject in the third image does not look like the token subject at all. 10 indicates the subject in the third image look exactly alike the token subject.)
294
+ A second score from 0 to 10 will rate the degree of overediting in the second image.
295
+ (0 indicates that the scene in the edited image is completely different from the first image. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
296
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the resemblance and 'score2' evaluates the degree of overediting.
297
+
298
+ Subject: <subject>"""
299
+
300
+ _prompts_0shot_subject_image_edit_rule = """RULES:
301
+
302
+ Three images will be provided:
303
+ The first image is a input image to be edited.
304
+ The second image is a token subject image.
305
+ The third image is an AI-edited image from the first image. it should contain a subject that looks alike the subject in second image.
306
+ The objective is to evaluate how successfully the image has been edited.
307
+ """
308
+
309
+ _prompts_0shot_mie_rule_SC = """From scale 0 to 10:
310
+ A score from 0 to 10 will be given based on the success of the editing. (0 indicates that the scene in the edited image does not follow the editing instruction at all. 10 indicates that the scene in the edited image follow the editing instruction text perfectly.)
311
+ A second score from 0 to 10 will rate the degree of overediting in the second image. (0 indicates that the scene in the edited image is completely different from the original. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
312
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the editing success and 'score2' evaluates the degree of overediting.
313
+
314
+ Editing instruction: <instruction>
315
+ """
316
+
317
+ _prompts_0shot_sdig_rule_SC = """From scale 0 to 10:
318
+ A score from 0 to 10 will be given based on the success in following the prompt.
319
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
320
+ A second score from 0 to 10 will rate how well the subject in the generated image resemble to the token subject in the first image.
321
+ (0 indicates that the subject in the second image does not look like the token subject at all. 10 indicates the subject in the second image look exactly alike the token subject.)
322
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the prompt and 'score2' evaluates the resemblance.
323
+
324
+ Text Prompt: <prompt>
325
+ """
326
+
327
+ _prompts_0shot_tie_rule_SC = """
328
+ From scale 0 to 10:
329
+ A score from 0 to 10 will be given based on the success of the editing. (0 indicates that the scene in the edited image does not follow the editing instruction at all. 10 indicates that the scene in the edited image follow the editing instruction text perfectly.)
330
+ A second score from 0 to 10 will rate the degree of overediting in the second image. (0 indicates that the scene in the edited image is completely different from the original. 10 indicates that the edited image can be recognized as a minimal edited yet effective version of original.)
331
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the editing success and 'score2' evaluates the degree of overediting.
332
+
333
+ Editing instruction: <instruction>
334
+ """
335
+
336
+ _prompts_0shot_t2i_rule_SC = """From scale 0 to 10:
337
+ A score from 0 to 10 will be given based on the success in following the prompt.
338
+ (0 indicates that the AI generated image does not follow the prompt at all. 10 indicates the AI generated image follows the prompt perfectly.)
339
+
340
+ Put the score in a list such that output score = [score].
341
+
342
+ Text Prompt: <prompt>
343
+ """
344
+
345
+ _prompts_0shot_cig_rule_SC = """From scale 0 to 10:
346
+ A score from 0 to 10 will be given based on the success in following the prompt.
347
+ (0 indicates that the second image does not follow the prompt at all. 10 indicates the second image follows the prompt perfectly.)
348
+ A second score from 0 to 10 will rate how well the generated image is following the guidance image.
349
+ (0 indicates that the second image is not following the guidance at all. 10 indicates that second image is following the guidance image.)
350
+ Put the score in a list such that output score = [score1, score2], where 'score1' evaluates the prompt and 'score2' evaluates the guidance.
351
+
352
+ Text Prompt: <prompt>"""
353
+
354
+ _prompts_0shot_control_image_gen_rule = """RULES:
355
+
356
+ Two images will be provided: The first being a processed image (e.g. Canny edges, openpose, grayscale etc.) and the second being an AI-generated image using the first image as guidance.
357
+ The objective is to evaluate how successfully the image has been generated.
358
+ """
359
+
360
+ _prompts_0shot_rule_PQ = """RULES:
361
+
362
+ The image is an AI-generated image.
363
+ The objective is to evaluate how successfully the image has been generated.
364
+
365
+ From scale 0 to 10:
366
+ A score from 0 to 10 will be given based on image naturalness.
367
+ (
368
+ 0 indicates that the scene in the image does not look natural at all or give a unnatural feeling such as wrong sense of distance, or wrong shadow, or wrong lighting.
369
+ 10 indicates that the image looks natural.
370
+ )
371
+ A second score from 0 to 10 will rate the image artifacts.
372
+ (
373
+ 0 indicates that the image contains a large portion of distortion, or watermark, or scratches, or blurred faces, or unusual body parts, or subjects not harmonized.
374
+ 10 indicates the image has no artifacts.
375
+ )
376
+ Put the score in a list such that output score = [naturalness, artifacts]
377
+ """
378
+
379
+ _prompts_0shot_t2v_rule_SC = """From scale 0 to 10:
380
+ A score from 0 to 10 will be given based on the success in following the prompt.
381
+ (0 indicates that the image frames does not follow the prompt at all. 10 indicates the image frames follows the prompt perfectly.)
382
+
383
+ Put the score in a list such that output score = [score].
384
+
385
+ Text Prompt: <prompt>
386
+ """
387
+
388
+ _prompts_0shot_multi_subject_image_gen_rule = """RULES:
389
+
390
+ Two images will be provided:
391
+ This first image is a concatenation of two sub-images, each sub-image contain one token subject.
392
+ The second image being an AI-generated image using the first image as guidance.
393
+ The objective is to evaluate how successfully the image has been generated.
394
+ """
395
+
396
+ _prompts_0shot_subject_image_gen_rule = """RULES:
397
+
398
+ Two images will be provided: The first being a token subject image and the second being an AI-generated image using the first image as guidance.
399
+ The objective is to evaluate how successfully the image has been generated.
400
+ """
401
+
402
+ _prompts_0shot_one_image_gen_rule = """RULES:
403
+
404
+ The image is an AI-generated image according to the text prompt.
405
+ The objective is to evaluate how successfully the image has been generated.
406
+ """
@@ -0,0 +1,129 @@
1
+ # flake8: noqa: E501
2
+ import re
3
+ from typing import Any, Dict
4
+
5
+ from evalscope.api.benchmark import BenchmarkMeta, VisionLanguageAdapter
6
+ from evalscope.api.dataset import Sample
7
+ from evalscope.api.evaluator import TaskState
8
+ from evalscope.api.messages import ChatMessageUser, Content, ContentImage, ContentText
9
+ from evalscope.api.registry import register_benchmark
10
+ from evalscope.constants import Tags
11
+ from evalscope.utils.io_utils import bytes_to_base64
12
+ from evalscope.utils.logger import get_logger
13
+ from evalscope.utils.multi_choices import MultipleChoiceTemplate, parse_answers, prompt
14
+
15
+ logger = get_logger()
16
+
17
+ SUBSET_LIST = ['default']
18
+
19
+ OPEN_PROMPT = """
20
+ Solve the following problem step by step. The last line of your response should be of the form "ANSWER: $ANSWER" (without quotes) where $ANSWER is the answer to the problem.
21
+
22
+ {question}
23
+
24
+ Remember to put your answer on its own line at the end in the form "ANSWER: $ANSWER" (without quotes) where $ANSWER is the answer to the problem, and you do not need to use a \\boxed command.
25
+ """
26
+
27
+ MULT_CHOICE_PROMPT = MultipleChoiceTemplate.SINGLE_ANSWER_COT
28
+
29
+ MULTI_CHOICE_TYPE = 'multi_choice'
30
+ OPEN_TYPE = 'free_form'
31
+
32
+
33
+ @register_benchmark(
34
+ BenchmarkMeta(
35
+ name='math_vista',
36
+ pretty_name='MathVista',
37
+ dataset_id='evalscope/MathVista',
38
+ tags=[Tags.MATH, Tags.REASONING, Tags.MULTIPLE_CHOICE, Tags.MULTI_MODAL],
39
+ description=
40
+ 'MathVista is a consolidated Mathematical reasoning benchmark within Visual contexts. It consists of three newly created datasets, IQTest, FunctionQA, and PaperQA, which address the missing visual domains and are tailored to evaluate logical reasoning on puzzle test figures, algebraic reasoning over functional plots, and scientific reasoning with academic paper figures, respectively. It also incorporates 9 MathQA datasets and 19 VQA datasets from the literature, which significantly enrich the diversity and complexity of visual perception and mathematical reasoning challenges within our benchmark. In total, MathVista includes 6,141 examples collected from 31 different datasets.',
41
+ subset_list=SUBSET_LIST,
42
+ metric_list=['acc'],
43
+ eval_split='testmini',
44
+ prompt_template=OPEN_PROMPT,
45
+ )
46
+ )
47
+ class MathVistaAdapter(VisionLanguageAdapter):
48
+
49
+ def __init__(self, **kwargs):
50
+ super().__init__(**kwargs)
51
+
52
+ def record_to_sample(self, record: Dict[str, Any]) -> Sample:
53
+ content_list, answers_list = MathVistaAdapter.create_content_and_answers_list(record)
54
+
55
+ if record['question_type'] == 'multi_choice':
56
+ label_answer = self.get_option_label(answers_list, record['answer'])
57
+ return Sample(
58
+ input=[ChatMessageUser(content=content_list)],
59
+ choices=answers_list,
60
+ target=label_answer,
61
+ metadata={
62
+ 'question_type': record['question_type'],
63
+ 'answer_type': record['answer_type'],
64
+ **record['metadata'],
65
+ }
66
+ )
67
+ elif record['question_type'] == 'free_form':
68
+ return Sample(
69
+ input=[ChatMessageUser(content=content_list)],
70
+ target=record['answer'],
71
+ metadata={
72
+ 'precision': record['precision'],
73
+ 'question_type': record['question_type'],
74
+ 'answer_type': record['answer_type'],
75
+ **record['metadata'],
76
+ }
77
+ )
78
+ else:
79
+ raise ValueError(f"Unexpected question_type: {record['question_type']}")
80
+
81
+ def get_option_label(self, options, value):
82
+ try:
83
+ index = options.index(value)
84
+ return chr(ord('A') + index)
85
+ except ValueError:
86
+ logger.warning(f"Answer '{value}' not found in options: {options}. This may cause evaluation issues.")
87
+ return value
88
+
89
+ def extract_answer(self, prediction: str, task_state: TaskState) -> str:
90
+ question_type = task_state.metadata['question_type']
91
+ if question_type == MULTI_CHOICE_TYPE:
92
+ answers = parse_answers(task_state)
93
+ return ''.join(sorted(list(answers)))
94
+ elif question_type == OPEN_TYPE:
95
+ pattern = r'ANSWER:\s*(.*)'
96
+ match = re.search(pattern, prediction)
97
+ if match:
98
+ return match.group(1).strip()
99
+ return ''
100
+ else:
101
+ raise ValueError(f'Unsupported question type: {question_type}')
102
+
103
+ @staticmethod
104
+ def create_content_and_answers_list(record: dict[str, Any], ) -> tuple[list[Content], list[str]]:
105
+ """
106
+ Create a list of content elements and a list of answers from a record.
107
+
108
+ Args:
109
+ record (dict): The record containing question, images, and options.
110
+
111
+
112
+ Returns:
113
+ tuple: A tuple containing:
114
+ - content_list (list): A list of content elements (text and images).
115
+ - answers_list (list): A list of possible answers (for multiple-choice questions).
116
+ """
117
+ question_type = record['question_type']
118
+ if question_type == MULTI_CHOICE_TYPE:
119
+ answers_list = record['choices']
120
+ input_text = prompt(question=record['question'], choices=answers_list, template=MULT_CHOICE_PROMPT)
121
+ content_list: list[Content] = [ContentText(text=input_text)]
122
+ else:
123
+ answers_list: list[str] = []
124
+ content_list: list[Content] = [ContentText(text=OPEN_PROMPT.format(question=record['question']))]
125
+ image = record['decoded_image']
126
+ if image:
127
+ image_base64 = bytes_to_base64(image['bytes'], format='jpg', add_header=True)
128
+ content_list.append(ContentImage(image=image_base64))
129
+ return content_list, answers_list
File without changes