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

60 lines
1.8 KiB
Python
Raw Normal View History

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 import Creationv01Dataset
from mmengine.config import read_base
subjective_reader_cfg = dict(
input_columns=['question', 'prefix', 'suffix'],
output_column='judge',
)
subjective_all_sets = [
2024-05-14 15:35:58 +08:00
'creation_v0.1',
]
subjective_datasets = []
for _name in subjective_all_sets:
subjective_infer_cfg = dict(
prompt_template=dict(
type=PromptTemplate,
template=dict(round=[
dict(
role='HUMAN',
2024-05-14 15:35:58 +08:00
prompt='{question}'
),
]),
),
retriever=dict(type=ZeroRetriever),
inferencer=dict(type=GenInferencer, max_out_len=2048),
)
subjective_eval_cfg = dict(
evaluator=dict(
type=LMEvaluator,
prompt_template=dict(
type=PromptTemplate,
template=dict(round=[
dict(
role='HUMAN',
2024-05-14 15:35:58 +08:00
prompt = '{prefix}问题: <问题开始> {question} <问题结束>\n\n回答: <回答开始> {prediction} <回答结束>\n\n{suffix}'
),
]),
),
),
2024-05-14 15:35:58 +08:00
pred_role='BOT',
)
subjective_datasets.append(
dict(
2024-05-14 15:35:58 +08:00
abbr=f'{_name}',
type=Creationv01Dataset,
2024-05-14 15:35:58 +08:00
path='./data/subjective/',
name=_name,
reader_cfg=subjective_reader_cfg,
infer_cfg=subjective_infer_cfg,
eval_cfg=subjective_eval_cfg
))