Skip to content
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
merged 7 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update MathBench & WikiBench for FullBench
liushz committed Sep 18, 2024
commit a48ef112725bd6a41566a99b0c6140c2830a0e35
56 changes: 56 additions & 0 deletions configs/datasets/wikibench/wikibench_gen_f96ece.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import GenInferencer
from opencompass.openicl.icl_evaluator import CircularEvaluator, AccEvaluator
from opencompass.datasets import WikiBenchDataset
from opencompass.utils.text_postprocessors import first_option_postprocess


single_choice_prompts = {
'single_choice_cn': '以下是一道单项选择题,请你根据你了解的知识给出正确的答案选项。\n下面是你要回答的题目:\n{question}\n答案选项:',
}

wikibench_sets = {
'wiki': ['single_choice_cn'],
}

do_circular = True

wikibench_datasets = []

for _split in list(wikibench_sets.keys()):
for _name in wikibench_sets[_split]:
wikibench_infer_cfg = dict(
ice_template=dict(
type=PromptTemplate,
template=dict(
begin='</E>',
round=[
dict(role='HUMAN', prompt=single_choice_prompts[_name]),
dict(role='BOT', prompt='{answer}'),
],
),
ice_token='</E>',
),
retriever=dict(type=ZeroRetriever),
inferencer=dict(type=GenInferencer),
)
wikibench_eval_cfg = dict(
evaluator=dict(type=CircularEvaluator if do_circular else AccEvaluator),
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD'),
)

wikibench_datasets.append(
dict(
type=WikiBenchDataset,
path=f'./data/WikiBench/{_name}.jsonl',
name='circular_' + _name if do_circular else _name,
abbr='wikibench-' + _split + '-' + _name + 'circular' if do_circular else '',
reader_cfg=dict(
input_columns=['question'],
output_column='answer',
),
infer_cfg=wikibench_infer_cfg,
eval_cfg=wikibench_eval_cfg,
)
)
56 changes: 56 additions & 0 deletions opencompass/configs/datasets/wikibench/wikibench_gen_f96ece.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import GenInferencer
from opencompass.openicl.icl_evaluator import CircularEvaluator, AccEvaluator
from opencompass.datasets import WikiBenchDataset
from opencompass.utils.text_postprocessors import first_option_postprocess


single_choice_prompts = {
'single_choice_cn': '以下是一道单项选择题,请你根据你了解的知识给出正确的答案选项。\n下面是你要回答的题目:\n{question}\n答案选项:',
}

wikibench_sets = {
'wiki': ['single_choice_cn'],
}

do_circular = True

wikibench_datasets = []

for _split in list(wikibench_sets.keys()):
for _name in wikibench_sets[_split]:
wikibench_infer_cfg = dict(
ice_template=dict(
type=PromptTemplate,
template=dict(
begin='</E>',
round=[
dict(role='HUMAN', prompt=single_choice_prompts[_name]),
dict(role='BOT', prompt='{answer}'),
],
),
ice_token='</E>',
),
retriever=dict(type=ZeroRetriever),
inferencer=dict(type=GenInferencer),
)
wikibench_eval_cfg = dict(
evaluator=dict(type=CircularEvaluator if do_circular else AccEvaluator),
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD'),
)

wikibench_datasets.append(
dict(
type=WikiBenchDataset,
path=f'./data/WikiBench/{_name}.jsonl',
name='circular_' + _name if do_circular else _name,
abbr='wikibench-' + _split + '-' + _name + 'circular' if do_circular else '',
reader_cfg=dict(
input_columns=['question'],
output_column='answer',
),
infer_cfg=wikibench_infer_cfg,
eval_cfg=wikibench_eval_cfg,
)
)
Loading