-
Notifications
You must be signed in to change notification settings - Fork 19
update fix on textvqa, mmmu, mmstar, add patch for glm4.6v #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| from ais_bench.benchmark.datasets.utils.datasets import get_data_path, toliststr, decode_base64_to_image_file, get_content_str | ||
|
|
||
| from .base import BaseDataset | ||
| import re | ||
|
|
||
| logger = AISLogger() | ||
| IMAGE_MAP_LEN = 64 | ||
|
|
@@ -349,7 +350,13 @@ def score(self, predictions, references): | |
| pred = pred.replace(char, '') | ||
| detail = {'pred': pred, 'answer': refer, 'correct': False} | ||
| choices = json.loads(refer['choices']) | ||
| infer_res = can_infer(pred, choices) | ||
| # infer_res = can_infer(pred, choices) | ||
| pattern = r'<\|begin_of_box\|>(.*?)<\|end_of_box\|>' | ||
| match = re.search(pattern, pred, re.DOTALL) | ||
| if match is not None: | ||
| infer_res = match.group(1) | ||
| else: | ||
| infer_res = "" | ||
|
Comment on lines
+356
to
+359
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| overall_key = '[' + refer['split'] + ']: Overall' | ||
| key_category = '[' + refer['split'] + ']: ' + refer['category'] | ||
| key_l2_category = '[' + refer['split'] + ']: ' + refer['l2-category'] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| from ais_bench.benchmark.utils.prompt import AIS_CONTENT_TAG, AIS_TEXT_START, AIS_IMAGE_START | ||
|
|
||
| from .base import BaseDataset | ||
| import re | ||
|
|
||
| IMAGE_MAP_LEN = 64 | ||
| logger = AISLogger() | ||
|
|
@@ -103,8 +104,13 @@ def score(self, predictions, references): | |
| for pred, refer in zip(predictions, references): | ||
| detail = {'pred': pred, 'answer': refer, 'correct': False} | ||
| choices = json.loads(refer['choices']) | ||
| infer_res = can_infer(pred, choices) | ||
|
|
||
| # infer_res = can_infer(pred, choices) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 【review】应保留原有MMStarEvaluator逻辑,新增MMStarEvaluatorGLM重写score函数并在新增配置文件mmstar_gen_glm.py中配置 |
||
| pattern = r'<\|begin_of_box\|>(.*?)<\|end_of_box\|>' | ||
| match = re.search(pattern, pred, re.DOTALL) | ||
| if match is not None: | ||
| infer_res = match.group(1) | ||
| else: | ||
| infer_res = "" | ||
|
Comment on lines
+110
to
+113
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This infer_res = match.group(1) if match else "" |
||
| key_category = refer['category'] | ||
| score = 1 if infer_res == refer['answer'] else 0 | ||
| if score == 1: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,7 @@ def __init__(self): | |
| '?', | ||
| '!', | ||
| ] | ||
| self.special_tokens = ['☞', '☟', '☜', '<unk>', '<|im_end|>'] | ||
| self.special_tokens = ['☞', '☟', '☜', '<unk>', '<|im_end|>', '<|end_of_box|>', '<|begin_of_box|>'] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 【review】此处修改可能会导致部分模型精度与过往结果不一致,可使用ais_bench/benchmark/configs/datasets/textvqa/glm4v_textvqa_gen_base64.py配置进行测试 |
||
|
|
||
| def process_punctuation(self, in_text): | ||
| if len(in_text) > MAX_TARGET_LENGTH: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【review】不应修改原有的配置文件,新增配置文件mmmu_gen_glm4.6v.py