diff --git a/opencompass/utils/run.py b/opencompass/utils/run.py index accd3468f..323a05386 100644 --- a/opencompass/utils/run.py +++ b/opencompass/utils/run.py @@ -6,6 +6,7 @@ import tabulate from mmengine.config import Config +import opencompass from opencompass.datasets.custom import make_custom_dataset_config from opencompass.models import (VLLM, HuggingFace, HuggingFaceBaseModel, HuggingFaceCausalLM, HuggingFaceChatGLM3, @@ -234,7 +235,7 @@ def change_accelerator(models, accelerator): for model in models: logger.info(f'Transforming {model["abbr"]} to {accelerator}') # change HuggingFace model to VLLM or LMDeploy - if model['type'] in [HuggingFace, HuggingFaceCausalLM, HuggingFaceChatGLM3, f'{HuggingFaceBaseModel.__module__}.{HuggingFaceBaseModel.__name__}']: + if model['type'] in [HuggingFace, HuggingFaceCausalLM, HuggingFaceChatGLM3, eval(f'{HuggingFaceBaseModel.__module__}.{HuggingFaceBaseModel.__name__}')]: gen_args = dict() if model.get('generation_kwargs') is not None: generation_kwargs = model['generation_kwargs'].copy() @@ -294,7 +295,7 @@ def change_accelerator(models, accelerator): acc_model[item] = model[item] else: raise ValueError(f'Unsupported accelerator {accelerator} for model type {model["type"]}') - elif model['type'] in [HuggingFacewithChatTemplate, f'{HuggingFacewithChatTemplate.__module__}.{HuggingFacewithChatTemplate.__name__}']: + elif model['type'] in [HuggingFacewithChatTemplate, eval(f'{HuggingFacewithChatTemplate.__module__}.{HuggingFacewithChatTemplate.__name__}')]: if accelerator == 'vllm': mod = VLLMwithChatTemplate acc_model = dict(