2023-08-10 16:31:12 +08:00
|
|
|
from mmengine.config import read_base
|
2025-01-20 19:17:38 +08:00
|
|
|
|
2023-08-10 16:31:12 +08:00
|
|
|
from opencompass.models import OpenAI
|
|
|
|
from opencompass.partitioners import NaivePartitioner
|
|
|
|
from opencompass.runners import LocalRunner
|
|
|
|
from opencompass.tasks import OpenICLInferTask
|
|
|
|
|
|
|
|
with read_base():
|
2024-08-22 14:48:45 +08:00
|
|
|
from opencompass.configs.datasets.collections.chat_medium import datasets
|
|
|
|
from opencompass.configs.summarizers.medium import summarizer
|
2023-08-10 16:31:12 +08:00
|
|
|
|
|
|
|
# GPT4 needs a special humaneval postprocessor
|
|
|
|
from opencompass.datasets.humaneval import humaneval_gpt_postprocess
|
2025-01-20 19:17:38 +08:00
|
|
|
|
2023-08-10 16:31:12 +08:00
|
|
|
for _dataset in datasets:
|
|
|
|
if _dataset['path'] == 'openai_humaneval':
|
2025-01-20 19:17:38 +08:00
|
|
|
_dataset['eval_cfg']['pred_postprocessor'][
|
|
|
|
'type'] = humaneval_gpt_postprocess
|
2023-08-10 16:31:12 +08:00
|
|
|
|
2025-01-20 19:17:38 +08:00
|
|
|
api_meta_template = dict(round=[
|
|
|
|
dict(role='HUMAN', api_role='HUMAN'),
|
|
|
|
dict(role='BOT', api_role='BOT', generate=True),
|
|
|
|
], )
|
2023-08-10 16:31:12 +08:00
|
|
|
|
|
|
|
models = [
|
2025-01-20 19:17:38 +08:00
|
|
|
dict(
|
|
|
|
abbr='GPT4',
|
|
|
|
type=OpenAI,
|
|
|
|
path='gpt-4-0613',
|
|
|
|
key=
|
|
|
|
'ENV', # The key will be obtained from $OPENAI_API_KEY, but you can write down your key here as well
|
2023-08-10 16:31:12 +08:00
|
|
|
meta_template=api_meta_template,
|
|
|
|
query_per_second=1,
|
2025-01-20 19:17:38 +08:00
|
|
|
max_out_len=2048,
|
|
|
|
max_seq_len=2048,
|
|
|
|
batch_size=8),
|
2023-08-10 16:31:12 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
infer = dict(
|
|
|
|
partitioner=dict(type=NaivePartitioner),
|
2025-01-20 19:17:38 +08:00
|
|
|
runner=dict(type=LocalRunner,
|
|
|
|
max_num_workers=4,
|
|
|
|
task=dict(type=OpenICLInferTask)),
|
2023-08-10 16:31:12 +08:00
|
|
|
)
|