mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00

* [fix]Fixed the issue caused by the repeated loading of VLLM model during task segmentation. * [fix] avoid TypeError: VLLM.__init__() got an unexpected keyword argument 'tokenizer_only' * restore .pre-commit-config.yaml * restore opencompass/tasks/openicl_infer.py --------- Co-authored-by: IcyFeather <mengzhuo.happy@gmail.com> Co-authored-by: Leymore <zfz-960727@163.com>
27 lines
802 B
Python
27 lines
802 B
Python
import copy
|
|
|
|
from mmengine.config import ConfigDict
|
|
|
|
from opencompass.registry import LOAD_DATASET, MODELS
|
|
|
|
|
|
def build_dataset_from_cfg(dataset_cfg: ConfigDict):
|
|
dataset_cfg = copy.deepcopy(dataset_cfg)
|
|
dataset_cfg.pop('infer_cfg', None)
|
|
dataset_cfg.pop('eval_cfg', None)
|
|
dataset_cfg.pop('abbr', None)
|
|
return LOAD_DATASET.build(dataset_cfg)
|
|
|
|
|
|
def build_model_from_cfg(model_cfg: ConfigDict):
|
|
model_cfg = copy.deepcopy(model_cfg)
|
|
model_cfg.pop('run_cfg', None)
|
|
model_cfg.pop('max_out_len', None)
|
|
model_cfg.pop('batch_size', None)
|
|
model_cfg.pop('abbr', None)
|
|
model_cfg.pop('summarizer_abbr', None)
|
|
model_cfg.pop('pred_postprocessor', None)
|
|
model_cfg.pop('min_out_len', None)
|
|
model_cfg.pop('tokenizer_only', None)
|
|
return MODELS.build(model_cfg)
|