2024-07-22 17:59:30 +08:00
|
|
|
from mmengine.config import read_base
|
|
|
|
|
|
|
|
with read_base():
|
|
|
|
# Inference PPL datasets
|
2024-08-22 14:48:45 +08:00
|
|
|
from opencompass.configs.datasets.inference_ppl.inference_ppl import inference_ppl_datasets
|
2024-07-22 17:59:30 +08:00
|
|
|
|
|
|
|
# Model configs
|
2024-08-22 14:48:45 +08:00
|
|
|
from opencompass.configs.models.qwen.hf_qwen1_5_7b import models as qwen1_5_7b
|
|
|
|
from opencompass.configs.models.qwen.hf_qwen1_5_14b import models as qwen1_5_14b
|
|
|
|
from opencompass.configs.models.hf_llama.hf_llama2_7b import models as llama2_7b
|
|
|
|
from opencompass.configs.models.hf_llama.hf_llama2_13b import models as llama2_13b
|
2024-07-22 17:59:30 +08:00
|
|
|
|
|
|
|
from opencompass.partitioners import NaivePartitioner
|
|
|
|
from opencompass.runners import LocalRunner
|
2025-01-20 19:17:38 +08:00
|
|
|
from opencompass.tasks import OpenICLEvalTask, OpenICLInferTask
|
2024-07-22 17:59:30 +08:00
|
|
|
|
|
|
|
# -------------Inference Stage ----------------------------------------
|
|
|
|
|
|
|
|
datasets = [*inference_ppl_datasets]
|
|
|
|
workdir = 'outputs/inference_ppl'
|
|
|
|
|
|
|
|
models = [
|
|
|
|
*qwen1_5_7b,
|
|
|
|
*qwen1_5_14b,
|
|
|
|
*llama2_7b,
|
|
|
|
*llama2_13b,
|
|
|
|
]
|
|
|
|
|
|
|
|
# Set custom batch_size and num_gpus for faster loss calculation
|
|
|
|
# Smaller batch_size should give more precise results, at the cost of worse efficiency
|
2025-01-20 19:17:38 +08:00
|
|
|
model_cfg = dict(batch_size=8, run_cfg=dict(num_gpus=4, num_procs=1))
|
2024-07-22 17:59:30 +08:00
|
|
|
|
|
|
|
for mdl in models:
|
|
|
|
mdl.update(model_cfg)
|
|
|
|
|
|
|
|
infer = dict(
|
|
|
|
partitioner=dict(type=NaivePartitioner),
|
|
|
|
runner=dict(
|
|
|
|
type=LocalRunner,
|
|
|
|
task=dict(type=OpenICLInferTask),
|
|
|
|
max_num_workers=256, # Maximum concurrent evaluation task count
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
# -------------Evaluation Stage ----------------------------------------
|
2025-01-20 19:17:38 +08:00
|
|
|
eval = dict(partitioner=dict(type=NaivePartitioner),
|
|
|
|
runner=dict(
|
|
|
|
type=LocalRunner,
|
|
|
|
task=dict(type=OpenICLEvalTask),
|
|
|
|
max_num_workers=256,
|
|
|
|
))
|