XLSum_gen_2bb71c.py 975 Bytes
Newer Older
Leymore's avatar
Leymore committed
1
2
3
4
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 RougeEvaluator
Leymore's avatar
Leymore committed
5
from opencompass.datasets import XLSUMDataset, Xsum_postprocess
Leymore's avatar
Leymore committed
6
7
8
9
10
11
12
13
14
15
16
17
18

XLSum_reader_cfg = dict(input_columns=['text'], output_column='summary')

XLSum_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template='Document:{text}\n'
        'Based on the previous text, provide a brief single summary:'),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer))

XLSum_eval_cfg = dict(
    evaluator=dict(type=RougeEvaluator),
Leymore's avatar
Leymore committed
19
    pred_postprocessor=dict(type=Xsum_postprocess),
Leymore's avatar
Leymore committed
20
21
22
23
24
25
26
27
28
29
)

XLSum_datasets = [
    dict(
        type=XLSUMDataset,
        path='csebuetnlp/xlsum',
        reader_cfg=XLSum_reader_cfg,
        infer_cfg=XLSum_infer_cfg,
        eval_cfg=XLSum_eval_cfg)
]