wikitext_2_raw_ppl_752e2a.py 1.12 KB
Newer Older
Kevin Wang's avatar
Kevin Wang committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 HFDataset


wikitext_infer_cfg = dict(
    prompt_template=dict(
        type=PromptTemplate,
        template={0: '{text}'}
    ),
    retriever=dict(type=ZeroRetriever),
    inferencer=dict(type=GenInferencer), # need a new ppl inferencer
)

wikitext_eval_cfg = dict(evaluator=dict(type=AccEvaluator), )

wikitext_2_raw_datasets = []
20
for _split in ['validation', 'test']:
Kevin Wang's avatar
Kevin Wang committed
21
22

    wikitext_reader_cfg = dict(
23
        input_columns=['text'],
Kevin Wang's avatar
Kevin Wang committed
24
        output_column=None,
25
        train_split='train',
Kevin Wang's avatar
Kevin Wang committed
26
27
28
29
30
        test_split=_split,
    )

    wikitext_2_raw_datasets.append(
        dict(
31
            abbr=f'wikitext-2-raw-{_split}',
Kevin Wang's avatar
Kevin Wang committed
32
            type=HFDataset,
33
34
            path='wikitext',
            name='wikitext-2-raw-v1',
Kevin Wang's avatar
Kevin Wang committed
35
36
37
38
39
            reader_cfg=wikitext_reader_cfg,
            infer_cfg=wikitext_infer_cfg,
            eval_cfg=wikitext_eval_cfg,
        )
    )