OpenCompass/configs/datasets/subjective/subjective_cmp/subjective_cmp.py

62 lines
2.0 KiB
Python
Raw Normal View History

2023-10-13 19:50:54 +08:00
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 LMEvaluator
from opencompass.datasets.subjective_cmp import SubjectiveCmpDataset
2023-10-13 19:50:54 +08:00
subjective_reader_cfg = dict(
2023-10-13 19:50:54 +08:00
input_columns=['question', 'index', 'reference_answer', 'evaluating_guidance', 'capability', 'prompt'],
output_column='judge',
2023-10-13 19:50:54 +08:00
train_split='test')
subjective_all_sets = [
2024-05-14 15:35:58 +08:00
'creation_v0.1',
2023-10-13 19:50:54 +08:00
]
subjective_datasets = []
2023-10-13 19:50:54 +08:00
for _name in subjective_all_sets:
subjective_infer_cfg = dict(
2023-10-13 19:50:54 +08:00
prompt_template=dict(
type=PromptTemplate,
template=dict(round=[
dict(
role='HUMAN',
2024-05-14 15:35:58 +08:00
prompt='{question}'
2023-10-13 19:50:54 +08:00
),
]),
),
retriever=dict(type=ZeroRetriever),
inferencer=dict(type=GenInferencer, max_out_len=2048),
2023-10-13 19:50:54 +08:00
)
subjective_eval_cfg = dict(
2023-10-13 19:50:54 +08:00
evaluator=dict(
type=LMEvaluator,
cmp_order='both',
prompt_template=dict(
type=PromptTemplate,
template=dict(
begin=[
dict(
2024-05-14 15:35:58 +08:00
role='SYSTEM',
fallback_role='HUMAN',
prompt='{prompt}'
2023-10-13 19:50:54 +08:00
),
],
2024-05-14 15:35:58 +08:00
round=[dict(role='HUMAN',
prompt='回答 1: <回答 1 开始> {prediction} <回答 1 结束>\n回答 2: <回答 2 开始> {prediction2} <回答 2 结束>\n')]))),
pred_role='BOT',
2023-10-13 19:50:54 +08:00
)
subjective_datasets.append(
2023-10-13 19:50:54 +08:00
dict(
2024-05-14 15:35:58 +08:00
abbr=f'{_name}',
type=SubjectiveCmpDataset,
2024-05-14 15:35:58 +08:00
path='./data/subjective/',
2023-10-13 19:50:54 +08:00
name=_name,
reader_cfg=subjective_reader_cfg,
infer_cfg=subjective_infer_cfg,
eval_cfg=subjective_eval_cfg
2023-10-13 19:50:54 +08:00
))