forked from open-compass/opencompass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
762 additions
and
17 deletions.
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,53 @@ | ||
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 AccEvaluator | ||
from opencompass.datasets import ARCDataset | ||
from opencompass.utils.text_postprocessors import first_option_postprocess, match_answer_pattern | ||
|
||
QUERY_TEMPLATE = """ | ||
Answer the following multiple choice question. The last line of your response should be of the following format: 'ANSWER: $LETTER' (without quotes) where LETTER is one of ABCD. Think step by step before answering. | ||
{question} | ||
A. {textA} | ||
B. {textB} | ||
C. {textC} | ||
D. {textD} | ||
""".strip() | ||
|
||
ARC_c_reader_cfg = dict( | ||
input_columns=['question', 'textA', 'textB', 'textC', 'textD'], | ||
output_column='answerKey') | ||
|
||
ARC_c_infer_cfg = dict( | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt=QUERY_TEMPLATE) | ||
], ), | ||
), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
ARC_c_eval_cfg = dict( | ||
evaluator=dict(type=AccEvaluator), | ||
pred_role='BOT', | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD'), | ||
) | ||
|
||
ARC_c_datasets = [ | ||
dict( | ||
abbr='ARC-c', | ||
type=ARCDataset, | ||
path='opencompass/ai2_arc-dev', | ||
name='ARC-Challenge', | ||
reader_cfg=ARC_c_reader_cfg, | ||
infer_cfg=ARC_c_infer_cfg, | ||
eval_cfg=ARC_c_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import ZeroRetriever, FixKRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer | ||
from opencompass.openicl.icl_evaluator import AccEvaluator | ||
from opencompass.datasets import ARCDataset | ||
from opencompass.utils.text_postprocessors import first_capital_postprocess | ||
|
||
ARC_c_reader_cfg = dict( | ||
input_columns=['question', 'textA', 'textB', 'textC', 'textD'], | ||
output_column='answerKey', | ||
) | ||
|
||
ARC_c_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt='Question: {question}\nA. {textA}\nB. {textB}\nC. {textC}\nD. {textD}\nAnswer:', | ||
), | ||
dict(role='BOT', prompt='{answerKey}'), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=FixKRetriever, fix_id_list=[0, 2, 4, 6, 8]), | ||
inferencer=dict(type=GenInferencer, max_out_len=50), | ||
) | ||
|
||
ARC_c_eval_cfg = dict( | ||
evaluator=dict(type=AccEvaluator), | ||
pred_role='BOT', | ||
pred_postprocessor=dict(type=first_capital_postprocess), | ||
) | ||
|
||
ARC_c_datasets = [ | ||
dict( | ||
abbr='ARC-c', | ||
type=ARCDataset, | ||
path='opencompass/ai2_arc-dev', | ||
name='ARC-Challenge', | ||
reader_cfg=ARC_c_reader_cfg, | ||
infer_cfg=ARC_c_infer_cfg, | ||
eval_cfg=ARC_c_eval_cfg, | ||
) | ||
] |
55 changes: 55 additions & 0 deletions
55
configs/datasets/SuperGLUE_BoolQ/SuperGLUE_BoolQ_cot_gen_1d56df.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,55 @@ | ||
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 AccEvaluator | ||
from opencompass.datasets import BoolQDatasetV2 | ||
from opencompass.utils.text_postprocessors import ( | ||
first_option_postprocess, | ||
) | ||
|
||
QUERY_TEMPLATE = """ | ||
Answer the following question. The last line of your response should be of the following format: 'ANSWER: $LETTER' (without quotes) where LETTER is one of AB. Think step by step before answering. | ||
Passage: {passage} | ||
Question: {question} | ||
A. Yes | ||
B. NO | ||
""".strip() | ||
|
||
BoolQ_reader_cfg = dict( | ||
input_columns=['question', 'passage'], | ||
output_column='label', | ||
) | ||
|
||
BoolQ_infer_cfg = dict( | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
round=[ | ||
dict(role='HUMAN', prompt=QUERY_TEMPLATE), | ||
] | ||
), | ||
), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
BoolQ_eval_cfg = dict( | ||
evaluator=dict(type=AccEvaluator), | ||
pred_role='BOT', | ||
pred_postprocessor=dict(type=first_option_postprocess, options='AB'), | ||
) | ||
|
||
BoolQ_datasets = [ | ||
dict( | ||
abbr='BoolQ', | ||
type=BoolQDatasetV2, | ||
path='opencompass/boolq', | ||
reader_cfg=BoolQ_reader_cfg, | ||
infer_cfg=BoolQ_infer_cfg, | ||
eval_cfg=BoolQ_eval_cfg, | ||
) | ||
] |
47 changes: 47 additions & 0 deletions
47
configs/datasets/SuperGLUE_BoolQ/SuperGLUE_BoolQ_few_shot_gen_ba58ea.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,47 @@ | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import ZeroRetriever, FixKRetriever | ||
from opencompass.openicl.icl_inferencer import GenInferencer | ||
from opencompass.openicl.icl_evaluator import AccEvaluator | ||
from opencompass.datasets import BoolQDatasetV2 | ||
from opencompass.utils.text_postprocessors import first_capital_postprocess | ||
|
||
BoolQ_reader_cfg = dict( | ||
input_columns=['question', 'passage'], | ||
output_column='label', | ||
) | ||
|
||
BoolQ_infer_cfg = dict( | ||
ice_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
begin='</E>', | ||
round=[ | ||
dict( | ||
role='HUMAN', | ||
prompt='{passage}\nQuestion: {question}\nA. Yes\nB. No\nAnswer:', | ||
), | ||
dict(role='BOT', prompt='{label}'), | ||
], | ||
), | ||
ice_token='</E>', | ||
), | ||
retriever=dict(type=FixKRetriever, fix_id_list=[0, 2, 4, 6, 8]), | ||
inferencer=dict(type=GenInferencer, max_out_len=50), | ||
) | ||
|
||
BoolQ_eval_cfg = dict( | ||
evaluator=dict(type=AccEvaluator), | ||
pred_role='BOT', | ||
pred_postprocessor=dict(type=first_capital_postprocess), | ||
) | ||
|
||
BoolQ_datasets = [ | ||
dict( | ||
abbr='BoolQ', | ||
type=BoolQDatasetV2, | ||
path='opencompass/boolq', | ||
reader_cfg=BoolQ_reader_cfg, | ||
infer_cfg=BoolQ_infer_cfg, | ||
eval_cfg=BoolQ_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
43 changes: 43 additions & 0 deletions
43
configs/datasets/SuperGLUE_BoolQ/SuperGLUE_BoolQ_ppl_16b1d9.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,43 @@ | ||
from opencompass.openicl.icl_prompt_template import PromptTemplate | ||
from opencompass.openicl.icl_retriever import ZeroRetriever | ||
from opencompass.openicl.icl_inferencer import PPLInferencer | ||
from opencompass.openicl.icl_evaluator import AccEvaluator | ||
from opencompass.datasets import BoolQDatasetV2 | ||
|
||
BoolQ_reader_cfg = dict( | ||
input_columns=['question', 'passage'], | ||
output_column='label', | ||
) | ||
|
||
BoolQ_infer_cfg = dict( | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template={ | ||
'A': | ||
dict(round=[ | ||
dict(role='HUMAN', prompt='{passage}\nQuestion: {question}?'), | ||
dict(role='BOT', prompt='Yes'), | ||
]), | ||
'B': | ||
dict(round=[ | ||
dict(role='HUMAN', prompt='{passage}\nQuestion: {question}?'), | ||
dict(role='BOT', prompt='No'), | ||
]), | ||
}, | ||
), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=PPLInferencer), | ||
) | ||
|
||
BoolQ_eval_cfg = dict(evaluator=dict(type=AccEvaluator)) | ||
|
||
BoolQ_datasets = [ | ||
dict( | ||
abbr='BoolQ', | ||
type=BoolQDatasetV2, | ||
path='opencompass/boolq', | ||
reader_cfg=BoolQ_reader_cfg, | ||
infer_cfg=BoolQ_infer_cfg, | ||
eval_cfg=BoolQ_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
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
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,68 @@ | ||
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 AccEvaluator | ||
from opencompass.datasets import RaceDataset | ||
from opencompass.utils.text_postprocessors import ( | ||
first_option_postprocess, | ||
) | ||
|
||
QUERY_TEMPLATE = """ | ||
Answer the following multiple choice question. The last line of your response should be of the following format: 'ANSWER: $LETTER' (without quotes) where LETTER is one of ABCD. Think step by step before answering. | ||
Article: {article} | ||
Q: {question} | ||
A. {A} | ||
B. {B} | ||
C. {C} | ||
D. {D} | ||
""".strip() | ||
|
||
race_reader_cfg = dict( | ||
input_columns=['article', 'question', 'A', 'B', 'C', 'D'], | ||
output_column='answer', | ||
train_split='validation', | ||
test_split='test', | ||
) | ||
|
||
race_infer_cfg = dict( | ||
prompt_template=dict( | ||
type=PromptTemplate, | ||
template=dict( | ||
round=[ | ||
dict(role='HUMAN', prompt=QUERY_TEMPLATE), | ||
] | ||
), | ||
), | ||
retriever=dict(type=ZeroRetriever), | ||
inferencer=dict(type=GenInferencer), | ||
) | ||
|
||
race_eval_cfg = dict( | ||
evaluator=dict(type=AccEvaluator), | ||
pred_postprocessor=dict(type=first_option_postprocess, options='ABCD'), | ||
pred_role='BOT', | ||
) | ||
|
||
race_datasets = [ | ||
dict( | ||
abbr='race-middle', | ||
type=RaceDataset, | ||
path='opencompass/race', | ||
name='middle', | ||
reader_cfg=race_reader_cfg, | ||
infer_cfg=race_infer_cfg, | ||
eval_cfg=race_eval_cfg, | ||
), | ||
dict( | ||
abbr='race-high', | ||
type=RaceDataset, | ||
path='opencompass/race', | ||
name='high', | ||
reader_cfg=race_reader_cfg, | ||
infer_cfg=race_infer_cfg, | ||
eval_cfg=race_eval_cfg, | ||
), | ||
] |
Oops, something went wrong.