-
Notifications
You must be signed in to change notification settings - Fork 527
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
[Feature] Update MathBench & WikiBench for FullBench #1521
Merged
+426
−2
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
14fda65
Update MathBench & WikiBench for FullBench
86b53b9
Update MathBench & WikiBench for FullBench
8509716
Merge branch 'main' of github.com:open-compass/opencompass into updat…
b8640c1
Update GPQA & MMLU_Pro
a48ef11
Update MathBench & WikiBench for FullBench
daccf8e
Update MathBench & WikiBench for FullBench
46a32b5
Update MathBench & WikiBench for FullBench
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
from mmengine.config import read_base | ||
from copy import deepcopy | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import ZeroRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer, PPLInferencer | ||
from opencompass.openicl.icl_evaluator import CircularEvaluator, AccEvaluator | ||
from opencompass.datasets import MathBenchDataset, math_postprocess_v2 | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mathbench_prompt import zero_shot_prompts, few_shot_prompts, mathbench_sets | ||
|
||
# Max for this dataset is 4 | ||
num_shot = 0 | ||
# Generate reasoning path or not, only for single choice | ||
with_reasoning = True | ||
# Use circular evaluation or not | ||
with_circular_eval = True | ||
# Use PPL mode in single choice test or not | ||
use_ppl_single_choice = False | ||
|
||
assert 0 <= num_shot <= 4 | ||
if num_shot == 0: | ||
prompts = zero_shot_prompts | ||
else: | ||
prompts = {name: p[- 2 * num_shot - 2:] for name, p in few_shot_prompts.items()} | ||
|
||
mathbench_datasets = [] | ||
for _split in mathbench_sets: | ||
for _name in mathbench_sets[_split]: | ||
if 'single_choice' in _name: | ||
if with_reasoning: | ||
template_round = prompts[_name + '_with_reasoning'] | ||
else: | ||
template_round = prompts[_name] | ||
else: | ||
template_round = prompts[_name] | ||
|
||
if 'single_choice' in _name: | ||
pred_postprocessor = dict(type=first_option_postprocess, options='ABCD') | ||
else: | ||
pred_postprocessor = dict(type=math_postprocess_v2) | ||
|
||
if 'single_choice' in _name and with_circular_eval: | ||
evaluator = dict(type=CircularEvaluator) | ||
else: | ||
evaluator = dict(type=AccEvaluator) | ||
|
||
# assemble the final config | ||
mathbench_reader_cfg = dict(input_columns=['question'], output_column='answer') | ||
if use_ppl_single_choice and 'single_choice' in _name and not with_reasoning: | ||
template = {} | ||
for answer in ['A', 'B', 'C', 'D']: | ||
one_template_round = deepcopy(template_round) | ||
one_template_round['round'][-1]['prompt'] = one_template_round['round'][-1]['prompt'].format(answer=answer) | ||
template[answer] = dict(round=one_template_round) | ||
mathbench_infer_cfg = dict( | ||
prompt_template=dict(type=PromptTemplate, template=template), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=PPLInferencer), | ||
) | ||
else: | ||
mathbench_infer_cfg = dict( | ||
prompt_template=dict(type=PromptTemplate, template=dict(round=template_round)), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer, max_out_len=2048), | ||
) | ||
mathbench_eval_cfg = dict(evaluator=evaluator, pred_postprocessor=pred_postprocessor) | ||
|
||
mathbench_datasets.append( | ||
dict( | ||
abbr='mathbench-' + _split + '-' + _name, | ||
type=MathBenchDataset, | ||
path=f'data/mathbench_v1/{_split}', | ||
name=_name, | ||
with_circular=with_circular_eval, | ||
reader_cfg=mathbench_reader_cfg, | ||
infer_cfg=mathbench_infer_cfg, | ||
eval_cfg=mathbench_eval_cfg, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from mmengine.config import read_base | ||
|
||
with read_base(): | ||
from .wikibench_gen_f96ece import wikibench_datasets # noqa: F401, F403 | ||
from .wikibench_gen_0978ad import wikibench_datasets # noqa: F401, F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
opencompass/configs/datasets/MathBench/mathbench_2024_gen_50a320.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
from mmengine.config import read_base | ||
from copy import deepcopy | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import ZeroRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer, PPLInferencer | ||
from opencompass.openicl.icl_evaluator import CircularEvaluator, AccEvaluator | ||
from opencompass.datasets import MathBenchDataset, math_postprocess_v2 | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mathbench_prompt import zero_shot_prompts, few_shot_prompts, mathbench_sets | ||
|
||
# Max for this dataset is 4 | ||
num_shot = 0 | ||
# Generate reasoning path or not, only for single choice | ||
with_reasoning = True | ||
# Use circular evaluation or not | ||
with_circular_eval = True | ||
# Use PPL mode in single choice test or not | ||
use_ppl_single_choice = False | ||
|
||
assert 0 <= num_shot <= 4 | ||
if num_shot == 0: | ||
prompts = zero_shot_prompts | ||
else: | ||
prompts = {name: p[- 2 * num_shot - 2:] for name, p in few_shot_prompts.items()} | ||
|
||
mathbench_datasets = [] | ||
for _split in mathbench_sets: | ||
for _name in mathbench_sets[_split]: | ||
if 'single_choice' in _name: | ||
if with_reasoning: | ||
template_round = prompts[_name + '_with_reasoning'] | ||
else: | ||
template_round = prompts[_name] | ||
else: | ||
template_round = prompts[_name] | ||
|
||
if 'single_choice' in _name: | ||
pred_postprocessor = dict(type=first_option_postprocess, options='ABCD') | ||
else: | ||
pred_postprocessor = dict(type=math_postprocess_v2) | ||
|
||
if 'single_choice' in _name and with_circular_eval: | ||
evaluator = dict(type=CircularEvaluator) | ||
else: | ||
evaluator = dict(type=AccEvaluator) | ||
|
||
# assemble the final config | ||
mathbench_reader_cfg = dict(input_columns=['question'], output_column='answer') | ||
if use_ppl_single_choice and 'single_choice' in _name and not with_reasoning: | ||
template = {} | ||
for answer in ['A', 'B', 'C', 'D']: | ||
one_template_round = deepcopy(template_round) | ||
one_template_round['round'][-1]['prompt'] = one_template_round['round'][-1]['prompt'].format(answer=answer) | ||
template[answer] = dict(round=one_template_round) | ||
mathbench_infer_cfg = dict( | ||
prompt_template=dict(type=PromptTemplate, template=template), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=PPLInferencer), | ||
) | ||
else: | ||
mathbench_infer_cfg = dict( | ||
prompt_template=dict(type=PromptTemplate, template=dict(round=template_round)), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer, max_out_len=2048), | ||
) | ||
mathbench_eval_cfg = dict(evaluator=evaluator, pred_postprocessor=pred_postprocessor) | ||
|
||
mathbench_datasets.append( | ||
dict( | ||
abbr='mathbench-' + _split + '-' + _name, | ||
type=MathBenchDataset, | ||
path=f'data/mathbench_v1/{_split}', | ||
name=_name, | ||
with_circular=with_circular_eval, | ||
reader_cfg=mathbench_reader_cfg, | ||
infer_cfg=mathbench_infer_cfg, | ||
eval_cfg=mathbench_eval_cfg, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from mmengine.config import read_base | ||
|
||
with read_base(): | ||
from .wikibench_gen_f96ece import wikibench_datasets # noqa: F401, F403 | ||
from .wikibench_gen_0978ad import wikibench_datasets # noqa: F401, F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -408,6 +408,10 @@ | |
"url": "http://opencompass.oss-cn-shanghai.aliyuncs.com/datasets/data/mmlu_pro.zip", | ||
"md5": "e3200c7380f4cea5f13c768f2815fabb", | ||
}, | ||
"WikiBench": { | ||
"url": "http://opencompass.oss-cn-shanghai.aliyuncs.com/datasets/data/WikiBench.zip", | ||
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 is a internal dataset? |
||
"md5": "f19f9857517148c876d9cf1b6f4c63b1", | ||
}, | ||
"/Longbench": { | ||
"url": "http://opencompass.oss-cn-shanghai.aliyuncs.com/datasets/data/Longbench.zip", | ||
"md5": "ab0cb9e520ae5cfb899bf38b564249bb", | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't we create a new promt version while keeping the old one. It might cause BC issue removing the existing file.