"benchmark/profile_hf_generation.py" did not exist on "e68a1d00c4135a64eacd083827a52e6ae13b4106"
lawbench_zero_shot_gen_002588.py 2.02 KB
Newer Older
Leymore's avatar
Leymore committed
1
2
3
4
5
6
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 LawBenchDataset

names = [
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    ['1-1', 'article_recitation'],
    ['1-2', 'knowledge_question_answering'],
    ['2-1', 'document_proofreading'],
    ['2-2', 'dispute_focus_identification'],
    ['2-3', 'marital_disputes_identification'],
    ['2-4', 'issue_topic_identification'],
    ['2-5', 'reading_comprehension'],
    ['2-6', 'named_entity_recognition'],
    ['2-7', 'opinion_summarization'],
    ['2-8', 'argument_mining'],
    ['2-9', 'event_detection'],
    ['2-10', 'trigger_word_extraction'],
    ['3-1', 'fact_based_article_prediction'],
    ['3-2', 'scene_based_article_prediction'],
    ['3-3', 'charge_prediction'],
    ['3-4', 'prison_term_prediction_wo_article'],
    ['3-5', 'prison_term_prediction_w_article'],
    ['3-6', 'case_analysis'],
    ['3-7', 'criminal_damages_calculation'],
    ['3-8', 'consultation'],
Leymore's avatar
Leymore committed
27
28
29
30
31
32
33
34
35
36
37
38
39
]

lawbench_datasets = []
for index, name in names:
    lawbench_reader_cfg = dict(
        input_columns=['instruction', 'question'],
        output_column='answer')

    lawbench_infer_cfg = dict(
        prompt_template=dict(
            type=PromptTemplate,
            template=dict(
                round=[
40
                    dict(role='HUMAN', prompt='{instruction}\n{question}'),
Leymore's avatar
Leymore committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
                ]
            ),
        ),
        retriever=dict(type=ZeroRetriever),
        inferencer=dict(type=GenInferencer, max_out_len=1024)
    )

    lawbench_eval_cfg = dict(
        evaluator=dict(type='LawBenchEvaluator_' + index.replace('-', '_'))
    )

    lawbench_datasets.append(
        dict(
            abbr='lawbench-' + index + '-' + name + '-0-shot',
            type=LawBenchDataset,
            path='./data/lawbench/zero_shot',
            index=index,
            reader_cfg=lawbench_reader_cfg,
            infer_cfg=lawbench_infer_cfg,
            eval_cfg=lawbench_eval_cfg
        )
    )