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

* fix pip version * fix pip version * update (#1522) Co-authored-by: zhulin1 <zhulin1@pjlab.org.cn> * [Feature] Update Models (#1518) * Update Models * Update * Update humanevalx * Update * Update * [Feature] Dataset prompts update for ARC, BoolQ, Race (#1527) add judgerbench and reorg sub add judgerbench and reorg subeval add judgerbench and reorg subeval * add judgerbench and reorg subeval * add judgerbench and reorg subeval * add judgerbench and reorg subeval * add judgerbench and reorg subeval --------- Co-authored-by: zhulinJulia24 <145004780+zhulinJulia24@users.noreply.github.com> Co-authored-by: zhulin1 <zhulin1@pjlab.org.cn> Co-authored-by: Songyang Zhang <tonysy@users.noreply.github.com> Co-authored-by: Linchen Xiao <xxllcc1993@gmail.com>
52 lines
2.1 KiB
Python
52 lines
2.1 KiB
Python
from typing import Callable, List, Optional, Type, Union
|
|
|
|
from mmengine.registry import METRICS as MMENGINE_METRICS
|
|
from mmengine.registry import Registry as OriginalRegistry
|
|
|
|
|
|
class Registry(OriginalRegistry):
|
|
|
|
# override the default force behavior
|
|
def register_module(
|
|
self,
|
|
name: Optional[Union[str, List[str]]] = None,
|
|
force: bool = True,
|
|
module: Optional[Type] = None) -> Union[type, Callable]:
|
|
return super().register_module(name, force, module)
|
|
|
|
|
|
PARTITIONERS = Registry('partitioner', locations=['opencompass.partitioners'])
|
|
RUNNERS = Registry('runner', locations=['opencompass.runners'])
|
|
TASKS = Registry('task', locations=['opencompass.tasks'])
|
|
MODELS = Registry('model', locations=['opencompass.models'])
|
|
# TODO: LOAD_DATASET -> DATASETS
|
|
LOAD_DATASET = Registry('load_dataset', locations=['opencompass.datasets'])
|
|
TEXT_POSTPROCESSORS = Registry(
|
|
'text_postprocessors', locations=['opencompass.utils.text_postprocessors'])
|
|
DICT_POSTPROCESSORS = Registry(
|
|
'dict_postprocessors', locations=['opencompass.utils.dict_postprocessors'])
|
|
|
|
EVALUATORS = Registry('evaluators', locations=['opencompass.evaluators'])
|
|
|
|
ICL_INFERENCERS = Registry('icl_inferencers',
|
|
locations=['opencompass.openicl.icl_inferencer'])
|
|
ICL_RETRIEVERS = Registry('icl_retrievers',
|
|
locations=['opencompass.openicl.icl_retriever'])
|
|
ICL_DATASET_READERS = Registry(
|
|
'icl_dataset_readers',
|
|
locations=['opencompass.openicl.icl_dataset_reader'])
|
|
ICL_PROMPT_TEMPLATES = Registry(
|
|
'icl_prompt_templates',
|
|
locations=['opencompass.openicl.icl_prompt_template'])
|
|
ICL_EVALUATORS = Registry('icl_evaluators',
|
|
locations=['opencompass.openicl.icl_evaluator'])
|
|
METRICS = Registry('metric',
|
|
parent=MMENGINE_METRICS,
|
|
locations=['opencompass.metrics'])
|
|
TOT_WRAPPER = Registry('tot_wrapper', locations=['opencompass.datasets'])
|
|
|
|
|
|
def build_from_cfg(cfg):
|
|
"""A helper function that builds object with MMEngine's new config."""
|
|
return PARTITIONERS.build(cfg)
|