-
Notifications
You must be signed in to change notification settings - Fork 470
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] Support MMLU-CF Benchmark #1775
Merged
Merged
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d1a9db5
[Feature] Support MMLU-CF Benchmark
fistyee 0c48407
[Feature] Support MMLU-CF Benchmark
fistyee 17af07e
[Feature] Support MMLU-CF Benchmark
fistyee 772b9a7
[Feature] Support MMLU-CF Benchmark
fistyee a32a1ee
[Feature] Support MMLU-CF Benchmark
fistyee 531945d
[Feature] Support MMLU-CF Benchmark
fistyee 3d769a9
[Feature] Support MMLU-CF Benchmark
fistyee 21c8a98
[Feature] Support MMLU-CF Benchmark
fistyee 113b564
[Feature] Support MMLU-CF Benchmark
fistyee 5044516
[Feature] Support MMLU-CF Benchmark
fistyee 6a57af5
[Feature] Support MMLU-CF Benchmark
fistyee 706108d
[Feature] Support MMLU-CF Benchmark
fistyee 2e15038
Merge branch 'open-compass:main' into main
fistyee 5ab6362
[Feature] Support MMLU-CF Benchmark
fistyee 4de7b20
Merge branch 'main' of https://github.com/fistyee/opencompass
fistyee ddd5583
[Feature] Support MMLU-CF Benchmark
fistyee 956fe45
[Feature] Support MMLU-CF Benchmark
fistyee a222713
[Feature] Support MMLU-CF Benchmark
fistyee d5f756e
[Feature] Support MMLU-CF Benchmark
fistyee 2329a5f
[Feature] Support MMLU-CF Benchmark
fistyee 93c4411
[Feature] Support MMLU-CF Benchmark
fistyee 77df499
Update mmlu-cf
liushz e428a7e
Update mmlu-cf
liushz ce3ee2d
Update mmlu-cf
liushz d061100
[Feature] Support MMLU-CF Benchmark
fistyee c5722b9
[Feature] Support MMLU-CF Benchmark
fistyee 8439245
[Feature] Support MMLU-CF Benchmark
fistyee 89929df
Remove outside configs
liushz e7149dd
Remove outside configs
liushz 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
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 |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
|
||
## 🚀 最新进展 <a><img width="35" height="20" src="https://user-images.githubusercontent.com/12782558/212848161-5e783dd6-11e8-4fe0-bbba-39ffb77730be.png"></a> | ||
|
||
- **\[2024.12.27\]** 现已支持Microsoft去污染多任务语言理解数据集[MMLU-CF](https://huggingface.co/datasets/microsoft/MMLU-CF),欢迎尝试! 🔥🔥🔥 | ||
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. Seem as the comment above. 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. ok |
||
- **\[2024.12.17\]** 我们提供了12月CompassAcademic学术榜单评估脚本 [CompassAcademic](configs/eval_academic_leaderboard_202412.py),你可以通过简单地配置复现官方评测结果。 | ||
- **\[2024.10.14\]** 现已支持OpenAI多语言问答数据集[MMMLU](https://huggingface.co/datasets/openai/MMMLU),欢迎尝试! 🔥🔥🔥 | ||
- **\[2024.09.19\]** 现已支持[Qwen2.5](https://huggingface.co/Qwen)(0.5B to 72B) ,可以使用多种推理后端(huggingface/vllm/lmdeploy), 欢迎尝试! 🔥🔥🔥 | ||
|
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,16 @@ | ||
categories = [ | ||
'Math', | ||
'Physics', | ||
'Chemistry', | ||
'Law', | ||
'Engineering', | ||
'Other', | ||
'Economics', | ||
'Health', | ||
'Psychology', | ||
'Business', | ||
'Biology', | ||
'Philosophy', | ||
'Computer_Science', | ||
'History', | ||
] |
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,64 @@ | ||
from mmengine.config import read_base | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import FixKRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer | ||
from opencompass.openicl.icl_evaluator import AccwithDetailsEvaluator | ||
from opencompass.datasets import MMLUCFDataset | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mmlu_cf_categories import categories | ||
|
||
mmlu_cf_reader_cfg = dict( | ||
input_columns=['input', 'A', 'B', 'C', 'D'], | ||
output_column='target', | ||
train_split='dev') | ||
|
||
mmlu_cf_datasets = [] | ||
for _name in categories: | ||
_hint = f'There is a single choice question (with answers). Answer the question by replying A, B, C or D.' | ||
mmlu_cf_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict(round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt= | ||
f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
dict(role='BOT', prompt='{target}\n') | ||
]), | ||
), | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt=f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=FixKRetriever, fix_id_list=[0, 1, 2, 3, 4]), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
mmlu_cf_eval_cfg = dict( | ||
evaluator=dict(type=AccwithDetailsEvaluator), | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD')) | ||
|
||
mmlu_cf_datasets.append( | ||
dict( | ||
abbr=f'mmlu_cf_{_name}', | ||
type=MMLUCFDataset, | ||
path='opencompass/mmlu_cf', | ||
name=_name, | ||
reader_cfg=mmlu_cf_reader_cfg, | ||
infer_cfg=mmlu_cf_infer_cfg, | ||
eval_cfg=mmlu_cf_eval_cfg, | ||
)) | ||
|
||
del _name, _hint |
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,64 @@ | ||
from mmengine.config import read_base | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import FixKRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer | ||
from opencompass.openicl.icl_evaluator import AccwithDetailsEvaluator | ||
from opencompass.datasets import MMLUCFDataset | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mmlu_cf_categories import categories | ||
|
||
mmlu_cf_reader_cfg = dict( | ||
input_columns=['input', 'A', 'B', 'C', 'D'], | ||
output_column='target', | ||
train_split='dev') | ||
|
||
mmlu_cf_datasets = [] | ||
for _name in categories: | ||
_hint = f'There is a single choice question. Answer the question by replying A, B, C or D.' | ||
mmlu_cf_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict(round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt= | ||
f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
dict(role='BOT', prompt='{target}\n') | ||
]), | ||
), | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt=f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=FixKRetriever, fix_id_list=[0, 1, 2, 3, 4]), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
mmlu_cf_eval_cfg = dict( | ||
evaluator=dict(type=AccwithDetailsEvaluator), | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD')) | ||
|
||
mmlu_cf_datasets.append( | ||
dict( | ||
abbr=f'mmlu_cf_{_name}', | ||
type=MMLUCFDataset, | ||
path='opencompass/mmlu_cf/', | ||
name=_name, | ||
reader_cfg=mmlu_cf_reader_cfg, | ||
infer_cfg=mmlu_cf_infer_cfg, | ||
eval_cfg=mmlu_cf_eval_cfg, | ||
)) | ||
|
||
del _name, _hint |
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,64 @@ | ||
from mmengine.config import read_base | ||
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 AccwithDetailsEvaluator | ||
from opencompass.datasets import MMLUCFDataset | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mmlu_cf_categories import categories | ||
|
||
mmlu_cf_reader_cfg = dict( | ||
input_columns=['input', 'A', 'B', 'C', 'D'], | ||
output_column='target', | ||
train_split='dev') | ||
|
||
mmlu_cf_datasets = [] | ||
for _name in categories: | ||
_hint = f'There is a single choice question (with answers). Answer the question by replying A, B, C or D.' | ||
mmlu_cf_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict(round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt= | ||
f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
dict(role='BOT', prompt='{target}\n') | ||
]), | ||
), | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt=f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
mmlu_cf_eval_cfg = dict( | ||
evaluator=dict(type=AccwithDetailsEvaluator), | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD')) | ||
|
||
mmlu_cf_datasets.append( | ||
dict( | ||
abbr=f'mmlu_cf_{_name}', | ||
type=MMLUCFDataset, | ||
path='opencompass/mmlu_cf', | ||
name=_name, | ||
reader_cfg=mmlu_cf_reader_cfg, | ||
infer_cfg=mmlu_cf_infer_cfg, | ||
eval_cfg=mmlu_cf_eval_cfg, | ||
)) | ||
|
||
del _name, _hint |
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,5 @@ | ||
categories = ['Computer Science', 'Math', 'Physics', 'Chemistry', 'Law', 'Engineering', 'Other', 'Economics', 'Health', 'Psychology', 'Business', 'Biology', 'Philosophy', 'History'] | ||
|
||
mmlu_cf_summary_groups = [ | ||
{'name': 'mmlu_cf', 'subsets': ['mmlu_cf_' + c.replace(' ', '_') for c in categories]}, | ||
] |
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,25 @@ | ||
from mmengine.config import read_base | ||
|
||
with read_base(): | ||
from .groups.mmlu_cf import mmlu_cf_summary_groups | ||
|
||
summarizer = dict( | ||
dataset_abbrs=[ | ||
'mmlu_cf', | ||
'mmlu_cf_Biology', | ||
'mmlu_cf_Business', | ||
'mmlu_cf_Chemistry', | ||
'mmlu_cf_Computer_Science', | ||
'mmlu_cf_Economics', | ||
'mmlu_cf_Engineering', | ||
'mmlu_cf_Health', | ||
'mmlu_cf_History', | ||
'mmlu_cf_Law', | ||
'mmlu_cf_Math', | ||
'mmlu_cf_Philosophy', | ||
'mmlu_cf_Physics', | ||
'mmlu_cf_Psychology', | ||
'mmlu_cf_Other', | ||
], | ||
summary_groups=sum([v for k, v in locals().items() if k.endswith('_summary_groups')], []), | ||
) |
16 changes: 16 additions & 0 deletions
16
opencompass/configs/datasets/mmlu_cf/mmlu_cf_categories.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,16 @@ | ||
categories = [ | ||
'Math', | ||
'Physics', | ||
'Chemistry', | ||
'Law', | ||
'Engineering', | ||
'Other', | ||
'Economics', | ||
'Health', | ||
'Psychology', | ||
'Business', | ||
'Biology', | ||
'Philosophy', | ||
'Computer_Science', | ||
'History', | ||
] |
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,64 @@ | ||
from mmengine.config import read_base | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import FixKRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer | ||
from opencompass.openicl.icl_evaluator import AccwithDetailsEvaluator | ||
from opencompass.datasets import MMLUCFDataset | ||
from opencompass.utils.text_postprocessors import first_option_postprocess | ||
|
||
with read_base(): | ||
from .mmlu_cf_categories import categories | ||
|
||
mmlu_cf_reader_cfg = dict( | ||
input_columns=['input', 'A', 'B', 'C', 'D'], | ||
output_column='target', | ||
train_split='dev') | ||
|
||
mmlu_cf_datasets = [] | ||
for _name in categories: | ||
_hint = f'There is a single choice question (with answers). Answer the question by replying A, B, C or D.' | ||
mmlu_cf_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict(round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt= | ||
f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
dict(role='BOT', prompt='{target}\n') | ||
]), | ||
), | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt=f'{_hint}\nQuestion: {{input}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\nAnswer: ' | ||
), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=FixKRetriever, fix_id_list=[0, 1, 2, 3, 4]), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
mmlu_cf_eval_cfg = dict( | ||
evaluator=dict(type=AccwithDetailsEvaluator), | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD')) | ||
|
||
mmlu_cf_datasets.append( | ||
dict( | ||
abbr=f'mmlu_cf_{_name}', | ||
type=MMLUCFDataset, | ||
path='opencompass/mmlu_cf', | ||
name=_name, | ||
reader_cfg=mmlu_cf_reader_cfg, | ||
infer_cfg=mmlu_cf_infer_cfg, | ||
eval_cfg=mmlu_cf_eval_cfg, | ||
)) | ||
|
||
del _name, _hint |
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.
We don't recommend this information appear in README now, we will consider adding this in next version of OpenCompass.