2024-08-01 00:42:48 +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 . datasets import LongBenchF1Evaluator , LongBench2wikimqaDataset
LongBench_2wikimqa_reader_cfg = dict (
input_columns = [ ' context ' , ' input ' ] ,
output_column = ' answers ' ,
train_split = ' test ' ,
2024-09-06 15:50:12 +08:00
test_split = ' test ' ,
2024-08-01 00:42:48 +08:00
)
LongBench_2wikimqa_infer_cfg = dict (
prompt_template = dict (
type = PromptTemplate ,
template = dict (
round = [
2024-09-06 15:50:12 +08:00
dict (
role = ' HUMAN ' ,
prompt = ' Answer the question based on the given passages. Only give me the answer and do not output any other words. \n \n The following are given passages. \n {context} \n \n Answer the question based on the given passages. Only give me the answer and do not output any other words. \n \n Question: {input} \n Answer: ' ,
) ,
] ,
) ,
) ,
2024-08-01 00:42:48 +08:00
retriever = dict ( type = ZeroRetriever ) ,
2024-09-06 15:50:12 +08:00
inferencer = dict ( type = GenInferencer , max_out_len = 32 ) ,
2024-08-01 00:42:48 +08:00
)
LongBench_2wikimqa_eval_cfg = dict (
2024-09-06 15:50:12 +08:00
evaluator = dict ( type = LongBenchF1Evaluator ) , pred_role = ' BOT '
2024-08-01 00:42:48 +08:00
)
LongBench_2wikimqa_datasets = [
dict (
type = LongBench2wikimqaDataset ,
abbr = ' LongBench_2wikimqa ' ,
2024-09-06 15:50:12 +08:00
path = ' opencompass/Longbench ' ,
2024-08-01 00:42:48 +08:00
name = ' 2wikimqa ' ,
reader_cfg = LongBench_2wikimqa_reader_cfg ,
infer_cfg = LongBench_2wikimqa_infer_cfg ,
2024-09-06 15:50:12 +08:00
eval_cfg = LongBench_2wikimqa_eval_cfg ,
)
2024-08-01 00:42:48 +08:00
]