eval_lightllm.py 1.37 KB
Newer Older
1
2
3
4
5
6
7
from mmengine.config import read_base
from opencompass.models import LightllmAPI
from opencompass.partitioners import NaivePartitioner
from opencompass.runners import LocalRunner
from opencompass.tasks import OpenICLInferTask

with read_base():
8
    from .summarizers.leaderboard import summarizer
9
10
11
12
    from .datasets.humaneval.humaneval_gen import humaneval_datasets

datasets = [*humaneval_datasets]

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
# Prompt template for InternLM2-Chat
# https://github.com/InternLM/InternLM/blob/main/chat/chat_format.md

_meta_template = dict(
    begin='<|im_start|>system\nYou are InternLM2-Chat, a harmless AI assistant<|im_end|>\n',
    round=[
        dict(role='HUMAN', begin='<|im_start|>user\n', end='<|im_end|>\n'),
        dict(role='BOT', begin='<|im_start|>assistant\n', end='<|im_end|>\n', generate=True),
    ]
)
'''

_meta_template = None

28
29
30
31
models = [
    dict(
        abbr='LightllmAPI',
        type=LightllmAPI,
32
33
        url='http://localhost:1030/generate',
        meta_template=_meta_template,
34
        batch_size=32,
35
36
        rate_per_worker=32,
        retry=4,
37
38
39
        generation_kwargs=dict(
            do_sample=False,
            ignore_eos=False,
40
            max_new_tokens=1024
41
42
43
44
45
46
47
48
        ),
    ),
]

infer = dict(
    partitioner=dict(type=NaivePartitioner),
    runner=dict(
        type=LocalRunner,
49
        max_num_workers=32,
50
51
52
        task=dict(type=OpenICLInferTask),
    ),
)